Skip to content

Commit 66abd63

Browse files
authored
added the new X tool to the docs (#415)
* added the new X tool to the docs * revert X to it's true name, and fixed usage examples * added formerly Twitter back
1 parent 8a81d54 commit 66abd63

15 files changed

+237
-182
lines changed
Lines changed: 91 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# X (Twitter)
1+
# X (formerly Twitter)
22

33
import ToolInfo from "@/components/ToolInfo";
44
import Badges from "@/components/Badges";
@@ -9,205 +9,212 @@ import ToolFooter from "@/components/ToolFooter";
99
<ToolInfo
1010
description="Enable agents to interact with X (formerly Twitter)."
1111
author="Arcade"
12-
codeLink="https://github.com/ArcadeAI/arcade-ai/tree/main/toolkits/x"
13-
authType="oauth2"
14-
authProviderName="X"
15-
versions={["0.1.0"]}
12+
authType="OAuth2"
13+
versions={["1.0.1"]}
1614
/>
1715

1816
<Badges repo="arcadeai/arcade_x" />
1917

20-
The Arcade X (Twitter) toolkit provides a pre-built set of tools for interacting with X (formerly Twitter). These tools make it easy to build agents and AI apps that can:
18+
The Arcade X (formerly Twitter) toolkit provides a pre-built set of tools for interacting with X (formerly Twitter). These tools make it easy to build agents and AI apps that can:
2119

2220
- Post tweets
21+
- Reply to tweets
22+
- Quote tweets
2323
- Delete tweets
2424
- Search for tweets by username
2525
- Search for tweets by keywords
2626
- Look up a user by username
2727

2828
## Available Tools
2929

30-
These tools are currently available in the Arcade X toolkit.
31-
3230
<TableOfContents
3331
headers={["Tool Name", "Description"]}
34-
data={[
35-
["X.PostTweet", "Post a tweet to X (Twitter)."],
36-
["X.DeleteTweetById", "Delete a tweet on X (Twitter)."],
37-
["X.SearchRecentTweetsByUsername", "Search recent tweets by username."],
38-
["X.SearchRecentTweetsByKeywords", "Search recent tweets by keywords or phrases.",],
39-
["X.LookupSingleUserByUsername", "Look up a user on X (Twitter) by username.",],
40-
["X.LookupTweetById", "Look up a tweet by its ID",],
41-
]}
32+
data={
33+
[
34+
["X.LookupSingleUserByUsername", "Look up a user on X (Twitter) by their username."],
35+
["X.PostTweet", "Post a tweet to X (Twitter)."],
36+
["X.ReplyToTweet", "Reply to a tweet on X (Twitter)."],
37+
["X.DeleteTweetById", "Delete a tweet on X (Twitter)."],
38+
["X.SearchRecentTweetsByUsername", "Search for recent tweets (last 7 days) on X (Twitter) by username."],
39+
["X.SearchRecentTweetsByKeywords", "Search for recent tweets (last 7 days) on X (Twitter) by required keywords and phrases."],
40+
["X.LookupTweetById", "Look up a tweet on X (Twitter) by tweet ID."],
41+
]
42+
}
4243
/>
4344

4445
<Tip>
4546
If you need to perform an action that's not listed here, you can [get in touch
4647
with us](mailto:[email protected]) to request a new tool, or [create your
47-
own tools](/home/build-tools/create-a-toolkit) with the [X auth
48-
provider](/home/auth-providers/x#using-x-auth-in-custom-tools).
48+
own tools](/home/build-tools/create-a-toolkit).
4949
</Tip>
5050

51+
## X.LookupSingleUserByUsername
52+
53+
<br />
54+
<TabbedCodeBlock
55+
tabs={[
56+
{
57+
label: "Call the Tool Directly",
58+
content: {
59+
Python: ["/examples/integrations/toolkits/x/lookup_single_user_by_username_example_call_tool.py"],
60+
JavaScript: ["/examples/integrations/toolkits/x/lookup_single_user_by_username_example_call_tool.js"],
61+
},
62+
},
63+
]}
64+
/>
65+
66+
Look up a user on X (Twitter) by their username.
67+
68+
**Parameters**
69+
70+
- **username** (`string`, required) The username of the X (Twitter) user to look up
71+
72+
5173
## X.PostTweet
5274

