共用方式為


X

X, formerly known as Twitter, is an online social networking service that enables users to send and receive short posts. Connect to X to manage your posts. You can perform various actions such as send posts, search, view followers, etc.

This connector is available in the following products and regions:

Service Class Regions
Logic Apps Standard All Logic Apps regions except the following:
     -   Azure China regions
     -   US Department of Defense (DoD)
Power Automate Standard All Power Automate regions except the following:
     -   China Cloud operated by 21Vianet
Power Apps Standard All Power Apps regions except the following:
     -   China Cloud operated by 21Vianet
Contact
Name Microsoft
URL Microsoft LogicApps Support
Microsoft Power Automate Support
Microsoft Power Apps Support
Connector Metadata
Publisher Microsoft
Website https://x.com/
Privacy policy https://x.com/privacy

Authentication and Bring your own application

Important

The default shared application (Twitter Client application maintained by Microsoft) is no longer available. The connector now supports only one authentication type - Bring your own application. As of June 2023, it requires a paid Enterprise tier application. However, Twitter's pricing policy might continue to change.

With "Bring your own application" option, you can use your own Twitter OAuth Client application. This allows you to control permissions and enable certain limitations on the use of the connector.

To use your own Twitter OAuth Client application with the Twitter connector, you'll need to perform the following steps:

  1. Create an OAuth client application using Twitter developer page (https://developer.twitter.com)
  2. Use the application in the Twitter connector

Creating an OAuth Client Application in Twitter

To create your own Twitter OAuth client application, you'll need to first sign in to https://developer.twitter.com. Navigate to the "Projects & Apps" section which is where you can manage and create twitter applications. This process is explained in Twitter's Twitter Developer Guide. After creating twitter app on developer page following steps are required for proper setup:

  • Select your twitter app
  • Edit app permissions to enable read and write.
  • Edit authentication settings
    • Enable 3rd party authentication
    • Add https://global.consent.azure-apim.net/redirect for the callback URLs (NOTE: If you are using Fairfax subscription or GCC environment look at "Fairfax and GCC callbacks" section)
    • Set "Website URL" (required field, but it's value does not affect the flow)

Fairfax and GCC callbacks

If you are using Fairfax subscription or GCC environment add the following URLs for the callback URLs of your Twitter app:

  • For Fairfax:
    • https://logic-apis-usgovvirginia.consent.azure-apihub.us/redirect
    • https://logic-apis-usgovtexas.consent.azure-apihub.us/redirect
    • https://logic-apis-usgovarizona.consent.azure-apihub.us/redirect
  • For GCC:
    • https://power-apis-usgov001-public.consent.azure-apihub.us/redirect

Once you're done, select your twitter app and navigate to the "Keys and tokens" page. In the "Consumer Keys" section, click on "View Keys" button, to get the API key and the API key secret of your app. You can now use those values in your Twitter connection.

Using your own application in the Twitter connector

Once you create the Twitter OAuth client application, you can use it while creating a Twitter connection.

  • Select Bring your own application.
  • Specify the Client ID and Client secret values from your application. (Use the API key and the API key secret of your Twitter app)

Click on Sign in to sign into your Twitter account. This will prompt you to sign in to your Twitter account, and then authorize access to the Twitter app that you created above.

LIMITS

The following are some of the limits and restrictions:

  1. Maximum number of connections per user: 2
  2. API call rate limit for POST operation: 12 per hour
  3. API call rate limit for other operations: 600 per hour
  4. Frequency of trigger polls: 1 hour
  5. Maximum size of image upload: 5 MB
  6. Maximum size of video upload: 15 MB
  7. Maximum number of search results: 100
  8. Maximum number of new tweets tracked within one polling interval: 5
  9. Maximum allowed 'Search text' parameter value length is 470

Restrictions of Twitter API

  1. Search API searches against a sampling of recent Tweets published in the past 7 days
  2. Standard search API is focused on relevance and not completeness. This means that some Tweets and users may be missing from search results

Additional restrictions for POST operation

Mentioning a @user while posting a tweet is not supported. Specifically, the "@" characters will be stripped while posting a tweet.

General Limits

Name Value
Connections per account 2

Creating a connection

The connector supports the following authentication types:

Bring your own application Sign in using your own Twitter app. For more details see 'Authentication and Bring your own application' section on this page. All regions Not shareable
Default [DEPRECATED] This option is only for older connections without an explicit authentication type, and is only provided for backward compatibility. All regions Not shareable

Bring your own application

Auth ID: byoa

Applicable: All regions

Sign in using your own Twitter app. For more details see 'Authentication and Bring your own application' section on this page.

This is not shareable connection. If the power app is shared with another user, another user will be prompted to create new connection explicitly.

Name Type Description Required
Consumer Key string Consumer key of your Twitter application True
Consumer Secret securestring Client secret of your Twitter application True

Default [DEPRECATED]

Applicable: All regions

This option is only for older connections without an explicit authentication type, and is only provided for backward compatibility.

This is not shareable connection. If the power app is shared with another user, another user will be prompted to create new connection explicitly.

Actions

Get followers

This operation gets the list of users that follow a given user.

Get following

The operation gets the list of people the given user follows.

Get home timeline

This operation gets the most recent tweets and re-tweets posted by me and my followers.

Get my followers

This operation gets the list of users who are following me.

Get my following

This operation gets the list of users that I am following.

Get user

This operation gets the profile details for a given user, such as user name, description, followers count, and more.

Get user timeline

This operation gets a list of the most recent tweets posted by a given user.

Post a tweet

This operation posts a new tweet.

Retweet

This operation retweets a tweet.

Search tweets

This operation gets a list of relevant tweets matching the search query.

Get followers

This operation gets the list of users that follow a given user.

Parameters

Name Key Required Type Description
User name
userName True string

X handle for the user.

Maximum results
maxResults integer

Maximum number of users to return.

Returns

Get following

The operation gets the list of people the given user follows.

Parameters

Name Key Required Type Description
User name
userName True string

X handle for the user.

Maximum results
maxResults integer

Maximum number of users to return.

Returns

Get home timeline

This operation gets the most recent tweets and re-tweets posted by me and my followers.

Parameters

Name Key Required Type Description
Maximum results
maxResults integer

Maximum number of tweets to return.

Returns

Get my followers

This operation gets the list of users who are following me.

Parameters

Name Key Required Type Description
Maximum results
maxResults integer

Maximum number of users to get.

Returns

Get my following

This operation gets the list of users that I am following.

Parameters

Name Key Required Type Description
Maximum results
maxResults integer

Maximum number of users to return.

Returns

Get user

This operation gets the profile details for a given user, such as user name, description, followers count, and more.

Parameters

Name Key Required Type Description
User name
userName True string

X handle for the user.

Returns

Represents a user.

Get user timeline

This operation gets a list of the most recent tweets posted by a given user.

Parameters

Name Key Required Type Description
User name
userName True string

X handle for the user.

Maximum results
maxResults integer

Maximum number of tweets to return.

Returns

Post a tweet

This operation posts a new tweet.

Parameters

Name Key Required Type Description
Tweet text
tweetText string

Text to be posted.

Media
body binary

Media to be posted.

Returns

Represents the response of a tweet post.

Retweet

This operation retweets a tweet.

Parameters

Name Key Required Type Description
Tweet id
tweetId True string

Tweet to be retweeted.

Trim user
trimUser boolean

Boolean to indicate whether to trim user information.

Returns

Represents the response of a tweet post.

Search tweets

This operation gets a list of relevant tweets matching the search query.

Parameters

Name Key Required Type Description
Search text
searchQuery True string

Search term like "happy hour", #haiku, from:@username, love OR hate.

Maximum results
maxResults integer

Maximum number of tweets to return.

sinceId
sinceId string

Return tweets after the specified tweet ID.

Returns

Triggers

When a new tweet is posted

This operation triggers a flow when a new tweet that matches a given search query is posted.

When a new tweet is posted

This operation triggers a flow when a new tweet that matches a given search query is posted.

Parameters

Name Key Required Type Description
Search text
searchQuery True string

Search term like "happy hour", #haiku, from:@username, love OR hate.

Returns

Represents a wrapper object for batch trigger response

Definitions

TweetModel

Represents a tweet post.

Name Path Type Description
Tweet text
TweetText string

Text content of the tweet

Tweet id
TweetId string

Id of the tweet

Created at
CreatedAtIso string

Time at which the tweet was posted

Retweet count
RetweetCount integer

Total number of re-tweets for the tweet

Tweeted by
TweetedBy string

Name of the user who has posted the tweet

Media urls
MediaUrls array of string

Url of the media posted along with the tweet

Tweet language
TweetLanguageCode string

Language code of the tweet

in_reply_to_user_id
TweetInReplyToUserId string

User Id of the author of the tweet that the current tweet is a reply to

Favorited
Favorited boolean

Indicates whether the tweet is marked as favorited or not

User mentions
UserMentions array of UserMentionsModel

List of users mentioned in the tweet

OriginalTweet
OriginalTweet OriginalTweetModel

Represents an original tweet post.

UserDetails
UserDetails UserDetailsModel

Represents a user.

UserMentionsModel

Represents a user mentioned in a tweet.

Name Path Type Description
Mentioned user id
Id integer

X id (handle) of the user

Mentioned user full name
FullName string

Full name of the user

Mentioned user name
UserName string

Screen name of the user

OriginalTweetModel

Represents an original tweet post.

Name Path Type Description
Original tweet text
TweetText string

Text content of the original retrieved tweet

Original tweet id
TweetId string

Id of the original tweet

Original tweet created at
CreatedAtIso string

Time at which original tweet was posted

Original tweet retweet count
RetweetCount integer

Total number of re-tweets for this original tweet

Original tweet tweeted by
TweetedBy string

User name of the person who posted the original tweet

Original tweet media urls
MediaUrls array of string

Url of the media posted along with the original tweet

Original tweet language
TweetLanguageCode string

Language code for the original tweet

Original tweet in_reply_to_user_id
TweetInReplyToUserId string

User Id of the author of the tweet that the current original tweet is a reply to

Original tweet favorited
Favorited boolean

Indicates whether the original tweet is marked as favorited

Original tweet user mentions
UserMentions array of OriginalTweetUserMentionsModel

The list of user mentioned in the tweet

UserDetails
UserDetails OriginalTweetUserDetailsModel

Represents a user who posted an original tweet

UserDetailsModel

Represents a user.

Name Path Type Description
Name
FullName string

Name of the user

Location
Location string

Location of the user

User id
Id integer

X id (handle) of the user

User name
UserName string

Screen name of the user

Followers count
FollowersCount integer

Number of followers

Description
Description string

User description

Statuses count
StatusesCount integer

User status count

Friends count
FriendsCount integer

Number of friends

Favourites count
FavouritesCount integer

Number of tweets that the user has favorited

Profile image url
ProfileImageUrl string

Url of the profile image

OriginalTweetUserMentionsModel

Represents a user mentioned in an original tweet.

Name Path Type Description
Original tweet mentioned user id
Id integer

X id (handle) of the user

Original tweet mentioned user full name
FullName string

Full name of the user

Original tweet mentioned user name
UserName string

Screen name of the user

OriginalTweetUserDetailsModel

Represents a user who posted an original tweet

Name Path Type Description
Original tweet user full name
FullName string

Name of the user

Original tweet user Location
Location string

Location of the user

Original tweet user id
Id integer

X id (handle) of the user

Original tweet user name
UserName string

Screen name of the user

Original tweet user followers count
FollowersCount integer

Number of followers

Original tweet user Description
Description string

User description

Original tweet user statuses count
StatusesCount integer

User status count

Original tweet user friends count
FriendsCount integer

Number of friends

Original tweet user favourites count
FavouritesCount integer

Number of tweets that the user has favorited

Original tweet user profile image url
ProfileImageUrl string

Url of the profile image

TweetResponseModel

Represents the response of a tweet post.

Name Path Type Description
Tweet id
TweetId string

ID of the tweet posted

TriggerBatchResponse[TweetModel]

Represents a wrapper object for batch trigger response

Name Path Type Description
value
value array of TweetModel

A list of the response objects