Q100092: [Connections] Twitter
Q100092: [Connections] Twitter
The Twitter Connection
is a definition which tells a module, how to connect to and communicate with a Twitter account. Connections can either be entered directly into the parameter in the module, or can be centrally managed through the global connections tool. If you will be using the same connection in different modules, it is much easier to manage the connection information by creating a global connection. Whether you use a locally defined value in each module, or use the global definitions for your Twitter based modules, the format of the connection value is the same for both.
If you use the global connection manager, you will see that as soon as you create a new entry, it will provide you a template for starting your Twitter Connection
definition. It would look like the example below.
ConsumerKey=<consumerKey>;ConsumerKeySecret=<consumerKeySecret>;AccessToken=<accessToken>;AccessTokenSecret=<accessTokenSecret>;
We see from this, that the connection needs multiple values. These values are generated by applying for them on the Twitter website. Login to the Twitter website and follow the steps below to generate the values that will be unique for your account. Important Note: These steps were accurate as of the last time the Twitter website and developer tools were reviewed. These have changed multiple times in the last few weeks but barring any other major changes, this should be generally help you find all the information you need from the Twitter website.
Setting up API Access for your Twitter account
- To allow access for your account go to https://developer.twitter.com
- Click Sign Up (be careful to keep clciking on the free options if that is your intent).
- Fill out the forms for applying for your use case.
- Twitter may prompt you to verify your email and phone number attached to your account.
Projects and Apps
- Once your account is granted access to the developer portal, it will create a sample project and app for you.
- Navigate to the developer portal, go to https://developer.twitter.com/en/portal/
- Click Projects & Apps, then Overview and you should see your sample project.
- Click on the
project
you created (was created for you). - Scroll down to the
Apps
section and click thegear icon
next to the app name to openApp Settings
. - Locate the section titled
User Authentication Settings
. - You should notice that it says
User authentication not set up
, and then click theSet up
button located next to that. - Locate the section
App Permissions
and change theRead
option to,Read and write and Direct message
. - Locate the section
Type of App
and select the optionWeb App, Automated App or Bot
. - Once you save these settings, it will generate your OAuth 2.0 Client ID and Client Secret. Be certain to save that information in a secure location for future reference.
Generate API Keys / Consumer Keys
- The Twitter documentation inconsistently refers to the API Keys and Consumer Keys. When you see this terminology, they are the same set of values.
- On the developer portal, under
Projects & Apps
click on your app. - Locate and click on the
Keys and tokens
tab. - The first section should be named
Consumer Keys
. You should see a generate (or regenerate) button to click and create this set of keys. Only regenerate the keys if the previous set has been lost or compromised. - Once you generate the keys, record copies of the values for both your
API Key
and yourAPI Key Secret
. - Again, these are also known as and may also be labeled as
Consumer Key
andConsumer Key Secret
.
Set up Access Token
- On the developer portal, under
Projects & Apps
click on your app. - Locate and click on the
Keys and tokens
tab. - Location the section
Authentication Tokens
and look for the line forAccess Token and Secret
. - You should see a generate (or regenerate) button to click and create this set of keys. Only regenerate the keys if the previous set has been lost or compromised.
- Once you generate the keys, record copies of the values for both your
Access Token
andAccess Token Secret
.
Once you have progressed through these steps, then you will fill in the values of the Twitter Connection template and it should look something like the following example. Of course, please note that the following example is not a valid connection and will not work.
ConsumerKey=abcDEFghiJKLmnoPQRstuVWXyz;ConsumerKeySecret=abc123def456ghi789jkl000ABC;AccessToken=1234567890-ABCDEFGHIJKLMNOP;AccessTokenSecret=abcDEFghiJKLmnoPQRstuVWXyz0123;
Legacy Twitter API v1.1
At the current time of this writing, the Twitter API is going through a transition from its older v1.1 API, to a newer API version. The information below is for older versions who have a module which uses the Twitter v1.1 API.
Existing Twitter accounts still with v1.1 API access.
- Since complete v1.1 API access is apparently not granted, you must have already previously setup your developer account https://developer.twitter.com
- Click Sign Up and verify your email address and phone number.
- Enter an app name and complete the app creation process
Apply for elevated access
- To apply for elevated access for your app name, go to https://developer.twitter.com/en/portal/
- Click Projects & Apps
- Click the project you created
- Click Apply for elevated access
- Fill out all appropriate info for what your account will do (Tweet access is required)
Set up app permissions
- To set up app permissions, go to https://developer.twitter.com/en/portal/
- Click Projects & Apps
- Click the app you created
- Under User authentication settings click Set up
- Select OAuth 1.0a
- CLick Read and write under app permissions
- Enter info below and click Save
Set up Consumer Keys
- To get consumer keys, go to https://developer.twitter.com/en/portal/dashboard
- Under Projects & Apps click your app
- Click on Keys and tokens
- In Consumer Keys...API Key and Secret click Regenerate
- Record copies of the values for both your
API Key
and yourAPI Key Secret
. May also be labeled asConsumer Key
andConsumer Key Secret
.
Set up Access Token
- To get an Access Token, go to https://developer.twitter.com/en/portal/
- Under Projects & Apps click your app
- Click on Keys and tokens
- In Authentication Tokens....Access Token and Secret click Generate
- Record copies of the values for both your
Access Token
andAccess Token Secret
.