Air Twitter API Lite

Introduction

This plugin is built on Twitter Api V2 version. With this plugin you can seamlessly post and delete tweets, access user details, and even enable Login with Twitter functionality.

Prerequisites

You must have a developer account with Twitter to interact with the plugin. Create your development account at: https://developer.twitter.com/en/dashboard

How to setup

I. How to get Keys

The keys that you need are in your Twitter developer account(https://developer.twitter.com) -> Developer portal -> Projects & Apps tab -> Your app -> Keys and Tokens
The plugin field “ConsumerPublic” and “ConsumerSecret” are Consumer Keys from the dev account.
Same for Access tokens, the access level should be Read, Write, and Direct Messages.
Image without caption
Don't forget to add all URLs from which the authorization window will be called. Including test versions.
To add a redirect URL for authentification go to Twitter developer account (https://developer.twitter.com) -> Developer portal -> Projects & Apps tab -> Your app -> Settings -> User authentication settings -> Edit
Image without caption
Add ALL possible URLs
Image without caption

II. Setting up Keys in Plugin Settings

When you've got your keys from Developer Account, place them in plugin settings fields as shown:
Image without caption

III. Get OAuth tokens

  1. Request new token and authorize user
In the first step, the user should give access to his account, for that on a button click (or other user interaction you want) set the first action to Twitter: Get tokens This action is used in 2 steps, at the first step set the field Auth current step to step_1
For step_1 also set a callback URL encoded at field Step 1: Callback URL
Leave empty other fields, which will be used later in another workflow.
Image without caption
Right after that set the next plugin action, Authorize user.
For the Oauth token field, set the Result of step 1 (Get tokens) Step 1 Oauth token:
Image without caption
2. Generate and save the user’s tokens
These actions will redirect the user to the Twitter authorization page. When the user is redirected back to your application, there are 2 events that should be configured.
  1. The Event when the user is denied access to your application, is called Twitteraccount A User is denied access, and you can do whatever you want to warn the user about it.
Image without caption
2. The user gave access and tokens from the callback are ready to use here on the first action set Twitter:Get tokens (same action from step_1).
But set fields for step_2
Image without caption
Next, save the obtained tokens to the current user. For example:
Image without caption
To refresh tokens, set the same actions from step 1:
Image without caption

Plugin Events List

  • A Twitter account Callback Tokens ready: Event used when account callback token is available
  • A Twitter account User denied access: Event used when the user account is denied access

Plugin Actions List

  • Twitter: Get Tokens
  • Twitter: Post New Tweet
  • Twitter: Delete Tweet
  • Twitter: Get User Details

Plugin Element Proprieties

This plugin has a visual element Twitter account which should be used on the page.
Image without caption
Element Properties: No properties

Element Events

  • Callback Tokens ready: this event is triggered once the tokens from the Twitter: Get tokens action Step 1 is ready and can be used. Use this event to trigger Step 2 of Twitter: Get tokens action.
  • User denied access: this event is triggered if the user is denied access to Twitter.

Element Actions

Authorize user: the action to be called once Step 1 of the Twitter: Get tokens plugin action has finished executing Properties

Element Exposed States

  • Callback OAuth token: Callback OAuth token to be used in Step 2 of Twitter: Get tokens action.
  • Callback OAuth verifier: Callback OAuth verifier to be used in Step 2 of **Twitter: Get tokens **action.

PLUGIN ACTIONS DETAILED

Actions

  1. Get tokens - current authorization step.
    1. Step 1: Callback URL: The value that will be used as the URL a user is redirected to should they approve your application’s access to their account. Is used only if the previous property is set to ‘step_1’.
      Step 2: Callback OAuth token: OAuth token here must be the same as the oauth_token returned in step_1. You can get it from the TwitterAccount element’s ‘Callback OAuth token’ state. Is used only if the previous property is set to ‘step_2’.
      Step 2: Callback OAuth verifier: OAuth verifier returned in the callback URL. You can get it from the TwitterAccount element’s ‘Callback OAuth verifier’ state. Is used only if the previous property is set to ‘step_2’. Fields:
      Title
      Description
      Type
      Auth current step
      step_1 or step_2
      Dropdown
      Step 1: Callback URL
      Insert in this field when running step 1. Url encoded
      string (optional)
      Step 2: Callback Oauth token
      Insert in this field when running step 2
      string (optional)
      Step 2: Callback Oauth verifier
      Insert in this field when running step 2
      string (optional)
      Returned Values:
      Title
      Description
      Type
      error
      URL of the page to open
      string
      Step 1: OAuth token
      OAuth token obtained on this step.
      string
      Step 1: OAuth token secret
      The OAuth token secret is obtained in this step.
      string
      Step 1: OAuth callback confirmed
      ‘yes’ if the OAuth callback was confirmed, or ‘no’ if it was not confirmed.
      yes/no
      Step 2: OAuth token
      OAuth token obtained on step 2.
      string
      Step 2: OAuth token secret
      OAuth token secret obtained in step 2.
      string
      Step 2: User ID
      User ID: ID of the user.
      string
      Step 2: Username
      username (screen name) of the user.
      string
  1. Post a tweet - Updates the authenticating user's current status, also known as Tweeting.
    1. Fields:
      Title
      Description
      Type
      OAuth from Step 2
      OAuth token
      string
      OAuth secret from Step 2
      OAuth secret token
      string
      Text
      Text Tweet. Max 280 characters
      string
      Returned values:
      Title
      Description
      Type
      Tweet ID
      The ID of the newly created tweet.
      string
  1. Delete a tweet - Destroys the status specified by the required ID parameter. The authenticating user must be the author of the specified status.
    1. Fields:
      Title
      Description
      Type
      OAuth from Step 2
      OAuth token
      string
      OAuth secret from Step 2
      OAuth secret token
      string
      Tweet ID
      The ID of the tweet that you want to delete
      string
      Returned values:
      Title
      Description
      Type
      Success
      ‘yes’ in case of success, ‘no’ in case of error.
      yes/no
      Error
      error message in case of an error.
      string
  1. Get user's details - Is used to test if supplied user credentials are valid. Returns a 200 OK response code and a representation of the requesting user if authentication was successful; returns a 401 status code and an error message if not.
    1. Fields:
      Title
      Description
      Type
      OAuth from Step 2
      OAuth token
      string
      Oauth secret from Step 2
      Oauth secret token
      string
      Request user Email (deprecated)
      Your app will need to regenerate the user access tokens for previously authenticated users to access their email addresses. The "Request email addresses from users" checkbox is available under the app permissions on developer.twitter.com
      Checkbox
      Returned values:
      Title
      Description
      Type
      User ID
      The ID of the requesting user
      string
      Name
      name of the requesting user
      string
      Screen Name
      the screen name of the requesting user
      string
      Description
      description for the requesting user
      string
      Url
      URL
      string
      Followers count
      followers count for the requesting user
      number
      Friends count
      friends count for the requesting user
      number
      Listed count
      listed count for the requesting user
      number
      Created date
      the date when the requesting user was created
      date
      Favorites count
      favorites count for the requesting user
      number
      Is verified
      ‘true’ if the requesting user is verified, otherwise ‘false’
      yes/no
      Statuses count
      statuses count for the requesting user
      number
      Last status text
      last status text of the requesting user
      text
      Last status date
      the date of the last status for the requesting user
      data
      Last status id
      The ID of the last status for the requesting user
      text
      Profile image URL
      profile image URL for the requesting user
      text
      Profile banner URL
      profile banner URL for the requesting user
      text
      User email
      requesting user email
      text
      Error
      error message in case of an error
      text

Plugin States

Image without caption

Workflow example

Action Example - Post a new tweet

To post a new tweet use action, Twitter: Post new tweet.
For this and other actions you need OAuth tokens from Step_2, you should have them saved by now, in the current user database.
This action returns the posted tweet ID, you can get it using the Result of step 1: Tweet ID
Image without caption
The same tokens are used for other actions.

Changelogs

Update 17.01.20 - Version: 1.0.0.
  • Initial Realise
Update 5.02.20 - Version: 1.1.0.
  • Updated Description.
Update 22.03.20 - Version: 1.2.0.
  • Added request user’s email feature.
Update 25.07.20 - New Actions - Version: 1.3.0.
  • Twitter: Upload a picture
  • Twitter: Post a tweet with a picture
Update 18.08.20 - New Actions - Version: 1.4.0.
  • Twitter: Upload GIF
  • Twitter: Post with GIF
Update: 13.11.20 - Version: 1.5.0.
  • Added the possibility to post a tweet with a video. Improved tweet with GIF support gifs up to 15Mb.
  • Twitter: Upload Video
  • Twitter: Post with Video
Update: 16.02.21 - Version: 1.6.0.
  • Update icons
Update: 16.04.21 - Version: 1.7.0.
  • Updated Description.
Update: 20.04.21 - Version: 1.8.0.
  • Updated Description.
Update: 13.06.21 - Version: 1.9.0.
  • Added new actions for adding threads
Update: 19.06.21 - Version: 1.10.0.
  • Update icons
Update: 13.10.21 - Version: 1.11.0.
  • Added new actions for getting lists of friends and followers
  • Twitter: Get a list of friends
  • Twitter: Get a list of followers
Update: 06.01.22 - Version: 1.12.0.
  • Added follow/unfollow actions
Image without caption
Update: 30.04.22 - Version: 1.13.0.
  • Added new action to send direct messages
Update: 04.05.22 - Version: 1.14.0.
  • Added a new action to get a list of messages
Update 12.10.22 - Version 1.15.0
  • Fixed "Load timeline" action.
  • Added “Update profile image”, “Update profile data”, “Update banner image” actions, and "previous_page" and "next_page" returned values.
  • Updated "Get a list of friends" and "Get a list of followers" actions.
Update 18.10.22 - Version 1.16.0
  • Minor fixes
Update 17.02.23 - Version 1.17.0
  • Updated the description.
Update 23.02.23 - Version 1.18.0
  • Delete the icons.
Update 01.03.23 - Version 1.19.0
  • Fixed "Twitter: Get user details" action
Update 05.06.23 - Version 1.20.0
  • Migrated the “Post” and “Delete” actions to API v2
Update 19.06.23 - Version 1.21.0
  • Updated the description.
Update 22.06.23 - Version 1.22.0
  • Removed the "AccessTokenPublic" & "AccessTokenSecret" settings.
Update 11.07.23 - Version 1.23.0
  • Updated Description.
Update 05.09.23 - Version 1.25.0
  • Upgrade to node18.
Update 17.10.23 - Version 1.29.0
  • Migration to new version 4 in plugins editor

Demo to preview the settings