Chapter 21. Connect to Twitter
To connect to Twitter in an integration, the main steps are:
You need a Twitter developer account to authorize access from your Fuse Online environment to Twitter. If you do not already have a Twitter developer account, go to https://apps.twitter.com, sign in to Twitter, and click Apply for a developer account. Obtaining the developer account is quick when you provide a professional email address, such as
email@example.com rather than a personal address such as
21.1. Register Fuse Online as a Twitter client application
In an integration, to connect to Twitter, the first thing you must do is register your Fuse Online environment as a client application that can access Twitter. This lets you create any number of integrations that connect to Twitter. In other words, you need to register a particular Fuse Online environment with Twitter only once.
In each Fuse Online environment, there can be only one registration of Fuse Online as a Twitter client application. However, while each Twitter connection uses the same registration, it can use different user credentials.
You are logged in to Fuse Online. The URL for accessing Fuse Online is in the email message that welcomed you to the Red Hat Fuse Online Evaluation program.
In Fuse Online:
- In the left panel, click Settings.
- On the Settings page, near the top, to the right of the callback URL, click to copy the callback URL for your installation of Fuse Online to the clipboard. You will need this URL later in this procedure.
- To the right of the Twitter entry, click Register to display the Consumer Key and Consumer Secret fields.
In another browser tab, go to your Twitter developer account, sign in if you need to, and do the following:
- In the upper right, next to the name of your developer project, click the down caret and click Apps.
- In the upper right, click Create an app.
- In the App name field, enter a name such as My Fuse Online Client.
- In the Application description field, enter a tip such as For leveraging tweets.
In the Website URL field, paste the URL that you copied at the beginning of this procedure and remove
api/v1/credentials/callbackfrom the end of the URL.
- Select Enable Sign in with Twitter.
In the Callback URLs field, paste the URL again. It should be something like this:
A 100-character description of how you plan to use this app is required. For convenience, you can copy and paste:
This is a demo application so that I can evaluate how to integrate Twitter with my enterprise applications.
- Click Create.
- Click Create again to confirm that you reviewed the developer terms.
- At the top of the page for the app you just created, click the Keys and tokens tab.
- Copy the API key.
- Return to your Fuse Online Settings page and paste the Twitter consumer API key into the Fuse Online Twitter Consumer Key field.
- Return to the Twitter Keys and tokens tab and copy the consumer API secret key.
- Return to your Fuse Online Settings page and paste the Twitter consumer API secret key into the Fuse Online Twitter Consumer Secret field.
- Click Save and then click Ok.
21.2. Create a Twitter connection
To create an integration that obtains data from Twitter, you must first create a Twitter connection. After you create a Twitter connection, you can use it in any number of integrations.
- You are logged in to Fuse Online. The URL for accessing Fuse Online is in the email message that welcomed you to the Red Hat Fuse Online Evaluation program.
- Fuse Online is open in a web browser.
- You registered your Fuse Online environment as an application that can access Twitter.
- In Fuse Online, in the left panel, click Connections to display any available connections.
- In the upper right, click Create Connection to display the available connectors. A connector is a template that you use to create one or more connections.
- Click the Twitter connector.
- Click Connect Twitter to display a Twitter authorization page. You might need to log in to Twitter before you see the authorization page.
- Click Authorize app to return to Fuse Online.
In the Connection Name field, enter your choice of a name that helps you distinguish this connection from any other connections. For example, enter
Twitter Connect 1.
In the Description field, optionally enter any information that is helpful to know about this connection. For example, enter
Sample Twitter connection that uses my Twitter login credentials.
- In the upper right, click Create to see that the connection you created is now available. If you entered the example name, you would see that Twitter Connect 1 appears as a connection that you can choose to add to an integration.
21.3. Add a Twitter connection to an integration
In an integration, a connection to Twitter can trigger execution of an integration when a tweet contains your Twitter handle or when a tweet contains text that you have specified. A connection to Twitter must be the integration’s start connection.
- You created a Twitter connection.
- You must be creating or editing an integration and Fuse Online is prompting you to choose the start connection.
- On the page that displays available connections, click the Twitter connection that you want to add to the integration. When the integration uses the selected connection to connect to Twitter, Fuse Online uses the credentials defined in that connection.
Click the action that you want the selected connection to perform. A Twitter connection that you add to an integration performs only the action you choose.
- Mention triggers execution of the integration when a tweet contains your handle.
- Search triggers execution of the integration when a tweet contains text that you specify.
- Optionally, enter the configuration information that Fuse Online prompts for. For example, the Search action prompts you to specify how often to search and keywords to search for.
- Click Done to add the connection to the integration.
The connection appears in the integration flow as the start connection.