5375
<br />
5476
<TabbedCodeBlock
5577
tabs={[
5678
{
57-
label: "Call the Tool with User Authorization",
79+
label: "Call the Tool Directly",
5880
content: {
59-
Python: [
60-
"/examples/integrations/toolkits/x/post_tweet_example_call_tool.py",
61-
],
81+
Python: ["/examples/integrations/toolkits/x/post_tweet_example_call_tool.py"],
6282
JavaScript: ["/examples/integrations/toolkits/x/post_tweet_example_call_tool.js"],
6383
},
64-
}
84+
},
6585
]}
6686
/>
6787

6888
Post a tweet to X (Twitter).
6989

7090
**Parameters**
7191

72-
- **`tweet_text`** _(string, required)_ The text content of the tweet you want to post.
92+
- **tweet_text** (`string`, required) The text content of the tweet you want to post
93+
- **quote_tweet_id** (`string`, optional) The ID of the tweet you want to quote. Optional.
7394

74-
---
7595

76-
## X.DeleteTweetById
96+
## X.ReplyToTweet
7797

7898
<br />
7999
<TabbedCodeBlock
80100
tabs={[
81101
{
82-
label: "Call the Tool with User Authorization",
102+
label: "Call the Tool Directly",
83103
content: {
84-
Python: [
85-
"/examples/integrations/toolkits/x/delete_tweet_by_id_example_call_tool.py",
86-
],
87-
JavaScript: ["/examples/integrations/toolkits/x/delete_tweet_by_id_example_call_tool.js"],
104+
Python: ["/examples/integrations/toolkits/x/reply_to_tweet_example_call_tool.py"],
105+
JavaScript: ["/examples/integrations/toolkits/x/reply_to_tweet_example_call_tool.js"],
88106
},
89-
}
107+
},
90108
]}
91109
/>
92110

93-
Delete a tweet on X (Twitter).
111+
Reply to a tweet on X (Twitter).
94112

95113
**Parameters**
96114

97-
- **`tweet_id`** _(string, required)_ The ID of the tweet you want to delete.
115+
- **tweet_id** (`string`, required) The ID of the tweet you want to reply to
116+
- **tweet_text** (`string`, required) The text content of the tweet you want to post
117+
- **quote_tweet_id** (`string`, optional) The ID of the tweet you want to quote. Optional.
98118

99-
---
100119

101-
## X.SearchRecentTweetsByUsername
120+
## X.DeleteTweetById
102121

103122
<br />
104123
<TabbedCodeBlock
105124
tabs={[
106125
{
107-
label: "Call the Tool with User Authorization",
126+
label: "Call the Tool Directly",
108127
content: {
109-
Python: [
110-
"/examples/integrations/toolkits/x/search_recent_tweets_by_username_example_call_tool.py",
111-
],
112-
JavaScript: ["/examples/integrations/toolkits/x/search_recent_tweets_by_username_example_call_tool.js"],
128+
Python: ["/examples/integrations/toolkits/x/delete_tweet_by_id_example_call_tool.py"],
129+
JavaScript: ["/examples/integrations/toolkits/x/delete_tweet_by_id_example_call_tool.js"],
113130
},
114-
}
131+
},
115132
]}
116133
/>
117134

118-
Search for recent tweets (last 7 days) on X (Twitter) by username. Includes replies and reposts.
135+
Delete a tweet on X (Twitter).
119136

120137
**Parameters**
121138

122-
- **`username`** _(string, required)_ The username of the X (Twitter) user to look up.
123-
- **`max_results`** _(integer, optional, Defaults to 10)_ The maximum number of results to return. Cannot be less than 10.
124-
- **`next_token`** _(string, optional)_ The pagination token starting from which to return results.
139+
- **tweet_id** (`string`, required) The ID of the tweet you want to delete
125140

