Channel response not being returned

I have a custom channel setup but when I make a request to that channel I get the default response instead. The custom channel code:

from rasa.core.channels.channel import RestInput, InputChannel, 
OutputChannel, UserMessage, CollectingOutputChannel
from rasa.utils.common import raise_warning
from sanic import Blueprint, response
from sanic.request import Request
from sanic.response import HTTPResponse
from typing import Any, Awaitable, Callable, Dict, List, Optional, Text

class SparkGatewayRestInput(InputChannel):
    @classmethod
    def name(cls) -> Text:
        return "spark-gateway"

@classmethod
def blueprint(
    self, on_new_message: Callable[[UserMessage], Awaitable[Any]]
) -> Blueprint:
    spark_webhook = Blueprint("spark_webhook", __name__)

    @spark_webhook.route("/", methods=["GET"])
    async def health(_: Request) -> HTTPResponse:
        return response.json({"status": "ok"})

    @spark_webhook.route("/webhook", methods=["POST"])
    async def webhook(request: Request) -> HTTPResponse:
        req_json = request.json
        sender_id = req_json.get("sender", None)
        text = req_json.get("message", None)
        input_channel = req_json.get("input_channel") or self.name()
        metadata = req_json.get("metadata", None)

        collector = CollectingOutputChannel()

        try:
            await on_new_message(
                UserMessage(
                    text,
                    collector,
                    sender_id,
                    input_channel=input_channel,
                    metadata=metadata,
                )
            )
        except Exception:
            logger.exception(
                f"An exception occured while handling "
                f"user message '{text}'."
            )

        
        return response.json(collector.messages)

    return spark_webhook

I did notice that collector.messages returns an empty array, not sure if that is the issue here.

Here is an example response yaml:

  utter_something:
  - text: This is the default response
  - text: This is the custom channel response
    channel: spark-gateway

Im making the request to /webhooks/spark-gateway/webhook

@tatianaf Can you explain what in the standard slack integration is missing for you?

No, I need a custom channel. Are custom connectors no longer supported by Rasa? Im surprised its this difficult to make it work and no response on the forum or github about it… Could definitely use better documentation for setting up the blueprint method with collector.

Hi!

I had something similar to this. The returned collector object collector.messages will be an empty list [] if the intent is defined in the domain.yml while it’s not in story.yml. so when you trigger the intent to get a valid utter, there is no story for that! and because of that, an empty list will be returned.

Therefore, you need wither define a story for this intent or delete this intent from nlu.yml and domain.yml

I hope you find this useful.