maharanasarkar / whatsapp-connector-rasa

A custom channel connector to connect WhatsApp API to Rasa
Apache License 2.0
13 stars 6 forks source link

RasaException: Failed to find input channel class for 'whatsapp' #2

Open maraal opened 8 months ago

maraal commented 8 months ago

I have the folowing directory structure:

.
├── actions.log
├── bot
│   ├── actions
│   ├── actions.log
│   ├── config.yml
│   ├── credentials.yml
│   ├── data
│   ├── domain.yml
│   ├── endpoints.yml
│   ├── models
│   └── tests
├── models
│   └── 20231024-184043-plain-landaulet.tar.gz
├── rasa-whatsapp_connector
│   ├── LICENSE
│   ├── README.md
│   └── whatsapp.py
└── venv
    ├── bin
    ├── include
    ├── lib
    ├── lib64 -> lib
    ├── LICENSE.txt
    ├── pyvenv.cfg
    └── share

13 directories, 12 files

When I try rasa run from the bot dirctory, i got the following error:

RasaException: Failed to find input channel class for 'whatsapp'. Unknown input channel. Check your credentials configuration to make sure the mentioned channel is not misspelled. If you are creating your own channel, make sure it is a proper name of a class in a module

endpoints.yml

# This file contains the different endpoints your bot can use.

# Server where the models are pulled from.
# https://rasa.com/docs/rasa/model-storage#fetching-models-from-a-server

#models:
#  url: http://my-server.com/models/default_core@latest
#  wait_time_between_pulls:  10   # [optional](default: 100)

# Server which runs your custom actions.
# https://rasa.com/docs/rasa/custom-actions

action_endpoint:
  url: "http://localhost:5055/webhook"

# Tracker store which is used to store the conversations.
# By default the conversations are stored in memory.
# https://rasa.com/docs/rasa/tracker-stores

#tracker_store:
#    type: redis
#    url: <host of the redis instance, e.g. localhost>
#    port: <port of your redis instance, usually 6379>
#    db: <number of your database within redis, e.g. 0>
#    password: <password used for authentication>
#    use_ssl: <whether or not the communication is encrypted, default false>

#tracker_store:
#    type: mongod
#    url: <url to your mongo instance, e.g. mongodb://localhost:27017>
#    db: <name of the db within your mongo instance, e.g. rasa>
#    username: <username used for authentication>
#    password: <password used for authentication>

# Event broker which all conversation events should be streamed to.
# https://rasa.com/docs/rasa/event-brokers

#event_broker:
#  url: localhost
#  username: username
#  password: password
#  queue: queue

custom_whatsapp_connector.CustomWhatsAppInput:
  webhook_url: "https://my_domain/webhook"

credentials.yml

# This file contains the credentials for the voice & chat platforms
# which your bot is using.
# https://rasa.com/docs/rasa/messaging-and-voice-channels

rest:
#  # you don't need to provide anything here - this channel doesn't
#  # require any credentials

#facebook:
#  verify: "<verify>"
#  secret: "<your secret>"
#  page-access-token: "<your page access token>"

#slack:
#  slack_token: "<your slack token>"
#  slack_channel: "<the slack channel>"
#  slack_signing_secret: "<your slack signing secret>"

#socketio:
#  user_message_evt: <event name for user message>
#  bot_message_evt: <event name for bot messages>
#  session_persistence: <true/false>

#mattermost:
#  url: "https://<mattermost instance>/api/v4"
#  token: "<bot token>"
#  webhook_url: "<callback URL>"

# This entry is needed if you are using Rasa Enterprise. The entry represents credentials
# for the Rasa Enterprise "channel", i.e. Talk to your bot and Share with guest testers.
rasa:
  url: "http://localhost:5002/api"

whatsapp:
  auth_token: "my_auth_token"
  phone_number_id: "my_phone_number_id"
  verify_token: "my_verify_token" 
aandrewsv commented 5 months ago

@maraal did you manage to set it up?? im having the same issue

aandrewsv commented 5 months ago

Found the reason, was because i was not installing heyoo which is what the connector is using to send whatsapp messages so when rasa loaded the connector it was raising an ImportError.

maharanasarkar commented 5 months ago

Found the reason, was because i was not installing heyoo which is what the connector is using to send whatsapp messages so when rasa loaded the connector it was raising an ImportError.

If this hasn't solved the problem, you must import input class from the whatsapp.py to rasa/core/channels/init.py

thatcuteseller commented 3 months ago

Found the reason, was because i was not installing heyoo which is what the connector is using to send whatsapp messages so when rasa loaded the connector it was raising an ImportError.

If this hasn't solved the problem, you must import input class from the whatsapp.py to rasa/core/channels/init.py

Could you provide steps to do this, I also getting the same error

aandrewsv commented 3 months ago

You need to have heyoo installed in the python enviroment first so:

pip install heyoo

Then i've added whatsapp.py file at this route:

addons/whatsapp.py

Then in credentials.yml file i have this:

addons.whatsapp.WhatsAppInput:
  auth_token: "auth_token"
  phone_number_id: "phone_number_id"
  verify_token: "verify_token"
thatcuteseller commented 3 months ago

@aandrewsv Thanks , I got it working, It was an SSL issue. I moved the whatsapp.py to rasa/core/channels and modified rasa/core/channels/init.py to include whatsapp.

revonsio commented 1 month ago

@thatcuteseller I have tried your steps, but I still face the same error. Hereby i attach the related images, every helps are welcome, thanks :) image image