126-
---
127141

128-
## X.SearchRecentTweetsByKeywords
142+
## X.SearchRecentTweetsByUsername
129143

130144
<br />
131145
<TabbedCodeBlock
132146
tabs={[
133147
{
134-
label: "Call the Tool with User Authorization",
148+
label: "Call the Tool Directly",
135149
content: {
136-
Python: [
137-
"/examples/integrations/toolkits/x/search_recent_tweets_by_keywords_example_call_tool.py",
138-
],
139-
JavaScript: ["/examples/integrations/toolkits/x/search_recent_tweets_by_keywords_example_call_tool.js"],
150+
Python: ["/examples/integrations/toolkits/x/search_recent_tweets_by_username_example_call_tool.py"],
151+
JavaScript: ["/examples/integrations/toolkits/x/search_recent_tweets_by_username_example_call_tool.js"],
140152
},
141-
}
153+
},
142154
]}
143155
/>
144156

145-
Search for recent tweets (last 7 days) on X (Twitter) by required keywords and phrases. Includes replies and reposts.
146-
147-
_At least one of the following parameters must be provided: `keywords`, `phrases`._
157+
Search for recent tweets (last 7 days) on X (Twitter) by username.
148158

149159
**Parameters**
150160

151-
- **`keywords`** _(array of strings, optional)_ List of keywords that must be present in the tweet.
152-
- **`phrases`** _(array of strings, optional)_ List of phrases that must be present in the tweet.
153-
- **`max_results`** _(integer, optional, Defaults to 10)_ The maximum number of results to return. Cannot be less than 10.
161+
- **username** (`string`, required) The username of the X (Twitter) user to look up
162+
- **max_results** (`integer`, optional) The maximum number of results to return. Must be in range [1, 100] inclusive
163+
- **next_token** (`string`, optional) The pagination token starting from which to return results
154164

155-
---
156165

157-
## X.LookupTweetById
166+
## X.SearchRecentTweetsByKeywords
158167

159168
<br />
160169
<TabbedCodeBlock
161170
tabs={[
162171
{
163-
label: "Call the Tool with User Authorization",
172+
label: "Call the Tool Directly",
164173
content: {
165-
Python: [
166-
"/examples/integrations/toolkits/x/lookup_tweet_by_id_example_call_tool.py",
167-
],
168-
JavaScript: ["/examples/integrations/toolkits/x/lookup_tweet_by_id_example_call_tool.js"],
174+
Python: ["/examples/integrations/toolkits/x/search_recent_tweets_by_keywords_example_call_tool.py"],
175+
JavaScript: ["/examples/integrations/toolkits/x/search_recent_tweets_by_keywords_example_call_tool.js"],
169176
},
170-
}
177+
},
171178
]}
172179
/>
173180

174-
Look up a tweet on X (Twitter) by its ID.
181+
Search for recent tweets (last 7 days) on X (Twitter) by required keywords and phrases.
175182

176183
**Parameters**
177184

178-
- **`tweet_id`** _(string, required)_ The ID of the tweet to look up.
185+
- **keywords** (`array[string]`, optional) List of keywords that must be present in the tweet
186+
- **phrases** (`array[string]`, optional) List of phrases that must be present in the tweet
187+
- **max_results** (`integer`, optional) The maximum number of results to return. Must be in range [1, 100] inclusive
188+
- **next_token** (`string`, optional) The pagination token starting from which to return results
179189

180-
---
181190

182-
## X.LookupSingleUserByUsername
191+
## X.LookupTweetById
183192

184193
<br />
185194
<TabbedCodeBlock
186195
tabs={[
187196
{
188-
label: "Call the Tool with User Authorization",
197+
label: "Call the Tool Directly",
189198
content: {
190-
Python: [
191-
"/examples/integrations/toolkits/x/lookup_single_user_by_username_example_call_tool.py",
192-
],
193-
JavaScript: ["/examples/integrations/toolkits/x/lookup_single_user_by_username_example_call_tool.js"],
199+
Python: ["/examples/integrations/toolkits/x/lookup_tweet_by_id_example_call_tool.py"],
200+
JavaScript: ["/examples/integrations/toolkits/x/lookup_tweet_by_id_example_call_tool.js"],
194201
},
195-
}
202+
},
196203
]}
197204
/>
198205

