All Integrations

Twitter | Tweet & Delete Tweets

Alerts & Notifications
Other
Author
Adam Bavosa
Last Updated
2016-11-01
Twitter | Tweet & Delete Tweets

Walkthrough

Create a Twitter application on https://apps.twitter.com/, grant it access to a Twitter account, and give it Read and Write permission. Next, go to the Twitter application's Keys and Access Tokens page to retrieve the access token, key, and secrets. Enter them into a PubNub Twitter block event handler; they are declared near the top.

type: embedded-entry-inline id: 173dVNmUz0otHoWXrKCsvr

To post a Tweet, publish a PubNub message to the block's channel like this:

type: embedded-entry-inline id: 2oQTxe55jIzBN3d3kqWqkD

To delete a Tweet, publish a message like this:

type: embedded-entry-inline id: 5VInX3kBVnGaVMGOYW5xxL

A Tweet's specific ID number is exposed in the response from Twitter's REST API when you post or delete a Tweet. The ID is stored in the response body's id_str property.

Input

Publish message containing the Tweet body to input channel. Input Channel: twitter-input

The Twitter block allows you to access Twitter's REST API through PubNub. You can Tweet, delete Tweets, and more from an authorized Twitter account by publishing a PubNub message. This can power apps like Twitter bots or a Delight Engine connection for a PubNub Open Growth instance.