Home > Software engineering >  Twitter API get webhooks for my account [PHP]
Twitter API get webhooks for my account [PHP]

Time:11-16

Do you know if it is possible to set up webhooks when there is activity on MY twitter account with API ?

For example :

  • notification when I receive a like on my tweet
  • notification when I receive a new subscriber on my account.

Etc ...

Thank you.

CodePudding user response:

Yes. Once you have created a webhook, and subscribe to the webhook using your own account, you will receive the follow and reply events. Per the Account Activity API documentation, I've highlighted the two relevant bullet points:

You will receive all related activities below for each user subscription on your webhook registration:

  • Activity types Tweets (by user)
  • Tweet deletes (by user) @mentions (of user)
  • Replies (to or from user)
  • Retweets (by user or of user)
  • Quote Tweets (by user or of user)
  • Retweets of Quoted Tweets (by user or of user)
  • Likes (by user or of user)
  • Follows (by user or of user)
  • Unfollows (by user)
  • Blocks (by user)
  • Unblocks (by user)
  • Mutes (by user)
  • Unmutes (by user)
  • Direct Messages sent (by user)
  • Direct Messages received (by user)
  • Typing indicators (to user)
  • Read receipts (to user)
  • Subscription revokes (by user)

Note that you have to manually subscribe your own account to your own registered webhook using the API - this does not happen automatically. You also need to handle each received API event (the webhook will receive all types of event).

  • Related