199-
Look up a user on X (Twitter) by their username.
206+
Look up a tweet on X (Twitter) by tweet ID.
200207

201208
**Parameters**
202209

203-
- **`username`** _(string, required)_ The username of the X (Twitter) user to look up.
210+
- **tweet_id** (`string`, required) The ID of the tweet you want to look up
204211

205-
## Auth
206212

207-
The Arcade X (Twitter) toolkit uses the [X auth provider](/home/auth-providers/x) to connect to users' X (formerly Twitter) accounts.
208213

209-
With the hosted Arcade Engine, there's nothing to configure. Your users will see `Arcade` as the name of the application that's requesting permission.
210214

211-
With a self-hosted installation of Arcade, you need to [configure the X auth provider](/home/auth-providers/x#configuring-x-auth) with your own X (formerly Twitter) app credentials.
215+
## Auth
216+
217+
The Arcade X toolkit uses the [X auth provider](/home/auth-providers/x) to connect to users' X accounts. Please refer to the [X auth provider](/home/auth-providers/x) documentation to learn how to configure auth.
212218

213219
<ToolFooter pipPackageName="arcade_x" />
220+

public/examples/integrations/toolkits/x/delete_tweet_by_id_example_call_tool.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,23 @@ const USER_ID = "{arcade_user_id}";
66
const TOOL_NAME = "X.DeleteTweetById";
77

88
// Start the authorization process
9-
const authResponse = await client.tools.authorize({
10-
tool_name: TOOL_NAME,
11-
user_id: USER_ID,
12-
});
9+
const authResponse = await client.tools.authorize({tool_name: TOOL_NAME});
1310

1411
if (authResponse.status !== "completed") {
15-
console.log(`Click this link to authorize: ${authResponse.url}`);
12+
console.log(`Click this link to authorize: ${authResponse.url}`);
1613
}
1714

1815
// Wait for the authorization to complete
1916
await client.auth.waitForCompletion(authResponse);
2017

2118
const toolInput = {
22-
tweet_id: "your_tweet_id_here" // Tweet IDs can be found in the response of other X tools, like SearchRecentTweetsByUsername
19+
"tweet_id": "1234567890"
2320
};
2421

2522
const response = await client.tools.execute({
26-
tool_name: TOOL_NAME,
27-
input: toolInput,
28-
user_id: USER_ID,
23+
tool_name: TOOL_NAME,
24+
input: toolInput,
25+
user_id: USER_ID,
2926
});
3027

31-
console.log(response);
28+
console.log(JSON.stringify(response.output.value, null, 2));
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1+
import json
12
from arcadepy import Arcade
23

34
client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable
45

56
USER_ID = "{arcade_user_id}"
67
TOOL_NAME = "X.DeleteTweetById"
78

8-
auth_response = client.tools.authorize(
9-
tool_name=TOOL_NAME,
10-
user_id=USER_ID,
11-
)
9+
auth_response = client.tools.authorize(tool_name=TOOL_NAME)
1210

1311
if auth_response.status != "completed":
1412
print(f"Click this link to authorize: {auth_response.url}")
@@ -17,12 +15,12 @@
1715
client.auth.wait_for_completion(auth_response)
1816

1917
tool_input = {
20-
"tweet_id": "your_tweet_id_here" # Tweet IDs can be found in the response of other X tools, like SearchRecentTweetsByUsername
18+
'tweet_id': '1234567890'
2119
}
2220

2321
response = client.tools.execute(
2422
tool_name=TOOL_NAME,
2523
input=tool_input,
2624
user_id=USER_ID,
2725
)
28-
print(response)
26+
print(json.dumps(response.output.value, indent=2))

0 commit comments

Comments
 (0)