All Projects → yjose → Twitter Bot

yjose / Twitter Bot

Licence: mit
Node js twitter bot to send auto welcome message for your new followers

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Twitter Bot

Twitter Api Php
The simplest PHP Wrapper for Twitter API v1.1 calls
Stars: ✭ 1,808 (+882.61%)
Mutual labels:  twitter-api, twitter
Tweetview
This project is an example Android Twitter feed reader app from the Codehenge Android development tutorials.
Stars: ✭ 75 (-59.24%)
Mutual labels:  twitter-api, twitter
Likelo
Twitter auto like bot, Under Development👷, Pre Alpha
Stars: ✭ 64 (-65.22%)
Mutual labels:  twitter-api, twitter
Tweepy
Twitter for Python!
Stars: ✭ 8,293 (+4407.07%)
Mutual labels:  twitter-api, twitter
Twitter Python Ads Sdk
A Twitter supported and maintained Ads API SDK for Python.
Stars: ✭ 114 (-38.04%)
Mutual labels:  twitter-api, twitter
Talon For Twitter Android
The most powerful and beautiful Twitter client available.
Stars: ✭ 1,022 (+455.43%)
Mutual labels:  twitter-api, twitter
21 Recipes
📕 An R/rtweet edition of Matthew A. Russell's Python Twitter Recipes Book
Stars: ✭ 69 (-62.5%)
Mutual labels:  twitter-api, twitter
Remote Dev Jobs Streamer
Match Tweets containing remote developer jobs using Filtered Stream and Tweet Annotations
Stars: ✭ 24 (-86.96%)
Mutual labels:  twitter-api, twitter
Awesome Twitter Tools
A curated list of awesome twitter tools
Stars: ✭ 113 (-38.59%)
Mutual labels:  twitter-api, twitter
Twitterbot
Several PHP scripts for making Twitter bots that retweet certain terms, or post from a data source (rss, database, markov body, picture folder).
Stars: ✭ 106 (-42.39%)
Mutual labels:  twitter-api, twitter
Rtweet Workshop
Slides and code for the rtweet workshop
Stars: ✭ 41 (-77.72%)
Mutual labels:  twitter-api, twitter
Twitwork
Monitor twitter stream
Stars: ✭ 133 (-27.72%)
Mutual labels:  twitter-api, twitter
Node Twitter Api
Twitter API 1.1 client for NodeJS
Stars: ✭ 29 (-84.24%)
Mutual labels:  twitter-api, twitter
Twitter.jl
Julia package to access Twitter API
Stars: ✭ 58 (-68.48%)
Mutual labels:  twitter-api, twitter
Searchtwitter
Android app, which allows to search tweets as user types and scroll them infinitely
Stars: ✭ 14 (-92.39%)
Mutual labels:  twitter-api, twitter
Autohook
Automatically setup and serve webhooks for the Twitter Account Activity API
Stars: ✭ 67 (-63.59%)
Mutual labels:  twitter-api, twitter
Um Twitteremojianalysis
Twitter Emoji Analysis
Stars: ✭ 6 (-96.74%)
Mutual labels:  twitter-api, twitter
Twitter Post Fetcher
Fetch your twitter posts without using the new Twitter 1.1 API. Pure JavaScript! By Jason Mayes
Stars: ✭ 886 (+381.52%)
Mutual labels:  twitter-api, twitter
Tia
Your Advanced Twitter stalking tool
Stars: ✭ 98 (-46.74%)
Mutual labels:  twitter-api, twitter
Twurl
OAuth-enabled curl for the Twitter API
Stars: ✭ 1,648 (+795.65%)
Mutual labels:  twitter-api, twitter

⚠️ Twitter deleted the Stream API in favor of a new Activities API,

This Package is not working any More.

Create your own auto direct message Twitter Bot 💬💬

Create a welcome message for your new followers in twitter is the first step to get more people engage with your tweets and links, As you know there is a lot of online services that help you send auto direct message to your new followers but I think it’s crazy how online services charge between $5 to $15 for a simple tool that creates bots when you can build your own.

In this article, I will introduce my own Twitter bot that I built to send a welcome message to my new followers on Twitter and how it works for me very fine for 6 months.

By the end of this article, you can build your own twitter auto DM for free !! from creating your message to deploy the bot.

What do you need?

To develop this bot we need:

If you are not familiar with Nodejs. or maybe you are not a programmer, you can fork the project from GitHub and use it as your own.

Let’s get started.


Create your Own Twitter Bot 🛠🛠

Step 1: Github.

  • Show you support by a simple star

  • Fork the project repo in Github

  • Now, Customize your welcome message by updating the GenerateMessagefunction and Commit your change.

Step 2 : Twitter

Create a Twitter app: Go to https://apps.twitter.com/ and click to the button Create New App, then complete all the fields as the following:

Go to the Permissions section and give the app the access to send Direct messages by checking the option “Read, Write and Access direct messages”.

Go to tab key and Access Tokens then click the Generate Access Token button at the bottom of the page.

Now copy all your keys Consumer Key, Consumer Secret , Acess TokenA and Acess Token Secret, because we need to add all of them later as Heroku vars.

Step 3: Heroku

  • Create a Heroku account. it is free!
  • Connect to your Heroku account and create a new app by clicking the Newbutton, then the Create new App option.
  • Choose your app name then click Create App

Choose Github as the Deployment method then click the connect button

Tab your bot repo name : twitter-bot in your case.

Now you need to add all keys as Heroku vars on the tab settings and config the Variables section.

Return to the deploy section and click “enable automatic deploys”, then “deploy branch” button to deploy your app for the first time.

Go to resources section and activate the worker Dyno and disable the web dyno.

To know if your app has been started successfully click to the more button at the top right of the page then click view logs option. you will found a simple console with some output similar to this screenshot, I have some new followers and the message has been sent successfully 🤓🤓.


Live Demo

To make sure that’s the hole project work perfectly you need just to follow me and my twitter bot will send you a welcome message 🤗🤗.


How it works 💡

If you have already cloned the project to your computer you will see this structure:

$ cd twitter-bot  
$ tree .     
.  
├── config.js  
├── index.js  
├── LICENSE  
├── package.json  
├── Procfile  
├── README.md  
└── src  
    ├── AutoDM.js  
    └── Twit.js

As you can see the project is a simple node js app with an index.js file as an entry point:

infex.js file

The index file is a simple script that imports and calls the AutoDM function.

To make the app more fun we added a simple message when the app has started successfully.

As I have already mentioned I use the twit package to connect to the Twitter API, to do that we need to create a simple twitter app and init the Twit instance with your App config like the following:

Twit.js file

config.js file

process.env.XXXXXXX is an environment variable that we need to add to our Heroku app in deployment step.

Now the fun part is to Create the AutoDM function :

As you can see the AutoDM is a simple arrow function that listens to the stream follow event from the twitter API and executes the SendMessage function.

AutoDM.js file

The sendMessge function gets as a parameter the user who follows you. All we need here is to create an obj with screen_name and a text message and send a post request to the Twitter API for sending a Direct Message to @screen_nameas the following.

SendMessge Function

Now is you your turn to think how you would like to introduce yourself. You can modify the existing GenerateMessage Function to create your own welcome message, don’t forget to add some human behaviour in there, it makes more chance that the user clicks to your link or respond to your message.

GenerateMessge Function

It is easy, doesn’t it? you can read more code from the Github repo.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].