Rasa chatbot on Instagram

Rasa chatbot on Instagram

Vídeo

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 and an app 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:

    File:

    custom_instagram.py

Untitled

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

Untitled

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 and click on My AppsAdd 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 SettingsBasic. 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.

    Insert the Verify Token which has to match the verify entry in your credentials.yml.

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

Untitled

  • Now just access Instagram, and follow the page.

Untitled

  • Then let’s talk to the profile.

Untitled

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

Reference

6 Likes

Wow, thanks a lot for sharing! :star_struck:

1 Like

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

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.

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

verify instagram

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?

Is it necessary to use different apps

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

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 :slight_smile:

I have a problem with the buttons . do not appear :smiling_face_with_tear:

Hello peoples I’m new student here, I have build a site with react for save your Instagram Highlight and reels for free. Will Anyone rate my work please?