Get started with the Twitter connector
With the Twitter connector you can:
- Post tweets and get tweets
- Access timelines, friends, and followers
- Perform any of the other actions and triggers described in this article
Connect to Twitter
Before your logic app can access any service, you first need to create a connection to the service. A connection provides connectivity between a logic app and another service.
Create a connection to Twitter
- A Twitter account
Before you can use your Twitter account in a logic app, you must authorize the logic app to connect to your Twitter account. Fortunately, you can do this easily from within your logic app on the Azure Portal.
Here are the steps to authorize your logic app to connect to your Twitter account:
- To create a connection to Twitter, in the logic app designer, select Show Microsoft managed APIs in the drop down list then enter Twitter in the search box. Select the trigger or action you'll like to use:
- If you haven't created any connections to Twitter before, you'll get prompted to provide your Twitter credentials. These credentials will be used to authorize your logic app to connect to, and access your Twitter account's data:
- Provide your Twitter user name and password to authorize your logic app:
- Confirm your authorization:
- Notice the connection has been created and you are now free to proceed with the other steps in your logic app:
Use a Twitter trigger
A trigger is an event that can be used to start the workflow defined in a logic app. Learn more about triggers.
In this example, you use the When a new tweet is posted trigger to search for #Seattle. And if #Seattle is found, update a file in Dropbox with the text from the tweet. In an enterprise example, you could search for the name of your company and update a SQL database with the text from the tweet.
- Enter twitter in the search box on the logic apps designer then select the Twitter - When a new tweet is posted trigger
- Enter #Seattle in the Search Text control
At this point, your logic app has been configured with a trigger that will begin a run of the other triggers and actions in the workflow.
For a logic app to be functional, it must contain at least one trigger and one action. Use the steps in the next section to add an action.
Add a condition
We are only interested in tweets from users with more than 50 users. So, a condition that confirms the number of followers is added to the logic app first.
- Select + New step to add the action you would like to take when #Seattle is found in a new tweet
- Select the Add a condition link.
This opens the Condition control where you can check conditions such as is equal to, is less than, is greater than, contains, etc.
- Select the Choose a value control. In this control, you can select one or more of the properties from any previous actions or triggers. The condition of this property value is evaluated to true or false.
- Select the ... to expand the list of properties so you can see all the properties that are available.
- Select the Followers count property.
- Notice the Followers count property is now in the value control.
- Select is greater than from the operators list.
- Enter 50 as the operand for the is greater than operator.
The condition is now added. Save your work using the Save link on the menu.
Use a Twitter action
An action is an operation carried out by the workflow defined in a logic app. Learn more about actions.
Now that there's a trigger, add an action that posts a new tweet with the contents of the tweets found by the trigger. For this walk-through, only tweets from users with more than 50 followers are posted.
In the next step, add a Twitter action that posts a tweet using some of the properties of each tweet that is posted by a user with more than 50 followers.
- Select Add an action. This step opens the search control where you can search for other actions and triggers.
- Enter twitter into the search box then select the Twitter - Post a tweet action. This step opens the Post a tweet control where you enter all details for the tweet being posted.
- Select the Tweet text control. All outputs from previous actions and triggers in the logic app are now visible. You can select any of these outputs, and use them as part of the tweet text of the new tweet.
- Select User name
- Immediately after User name, enter says: in the tweet text control.
- Select Tweet text.
- To activate your workflow, save your work, and send a tweet with the #Seattle hashtag.
View any triggers and actions defined in the swagger, and also see any limits in the connector details.