afxjzs
afxjzs

Reputation: 982

Twitter dev: How do I automatically trigger an action whenever the user tweets w/o polling?

I am working on an app where I need to perform an action whenever I tweet. (just ping a URL or whatever)

Is there a way to do this without polling?

Example:

  1. I(as a user that has authorized my twitter app) posts a tweet.
  2. The app then pings http://example.com/some_webhook

It seems like the twitter app that I created a dev.twitter.com and then authorized on my account should be aware of when that account tweets. is there a trigger or something?

How does IFTTT do this? I have some recipes with them that trigger whenever I tweet. Are they just polling twitter?

The same goes for the facebook connectivity that publishes your tweet to facebook. What hook are they using to accomplish this?

I'm using the twitter gem on a Rails 4.1 application right now, but I'm stuck on this part. Please help. any guidance is very appreciated!

Upvotes: 1

Views: 312

Answers (1)

Gaurav Gupta
Gaurav Gupta

Reputation: 5416

Use the Twitter Streaming API - https://dev.twitter.com/docs/api/streaming or, you can poll every few seconds (be sure to check the API rate limit).

Upvotes: 2

Related Questions