![]() ![]() Perhaps you are not convinced by the file structure of the project or why we can’t just use a simple file to do all this stuff. It is easy, isn’t it? You can read more code from the Github repo. Don’t forget to add some pleasantries in there - those increase the chance that the user clicks your link, or responds to your message. You can modify the existing GenerateMessage function to create your own welcome message. Now, think about how you would like to introduce yourself. We then send a post request to the Twitter API to send a DM to per the following: SendMessge Function We need to create an obj with screen_name and a text message. The sendMessge function gets, as a parameter, the user who follows you ( screen_name). It listens to the stream follow event from the twitter API, and executes the SendMessage function. Now the fun part is to Create the AutoDM function:Īs you can see below, the AutoDM is a simple arrow function. is an environment variable that we need to add to our Heroku app in the deployment step. 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 To make the app more fun, I added a simple message that shows when the app has started successfully.Īs I have already mentioned, I use the Twit package to connect to the Twitter API. The index file is a simple script that imports and calls the AutoDM function. ├── config.js├── index.js├── LICENSE├── package.json├── Procfile├── README.md└── src ├── AutoDM.js └── Twit.jsĪs you can see, the project is a simple Node.js app with an index.js file as an entry point: infex.js file If you have already cloned the project to your computer, you will see this structure: $ cd twitter-bot$ tree. 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. Twit : Twitter API Client for node (REST & Streaming API).The second section is the step-by-step tutorial that tells you how to deploy and use the bot without even needing to know Node.js. In the first section, I describe step-by-step how the script works and how you can easily contribute with other Twitter bot services. I’ll also show you how it has worked very well for me for six months.īy the end of this article, you’ll be able to build your own Twitter auto DM, from creating your message to deploying the bot, all for free! In this article, I will introduce my own Twitter bot that I built to send a welcome message to my new followers on Twitter. ![]() 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 for free. As you might know, there are many online services that help you send auto direct messages (DMs) to your new followers. By Youssouf El Azizi How to create your own auto direct message Twitter bot for free ? Create your own auto direct message Twitter BotĬreating a welcome message for your new followers in Twitter is the first step to getting more people to engage with your tweets and links. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |