# Rasa chatbot on Instagram

**URL:** <https://forum.rasa.com/t/rasa-chatbot-on-instagram/51762>\
**Category:** Tutorials, Resources & Videos\
**Tags:** community, rasa\
**Created:** [March 6, 2022, 5:48pm UTC](https://forum.rasa.com/t/rasa-chatbot-on-instagram/51762 "2022-03-06T17:48:48Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rafaelinacio](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/rafaelinacio/32/19690_2.png) [@rafaelinacio](https://forum.rasa.com/u/rafaelinacio)\
**Post date:** [March 6, 2022, 5:48pm UTC](https://forum.rasa.com/t/rasa-chatbot-on-instagram/51762/1 "2022-03-06T17:48:48Z")

</div>

# **Rasa chatbot on Instagram**

## **Vídeo**

- [Youtube](https://www.youtube.com/watch?v=p0hIMOvUmxY)

## **Overview**

This document is intended to help you to deploy your rasa Chatbot (Custom Connectors), for Instagram.

## **Instagram Setup**

First, you need to set up a [Facebook Page](https://www.facebook.com/business/pages) and an [app](https://developers.facebook.com/docs/messenger-platform/) to get the credentials to connect to Instagram Messenger. Once you get them, you can add them to your credentials.yml.

## Chatbot Rasa

- Create the directory `connectors` with an custom\_instagram.py file inside, so add the code available below:

![Untitled](https://raw.githubusercontent.com/rafaelinacioo/rasa_instagram/main/img/01.png)

- Now, in the project root credentials.yml, create your connector `connectors.custom_instagram.InstagramInput` that is configured to return the name “instragram”:

![Untitled](https://raw.githubusercontent.com/rafaelinacioo/rasa_instagram/main/img/02.png)

## 

### Getting Credentials

**How to get the Facebook credentials:** You need to set up a Facebook app and a page.

1. To create the app head over to **[Facebook for Developers](https://developers.facebook.com/)** and click on **My Apps** → **Add New App**.

2. Go onto the dashboard for the app and under **Products** , find the **Messenger** section and click **Set Up**. Scroll down to **Token Generation** and click on the link to create a new page for your app.

3. Create your page and select it in the dropdown menu for the **Token Generation**. The shown **Page Access Token** is the `page-access-token` needed later on.

4. Locate the **App Secret** in the app dashboard under **Settings** → **Basic**. This will be your `secret`.

5. Use the collected `secret` and `page-access-token` in your `credentials.yml`, and add a field called `verify` containing a string of your choice. Start `rasa run` with the `-credentials credentials.yml` option.

6. Set up a **Webhook** and select at least the **messaging** and **messaging\_postback** subscriptions. Insert your callback URL, which will look like `https://<host>:<port>/webhooks/instagram/webhook`, replacing the host and port with the appropriate values from your running Rasa X or Rasa Open Source server.

## **Running on Instagram**

Add Instagram credentials to your credentials.yml:

connectors.custom\_instagram.InstagramInput:

```
verify: "instagram"

secret: ""    

page-access-token : ""

```

## **Configure Instagram**

Adding User for Chatbot Test.

- Click on the **Functions** menu then click on “functions” and in the center of the screen click on “Add Testers”.

Note: To show the profile in the field, when adding a tester, both must be friends on Facebook.

![Untitled](https://raw.githubusercontent.com/rafaelinacioo/rasa_instagram/main/img/03.png)

![Untitled](https://raw.githubusercontent.com/rafaelinacioo/rasa_instagram/main/img/04.png)

- Now just access Instagram, and follow the page.

![Untitled](https://raw.githubusercontent.com/rafaelinacioo/rasa_instagram/main/img/05.png)

- Then let’s talk to the profile.

![Untitled](https://raw.githubusercontent.com/rafaelinacioo/rasa_instagram/main/img/06.png)

- We have reached the end of the Instagram Chatbot integration.

## **Reference**

- [Rasa Facebook Messenger](https://rasa.com/docs/rasa/connectors/facebook-messenger/)

- [Facebook Developers](https://developers.facebook.com/)

- [Rasa Connecting to A Channel](https://rasa.com/docs/rasa/messaging-and-voice-channels#testing-channels-on-your-local-machine)

- [Instagram API](https://developers.facebook.com/products/messenger/messenger-api-instagram/)

- [Facebook business](https://www.facebook.com/business/pages)

- [Instagram Webhook](https://developers.facebook.com/docs/messenger-platform/webhook)

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [March 6, 2022, 6:08pm UTC](https://forum.rasa.com/t/rasa-chatbot-on-instagram/51762/2 "2022-03-06T18:08:57Z")

</div>

Wow, thanks a lot for sharing! 🤩

---

<div class="post-metadata">

**Author:** ![masoudMZB](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/masoudmzb/32/20102_2.png) [@masoudMZB](https://forum.rasa.com/u/masoudMZB)\
**Post date:** [May 1, 2022, 8:42am UTC](https://forum.rasa.com/t/rasa-chatbot-on-instagram/51762/4 "2022-05-01T08:42:34Z")

</div>

thanks for sharing, but I didn’t understand these parts :

> [@rafaelinacio](#):
>
> Note: To show the profile in the field, when adding a tester, both must be friends on Facebook.

what are those 2 accounts? is Instagram user different from these 2 accounts ?

> Set up a **Webhook** and select at least the **messaging** and **messaging\_postback** subscriptions. Insert your callback URL, which will look like `https://<host>:<port>/webhooks/facebook/webhook`, replacing the host and port with the appropriate values from your running Rasa X or Rasa Open Source server.Insert the **Verify Token** which has to match the `verify` entry in your `credentials.yml`.

what do you mean by Set up a **Webhook** and select at least the **messaging** and **messaging\_postback** subscriptions.

---

<div class="post-metadata">

**Author:** ![rafaelinacio](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/rafaelinacio/32/19690_2.png) [@rafaelinacio](https://forum.rasa.com/u/rafaelinacio)\
**Post date:** [May 1, 2022, 10:51am UTC](https://forum.rasa.com/t/rasa-chatbot-on-instagram/51762/5 "2022-05-01T10:51:19Z")

</div>

Insert your callback URL, which will look like `https://<host>:<port>/webhooks/instagram/webhook`

verify instagram

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/3X/d/f/df323fe8fe5080f49ee26f3fe6b4b6461c8f9efc.jpeg) ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/3X/9/a/9a32b8bad113dc3e9e67e8741f241fff2a6d080b.jpeg)

---

<div class="post-metadata">

**Author:** ![aarroyo](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@aarroyo](https://forum.rasa.com/u/aarroyo)\
**Post date:** [May 9, 2022, 5:07pm UTC](https://forum.rasa.com/t/rasa-chatbot-on-instagram/51762/6 "2022-05-09T17:07:49Z")

</div>

Thanks for sharing! Is it necessary to use different apps (as the webhooks are different) to integrate the bot to instagram and messenger? or is it possible to use the same app for both?

---

<div class="post-metadata">

**Author:** ![rafaelinacio](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/rafaelinacio/32/19690_2.png) [@rafaelinacio](https://forum.rasa.com/u/rafaelinacio)\
**Post date:** [May 9, 2022, 8:28pm UTC](https://forum.rasa.com/t/rasa-chatbot-on-instagram/51762/8 "2022-05-09T20:28:30Z")

</div>

Is it necessary to use different apps

---

<div class="post-metadata">

**Author:** ![hanifabd](https://avatars.discourse-cdn.com/v4/letter/h/f14d63/32.png) [@hanifabd](https://forum.rasa.com/u/hanifabd)\
**Post date:** [June 15, 2022, 6:37am UTC](https://forum.rasa.com/t/rasa-chatbot-on-instagram/51762/12 "2022-06-15T06:37:01Z")

</div>

Hi! @rafaelinacio do you have or know any complete tutorial video for this topic?

---

<div class="post-metadata">

**Author:** ![fernandalorena](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/fernandalorena/32/20735_2.png) [@fernandalorena](https://forum.rasa.com/u/fernandalorena)\
**Post date:** [July 11, 2022, 9:39pm UTC](https://forum.rasa.com/t/rasa-chatbot-on-instagram/51762/13 "2022-07-11T21:39:33Z")

</div>

Hi @rafaelinacio am having troublefollowing the tutorial, and i think problem can be in three steps am not sure about.

1. you use the command `rasa run` to start the project?
2. It is necessary to have another account as tester for it to work?
3. are all the steps follow on the messenger → instagram section on dashboard?

i’d really appreciate your reply 🙂

---

<div class="post-metadata">

**Author:** ![Candia](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Candia](https://forum.rasa.com/u/Candia)\
**Post date:** [November 23, 2022, 9:52pm UTC](https://forum.rasa.com/t/rasa-chatbot-on-instagram/51762/14 "2022-11-23T21:52:43Z")

</div>

I have a problem with the buttons . do not appear 🥲

---

<div class="post-metadata">

**Author:** ![eathen](https://avatars.discourse-cdn.com/v4/letter/e/b487fb/32.png) [@eathen](https://forum.rasa.com/u/eathen)\
**Post date:** [August 27, 2024, 7:23pm UTC](https://forum.rasa.com/t/rasa-chatbot-on-instagram/51762/16 "2024-08-27T19:23:27Z")

</div>

Hello peoples I’m new student here, I have build a site with react for save your [Instagram Highlight](https://instastorysave.com/) and reels for free. Will Anyone rate my work please?
