paint-brush
Build Chatbot for Twitter Direct Messageby@b.sandesh
3,927 reads
3,927 reads

Build Chatbot for Twitter Direct Message

by Sandesh B SuvarnaSeptember 22nd, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

<a href="https://developer.twitter.com/en/apply-for-access" target="_blank">https://developer.twitter.com/en/apply-for-access</a><br>Note: Review &amp; approval usually takes 10–15 days.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Build Chatbot for Twitter Direct Message
Sandesh B Suvarna HackerNoon profile picture

Step 1: Get Developer account


https://developer.twitter.com/en/apply-for-accessNote: Review & approval usually takes 10–15 days.

Step 2: Create Twitter App & Dev Environment

https://developer.twitter.com/en/account/get-started

Step 3: Generate app access token for the direct message using twitter developer portal

Note: Change the app permissions to “Read, write, and direct messages” & generate the access token.

Step 4: Create the Node module & run it.

Run command: node app.js

OR

Use Open Source Developer friendly Twitter Connector.


iconicbot/iconic-narada_Open Source Webhook Boilerplate for Social Media/Messaging Platforms(Facebook, Facebook Messenger, Twitter, Twitter…_github.com

Top 3 Most Popular Bot Design Articles:

1. Designing Chatbot Conversations

2. Distributing a slack app

3. ChatBots — The Rise of Conversational UI

4. AI & NLP Workshop

Step 5: Tunnel to your localhost webhook using Ngrok


run the following command on the same directory using terminal/command prompt: ngrok http 1337Copy the “https” url. (It will be something like https://XXXXXX.ngrok.io)

Step 6: Download account activity dashboard


Git clone https://github.com/twitterdev/account-activity-dashboard.gitrun the module using “npm start” using the terminal/command prompt

Step 7: Attach Webhook



open “localhost:5000” on the browser.Click on “Manage Webhook”Paste the “ngrok url” into “Create or Update Webhook” field & click submit

Step 8: Add a user/page subscription




Open terminal/Command promptGoto “account activity dashboard” folderexecute “node example_scripts/subscription_management/add-subscription-app-owner.js -e <TWITTER_DEV_ENV_NAME>”note: Add user subscription for the user that owns the app.

Goto Twitter DM & start talking to your bot

Thanks for reading! :) If you enjoyed this article, hit that heart button below ❤ Would mean a lot to me and it helps other people see the story.


Say Hello OnInstagram | Twitter | FacebookLinkedIN