How to get a push notification when a specific user tweets specific text?

How to get a push notification when a specific user tweets specific text?

In terms of potential approaches, here’s a couple of broad ones:

Do it by Shell Script

You could start with a *nix based OS, a script like this (modified to the v2 Twitter API) to get the last tweet for a user, grep for the desired text, and then use something like Pushover to trigger the notification, or go via a call out to Puschcut. You would need to schedule this to run at a frequency that is shorter than the frequency of the user’s consecutive tweets.

Do it by an Internet Enabled Integration Service

You could probably use online web services such as Integromat or Zapier to do periodic Twitter searches and then parse the results to look for the specified text and the user being the posting user. Similarly you could do something along the same lines with Node-RED using the Twitter library.

There may be some expense, general technical challenges, Twitter API call limits, etc. to deal with as well, but hopefully this gives you a starting point.

The nearest I come to doing anything like this is just to get Pushcut notifications from IFTTT on mentions, a saved Twitter search I show in my Twitter client columns for specific text found posted by anyone, and Pushover notifications for tweets from specific individuals that I run during particular business events (conferences, etc.). I have not seen any ready-made services that would provide the level of granularity, but above is just some thoughts on how I might roll my own should I not find the perfect fit otherwise.

1 Like

Got a prototype working using a modification of that script (still using the v1 API) and Pushover (a service I already use a lot) in less than 40 lines of script code :smiley:

And since the script was so small (but hard to read) I tried a Node.js variant using Twitter for Node.js and pushover-notifications.

Took me about the same number of lines, but better readable for me.

Bonus: without hardcoded credentials (using dotenv), so I can put the code on GitHub (still in a private repository).

It’s now running on an always-on Raspberry Pi, every 5 minutes, using a crontab job.

I need this notification exactly once. Let’s see whether I get it…

It worked (on the one occasion it should)!

Thanks for the inspiration!

Happy Christmas and enjoy the Holidays!