# Deploy to Server with Custom Facebook Connector

**URL:** <https://forum.rasa.com/t/deploy-to-server-with-custom-facebook-connector/30427>\
**Category:** \[Deprecated\] Rasa X Community Edition\
**Created:** [June 19, 2020, 6:54pm UTC](https://forum.rasa.com/t/deploy-to-server-with-custom-facebook-connector/30427 "2020-06-19T18:54:41Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![MatthewVielkind](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/matthewvielkind/32/9610_2.png) [@MatthewVielkind](https://forum.rasa.com/u/MatthewVielkind)\
**Post date:** [June 19, 2020, 6:54pm UTC](https://forum.rasa.com/t/deploy-to-server-with-custom-facebook-connector/30427/1 "2020-06-19T18:54:41Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Tobias\_Wochinger](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tobias_wochinger/32/4580_2.png) [@Tobias\_Wochinger](https://forum.rasa.com/u/Tobias_Wochinger)\
**Post date:** [June 22, 2020, 11:58am UTC](https://forum.rasa.com/t/deploy-to-server-with-custom-facebook-connector/30427/2 "2020-06-22T11:58:21Z")

</div>

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?](http://forum.rasa.com/t/deploying-docker-installed-rasa-x-to-facebook-slack-how-to-find-port-of-server/30479).

> 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 😬

---

<div class="post-metadata">

**Author:** ![MatthewVielkind](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/matthewvielkind/32/9610_2.png) [@MatthewVielkind](https://forum.rasa.com/u/MatthewVielkind)\
**Post date:** [June 23, 2020, 11:20am UTC](https://forum.rasa.com/t/deploy-to-server-with-custom-facebook-connector/30427/3 "2020-06-23T11:20:23Z")

</div>

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

```bash
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.

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

```

#### Create docker-compose.override.yml

```bash
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.

```auto
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.

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

```

#### Done!

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

---

<div class="post-metadata">

**Author:** ![Tobias\_Wochinger](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tobias_wochinger/32/4580_2.png) [@Tobias\_Wochinger](https://forum.rasa.com/u/Tobias_Wochinger)\
**Post date:** [June 24, 2020, 11:20am UTC](https://forum.rasa.com/t/deploy-to-server-with-custom-facebook-connector/30427/4 "2020-06-24T11:20:44Z")

</div>

Slick, great work @MatthewVielkind 🚀 💪

---

<div class="post-metadata">

**Author:** ![MaheshMahi19](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@MaheshMahi19](https://forum.rasa.com/u/MaheshMahi19)\
**Post date:** [June 24, 2020, 4:12pm UTC](https://forum.rasa.com/t/deploy-to-server-with-custom-facebook-connector/30427/5 "2020-06-24T16:12:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MatthewVielkind](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/matthewvielkind/32/9610_2.png) [@MatthewVielkind](https://forum.rasa.com/u/MatthewVielkind)\
**Post date:** [June 24, 2020, 8:03pm UTC](https://forum.rasa.com/t/deploy-to-server-with-custom-facebook-connector/30427/6 "2020-06-24T20:03:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MaheshMahi19](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@MaheshMahi19](https://forum.rasa.com/u/MaheshMahi19)\
**Post date:** [June 27, 2020, 7:21am UTC](https://forum.rasa.com/t/deploy-to-server-with-custom-facebook-connector/30427/7 "2020-06-27T07:21:32Z")

</div>

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

Thanks

---

<div class="post-metadata">

**Author:** ![geniuslead](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/geniuslead/32/12091_2.png) [@geniuslead](https://forum.rasa.com/u/geniuslead)\
**Post date:** [February 5, 2021, 11:18am UTC](https://forum.rasa.com/t/deploy-to-server-with-custom-facebook-connector/30427/8 "2021-02-05T11:18:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Vin](https://avatars.discourse-cdn.com/v4/letter/v/a87d85/32.png) [@Vin](https://forum.rasa.com/u/Vin)\
**Post date:** [July 19, 2021, 7:23pm UTC](https://forum.rasa.com/t/deploy-to-server-with-custom-facebook-connector/30427/9 "2021-07-19T19:23:03Z")

</div>

@Tobias_WochingerOn 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](http://forum.rasa.com/t/alexa-skill-with-rasa-x/45839)

---

<div class="post-metadata">

**Author:** ![Tobias\_Wochinger](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tobias_wochinger/32/4580_2.png) [@Tobias\_Wochinger](https://forum.rasa.com/u/Tobias_Wochinger)\
**Post date:** [July 26, 2021, 4:11pm UTC](https://forum.rasa.com/t/deploy-to-server-with-custom-facebook-connector/30427/10 "2021-07-26T16:11:55Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Italosayan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/italosayan/32/17389_2.png) [@Italosayan](https://forum.rasa.com/u/Italosayan)\
**Post date:** [December 10, 2022, 12:18pm UTC](https://forum.rasa.com/t/deploy-to-server-with-custom-facebook-connector/30427/11 "2022-12-10T12:18:33Z")

</div>

Thank you matthew! This would be in the documentation
