Home cryptocurrency How to get tweets by crypto influencers in a telegram group

How to get tweets by crypto influencers in a telegram group

by satcit

This algorithm is designed as a Node Red implementation suitable for a server or a PC running 24*7. if you can’t run Node Red 24*7, you are free to join this telegram group where I have already implemented the algorithm.

Below is a flowchart summarizing this project:

Untitled Diagram.drawio (2)

In the above flow chart, I have defined crypto influencers on twitter as accounts with 10k or more followers. However, 10k is just an arbitrary number. You can change it to any number you like.

Let’s start.

First of all, import the below code as a new flow on your Node Red.

[{"id":"22de1ecba563aa42","type":"twitter in","z":"81e125e.d8dc5d8","twitter":"","tags":"#Crypto","user":"false","name":"","inputs":0,"x":370,"y":140,"wires":[["60737d54d2787ff6"]]},{"id":"60737d54d2787ff6","type":"change","z":"81e125e.d8dc5d8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"tweet","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":200,"wires":[["837e9a6269549947"]]},{"id":"837e9a6269549947","type":"switch","z":"81e125e.d8dc5d8","name":"","property":"payload.user.followers_count","propertyType":"msg","rules":[{"t":"gt","v":"10000","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":960,"y":240,"wires":[["7a5407faa63ee5d5"]]},{"id":"7a5407faa63ee5d5","type":"change","z":"81e125e.d8dc5d8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.text","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":380,"wires":[["83de7137649bf20b"]]},{"id":"83de7137649bf20b","type":"function","z":"81e125e.d8dc5d8","name":"Unnamed function","func":"msg.payload= {\n    chatId: 'YOUR_CHAT_ID_HERE',\n    type: 'message',\n    content: msg.payload\n   \n}\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620,"y":560,"wires":[["48a2b892.3b2908"]]},{"id":"48a2b892.3b2908","type":"telegram sender","z":"81e125e.d8dc5d8","name":"","bot":"","haserroroutput":false,"outputs":1,"x":900,"y":560,"wires":[[]]}]

After importing, the flow will look like this

Screenshot from 2021-11-17 15-47-49

Also, create a new telegram group for our purpose.Then go to botfather bot on telegram and create a new telegram bot. Don’t forget to activate the bot at the end of the process by clicking ‘start’. Add your telegram bot to the previously created telegram group.

After this, go back to your Node Red flow and do the following steps.

In the ‘Unnamed Function’ node before the telegram node, instead of ‘CHAT_ID_HERE’ enter the chat ID of your telegram group.In the telegram sender node, add the bot token of your telegram bot.

In the ‘telegram sender’ node, enter the API token of you telegram bot that you got from botfather.

Go to https://developer.twitter.com and create a new application. From the ‘Keys and tokens’ section, copy the Consumer API keys. Create a new ‘Access token & access token secret’ and copy them. Enter these to the twitter credentials in the ‘twitter in’ node on Node Red.

The algorithm should start working as soon as you enter these values. And the messages in the telegram group will look like this.

photo_2021-11-17_15-56-31

Leave a Comment