Skip to content

Commit

Permalink
Update custom-connectors.mdx
Browse files Browse the repository at this point in the history
Adding `self` argument to the name method and change `text` to `message` to match the same request schema of the /rest channel
  • Loading branch information
AbdullahDornika authored Nov 21, 2024
1 parent 7807b19 commit d354dab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/docs/connectors/custom-connectors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ from rasa.core.channels.channel import (
)

class MyIO(InputChannel):
def name() -> Text:
def name(self) -> Text:
"""Name of your custom channel."""
return "myio"

Expand All @@ -119,7 +119,7 @@ class MyIO(InputChannel):
@custom_webhook.route("/webhook", methods=["POST"])
async def receive(request: Request) -> HTTPResponse:
sender_id = request.json.get("sender") # method to get sender_id
text = request.json.get("text") # method to fetch text
text = request.json.get("message") # method to fetch text | changig field to 'message' to be the same as in the request to /rest endpoint
input_channel = self.name() # method to fetch input channel
metadata = self.get_metadata(request) # method to get metadata

Expand Down

0 comments on commit d354dab

Please sign in to comment.