Deploy to Server with Custom Facebook Connector

What’s the preferred way to deploy to Rasa X with a custom connector?

I have a Facebook Messenger bot that handles incoming images from users. When I was testing locally I manipulated Rasa’s facebook.py file to handle incoming images and I have no issues.

Now I’m looking to deploy the bot to a server and I’m unsure how to go about deploying my bot with this custom connector.

I don’t have a ton of experience with deployment tasks so any help is greatly appreciated!

How did you deploy Rasa X @MatthewVielkind?

I think some parts of your question might be answered in this post: Deploying Docker-Installed Rasa X to Facebook/Slack. How to find port of server?.

I manipulated Rasa’s facebook.py file to handle incoming images and I have no issues.

Why did you have to manipulate it? When deploying everything that would mean that you need to build a custom docker image :grimacing:

Hi @Tobias_Wochinger ,

Thanks for the response! I worked at this for a couple days and think I understand the docker-compose deployment process a little better now. I was able to setup the custom connector on my EC2 instance with the following steps. Do these appear correct? Or is there a better way to go about accomplishing this?

Install Rasa X

curl -sSL -o install.sh https://storage.googleapis.com/rasa-x-releases/0.29.1/install.sh
bash ./install.sh

Create Connectors Directory

Once Rasa X is installed create a module within /etc/rasa to store the custom connection code.

cd /etc/rasa
mkdir connectors
touch connectors/__init__.py
touch connectors/custom_facebook.py
nano connectors/custom_facebook.py

Create docker-compose.override.yml

cd /etc/rasa
touch docker-compse.override.yml
nano docker-compose.override.yml

Within docker-compose.override.yml I’m pointing to the connectors module created above.

version: '3.4'
services:
  rasa-production:
    volumes:
      - ./connectors:/app/connectors
  rasa-worker:
    volumes:
      - ./connectors:/app/connectors

Update credentials.yml

Finally I’m adding the following to credentials.yml to allow my custom connector to be verified by Facebook.

connectors.custom_facebook.FacebookInput:
  verify:
  secret:
  page-access-token:

Done!

Start Rasa-X and verify /webooks/custom_facebook/webhook through Facebook.

7 Likes

Slick, great work @MatthewVielkind :rocket: :muscle:

What about the default connectors?? Still can we use them?

In the specific case here I copied the default facebook.py connector then added some code to pass images to my bot, which is the custom_facebook.py file. So the same functionality of the default facebook connector is maintained, just extended a little bit to fit my use case.

I haven’t tried adding other channels, but if you setup additional channels in credentials.yml and connected the webhooks I don’t see why that wouldn’t work.

I’ve tried the same way you did… I’ve been getting the 502 Bad Gateway :frowning: Could you explain it bit more clear??

Thanks

have been trying to get Alexa custom connectors working on prod, but was no luck since 2 months. Your steps magically started working, thanks for this post saved my time.

@Tobias_Wochinger On the Rasa X conversations tab, do all conversations by different Users with the custom channel (Facebook/Alexa) appear in different tabs or one single tab asking for Issue #45839

yep. Different conversation IDs get different users. Note that depending on the channel connector a user might have different conversation IDs (they should be the same with Facebook / Alexa though)

Thank you matthew! This would be in the documentation