Integrations / X
X
Social network (formerly Twitter): look up accounts, read and search posts, publish and delete posts.
8 actions
OAuth 2
5 read2 write1 destructive
Calls api.x.com
Connect
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "x" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();Permissions requested
| Scope | Why it is requested |
|---|---|
tweet.read | Read posts, including those you can see |
users.read | Read profiles and identify the connected account |
tweet.write | Create and delete posts on your behalf |
offline.access | Stay connected without asking you to sign in again |
Actions
Create postwritex.create_postPublish a text post as the connected X account. Needs a paid X API access tier.
Needs scopes: tweet.write, tweet.read, users.read
| Input | Type | Description | |
|---|---|---|---|
text | string | Required | Post text |
reply_settings | string | Optional |
await setu.execute({
userId: "user_1",
action: "x.create_post",
input: {
"text": "<text>"
},
});Delete postdestructivex.delete_postPermanently delete one of the connected account's own posts by id.
Needs scopes: tweet.write, tweet.read, users.read
| Input | Type | Description | |
|---|---|---|---|
id | string | Required | Id of the post to delete |
await setu.execute({
userId: "user_1",
action: "x.delete_post",
input: {
"id": "<id>"
},
confirm: true,
});Get my profilereadx.get_meGet the profile of the connected X account (id, name, username).
Needs scopes: tweet.read, users.read
No input.
await setu.execute({
userId: "user_1",
action: "x.get_me",
input: {},
});Get postreadx.get_postGet a single post by its id, including its text and author id.
Needs scopes: tweet.read, users.read
| Input | Type | Description | |
|---|---|---|---|
id | string | Required | Post id (digits) |
await setu.execute({
userId: "user_1",
action: "x.get_post",
input: {
"id": "<id>"
},
});Get user by usernamereadx.get_user_by_usernameLook up an X account by its username (without the @) to get its numeric id and name.
Needs scopes: tweet.read, users.read
| Input | Type | Description | |
|---|---|---|---|
username | string | Required | Username without the @, 1 to 15 letters, digits or underscores |
await setu.execute({
userId: "user_1",
action: "x.get_user_by_username",
input: {
"username": "<username>"
},
});Get a user's postsreadx.get_user_postsGet recent posts from an account's timeline by numeric user id; can skip replies and reposts.
Needs scopes: tweet.read, users.read
| Input | Type | Description | |
|---|---|---|---|
id | string | Required | Numeric user id |
max_results | integer | Optional | 5 to 100 |
exclude | array of string | Optional | |
pagination_token | string | Optional |
await setu.execute({
userId: "user_1",
action: "x.get_user_posts",
input: {
"id": "<id>"
},
});Reply to postwritex.reply_to_postPublish a reply to an existing post as the connected X account. Needs a paid X API access tier.
Needs scopes: tweet.write, tweet.read, users.read
| Input | Type | Description | |
|---|---|---|---|
text | string | Required | |
in_reply_to_post_id | string | Required | Id of the post being replied to |
await setu.execute({
userId: "user_1",
action: "x.reply_to_post",
input: {
"text": "<text>",
"in_reply_to_post_id": "<in_reply_to_post_id>"
},
});Search recent postsreadx.search_recent_postsSearch posts from the last 7 days with an X search query (for example: from:user -is:retweet). Needs a paid X API access tier.
Needs scopes: tweet.read, users.read
| Input | Type | Description | |
|---|---|---|---|
query | string | Required | X search query, 1 to 4096 characters |
max_results | integer | Optional | Results to return, 10 to 100 (default 10) |
sort_order | string | Optional |
await setu.execute({
userId: "user_1",
action: "x.search_recent_posts",
input: {
"query": "<query>"
},
});