Twitter

◷ Reading Time: 7 minutes

This extension allows users to authenticate and post tweets for their own account or on behalf of a different account.

Creating your Twitter Developer Account

The very first step of using the Twitter extension is to create a Twitter developer account. You can either use an existing Twitter account or create a new one.

1. If you already have an account, apply for API access. https://developer.twitter.com/en/apply-for-access.

There will be several questionnaires (such as your purpose etc., please be concise when answering) that need to be accomplished in order for Twitter to grant developer access to your account.

After applying for developer access, Twitter will send a verification link to your registered email to start their review process.

The review process could take some time depending on their availability and how you answered their questionnaires.

Once your account is verified and been granted developer access, you are now able to access the developer portal https://developer.twitter.com/en/portal/dashboard.

2. Take note of your Consumer Keys (API key and API secret key)

This acts as the identifier of your application which will be used by the Twitter extension.

When done, secure and save the API key and API secret key as they will only be displayed once. Though you can just regenerate it anytime you want but they will have different values.

3. Change the App permissions and Authentication settings of your application in order to integrate it with the Twitter Extension.

Change the App permission to Read and Write and enable the 3-legged OAuth. The 3-legged OAuth requires a Callback URL, where Twitter will send the Access Token and Secret, however, the Twitter extension does automate this for your application. You may opt to just provide a dummy URL, (or just your Twitter profile link) but we recommend using your organization’s website for this.

Authentication Tokens

Token and Token Secret are needed to verify the Twitter account to be used for the API call, for example, the account that will post a tweet. There are 2 ways to generate these tokens:

1. Using the Twitter Developer Portal

Using the Twitter developer portal. This is the scenario where the same Twitter and developer account is used for interacting with Twitter.

Go back to your developer portal, under Keys and Tokens generate and save the Token and Token Secret.

2. Using the Extension for Twitter Authentication

This is the scenario where your developer account will act on behalf of a different Twitter user/s. You can also use this to generate the tokens for your own developer account.

Refer to Twitter Command – Authenticate

Sample Result of Authenticate

You may store these tokens and have an identifier to whom it belongs to a database, or anywhere you want.

Toolbox

When the Twitter Extension is installed, the Toolbox will be updated for Workflow models.

Check Twitter Commands for the full list and descriptions.

Best Practice

To avoid suspension of accounts and failed API requests

  1. Follow the media best practice.
  2. Follow the rate limit (for example frequency of tweets).
  3. Follow the automation guidelines.

Tutorial

The following tutorial shows you how to authenticate and post a tweet.

Updated Google Chrome browser is required.

1. Create a Flow

Create a General Flow

2. Create variables for Consumer Key, Consumer Secret, Username, Password, and set the values. Also, create variables for Copy Access Token To and AccessToken.

3. Add Authenticate and provide details.

4. Change the Value Type of Consumer Key, Consumer Secret, Username, Password, Copy Access Token To and AccessToken to Expression.

5. Add Post Tweet and provide details.

6. Change the Value Type of Consumer Key, Consumer Secret, Token and Token Secret to Expression

7. Run or Debug your project.

Once the tweet is posted you will be able to verify it from the Parameter TweetUrl.

URL of the posted Tweet

As explained earlier, it is not recommended to authenticate everytime you post a Tweet. Token and Token secret should be saved after the first Authentication and reuse it for other Twitter actions such as Posting Tweets. Token values will remain the same for each user until they revoke it. Token values do not expire.

Updated on May 11, 2022

Was this article helpful?

Related Articles