Twitter

Dialogflow Twitter Integration allows you to easily create Twitter bots with natural language understanding based on the Dialogflow technology.

Set up Twitter

In order to set up the Twitter integration for your agent, you'll need the following:

Create an app in Twitter

  1. Log in to your Twitter account and navigate to the Twitter App Management Console.
  2. Click the Create New App button.
  3. Enter the following information:

    • Bot Name
    • Description
    • Website - Can be a placeholder link
    • Callback URL - Not needed at this point
  4. Check the box under Developer Agreement and click the Create your Twitter application button.

Obtain keys and tokens

  1. Click on the Keys and Access Tokens tab.

  2. Under Token Actions, click the Create my access token button.

  3. Make note of the following information:

    • Consumer Key (API Key)
    • Consumer Secret (API Secret)
  4. Click the Create my access token button.

  5. Make note of the following information:

    • Access Token
    • Access Token Secret

Modify app permissions

  1. On the Keys and Access Tokens tab, click modify app permissions for Access Level.

  2. Under Access, select the Read, Write and Access direct messages option.

  3. Click the Update Settings button.

Create a Twitter dev environment

Dialogflow needs a dev environment to refer to for your Twitter app.

Create your dev environment by following the instructions in Twitter's developer console.

Set up Dialogflow

  1. In Dialogflow, go to Integrations in the left hand menu.
  2. Click on the Twitter tile.
  3. Enter the related info into the following fields:

    • Bot Username - Must be the name of the Twitter bot, without "@"
    • Consumer Key
    • Consumer Secret
    • Access Token
    • Access Token Secret
    • Dev environment label - Must match the dev environment set up in Twitter.
    • Environment - Dialogflow environment.
  4. Click the Start button.

Test

To test your bot, send a Tweet or DM to the account the app is under.

Twitter API migration

If you have an existing Twitter app, the following instructions walk you through migrating from the streams API to the beta webhook API.

  1. Apply for a Twitter developer account. Make sure to complete all of the steps for the application.

  2. Log in and navigate to the Dev Environments page.

  3. Click Set up dev environment.

  4. Name your environment and enter your Twitter app ID.

  5. Restart your Twitter bot in Dialogflow by doing the following:

    1. Go to the Twitter integration page.
    2. Click the STOP button.
    3. Click the START button.