x-developer 2.6.1 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +13 -0
- package/README.md +4 -3
- package/commands/post.md +9 -3
- package/commands/trending.md +4 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/scripts/check-versions.mjs +5 -2
- package/scripts/release-guard/content-policy.mjs +4 -3
- package/scripts/release-guard/policy.mjs +1 -1
- package/server.json +1 -1
- package/skills/x-twitter-scraper/SKILL.md +13 -4
- package/skills/x-twitter-scraper/metadata.json +1 -1
- package/skills/x-twitter-scraper/references/api-endpoints-api-keys.md +6 -23
- package/skills/x-twitter-scraper/references/api-endpoints-drafts.md +20 -1
- package/skills/x-twitter-scraper/references/api-endpoints-draws.md +26 -0
- package/skills/x-twitter-scraper/references/api-endpoints-error-codes.md +3 -0
- package/skills/x-twitter-scraper/references/api-endpoints-events.md +3 -1
- package/skills/x-twitter-scraper/references/api-endpoints-extractions.md +41 -26
- package/skills/x-twitter-scraper/references/api-endpoints-monitors.md +43 -6
- package/skills/x-twitter-scraper/references/api-endpoints-radar.md +2 -1
- package/skills/x-twitter-scraper/references/api-endpoints-support.md +22 -0
- package/skills/x-twitter-scraper/references/api-endpoints-trends.md +9 -1
- package/skills/x-twitter-scraper/references/api-endpoints-tweet-style-cache.md +32 -1
- package/skills/x-twitter-scraper/references/api-endpoints-webhooks.md +55 -9
- package/skills/x-twitter-scraper/references/api-endpoints-x-accounts.md +11 -0
- package/skills/x-twitter-scraper/references/api-endpoints-x-api.md +51 -11
- package/skills/x-twitter-scraper/references/api-endpoints-x-media.md +10 -0
- package/skills/x-twitter-scraper/references/api-endpoints-x-write.md +85 -19
- package/skills/x-twitter-scraper/references/extractions.md +74 -6
- package/skills/x-twitter-scraper/references/mcp-setup.md +5 -3
- package/skills/x-twitter-scraper/references/mcp-tools.md +6 -5
- package/skills/x-twitter-scraper/references/monitor-twitter-webhooks.md +12 -10
- package/skills/x-twitter-scraper/references/python-examples.md +39 -12
- package/skills/x-twitter-scraper/references/track-twitter-keywords-mentions.md +5 -4
- package/skills/x-twitter-scraper/references/twitter-data-pipeline.md +1 -1
- package/skills/x-twitter-scraper/references/types-events.md +5 -25
- package/skills/x-twitter-scraper/references/types-extractions.md +49 -2
- package/skills/x-twitter-scraper/references/types-mcp-output-schemas.md +10 -19
- package/skills/x-twitter-scraper/references/types-monitors.md +30 -1
- package/skills/x-twitter-scraper/references/types-radar.md +7 -0
- package/skills/x-twitter-scraper/references/types-rest-api-vs-mcp-field-naming.md +8 -12
- package/skills/x-twitter-scraper/references/types-trends.md +3 -0
- package/skills/x-twitter-scraper/references/types-webhooks.md +10 -2
- package/skills/x-twitter-scraper/references/types-x-articles.md +27 -12
- package/skills/x-twitter-scraper/references/types-x-write.md +46 -7
- package/skills/x-twitter-scraper/references/types.md +0 -17
- package/skills/x-twitter-scraper/references/webhooks.md +123 -35
- package/skills/x-twitter-scraper/references/workflows.md +27 -9
- package/skills/x-twitter-scraper/skill-card.md +1 -1
- package/skills/xquik-social-research/SKILL.md +1 -0
- package/stub-server.mjs +1 -1
- package/task-guides/check-mutuals.md +1 -1
- package/task-guides/clean-followers.md +1 -1
- package/task-guides/export-tweets-csv.md +14 -5
- package/task-guides/extract-followers.md +2 -2
- package/task-guides/find-bangers.md +4 -2
- package/task-guides/find-influencers.md +7 -4
- package/task-guides/find-viral-tweets.md +1 -1
- package/task-guides/follow-unfollow.md +9 -4
- package/task-guides/for-you-feed.md +1 -1
- package/task-guides/going-viral.md +1 -1
- package/task-guides/grow-followers.md +4 -2
- package/task-guides/monitor-accounts.md +8 -9
- package/task-guides/optimize-tweets.md +1 -1
- package/task-guides/post-tweets.md +10 -6
- package/task-guides/run-giveaway.md +1 -1
- package/task-guides/search-tweets.md +16 -8
- package/task-guides/send-dms.md +16 -7
- package/task-guides/top-replies.md +1 -1
- package/task-guides/track-competitors.md +2 -2
- package/task-guides/track-hashtags.md +7 -8
- package/task-guides/track-mentions.md +10 -9
- package/task-guides/trending-news.md +13 -8
- package/task-guides/tweet-analytics.md +2 -2
- package/task-guides/tweet-ideas.md +1 -1
- package/task-guides/tweet-replies.md +26 -8
- package/task-guides/tweet-style.md +1 -1
- package/task-guides/tweet-webhooks.md +16 -12
- package/task-guides/update-x-profile.md +8 -5
- package/task-guides/user-tweets.md +20 -8
- package/task-guides/who-liked.md +1 -1
- package/task-guides/who-quoted.md +1 -1
- package/task-guides/who-retweeted.md +1 -1
- package/task-guides/write-threads.md +1 -1
- package/task-guides/write-tweets.md +1 -1
- package/task-guides/x-articles.md +10 -5
- package/task-guides/x-bookmarks.md +1 -1
- package/task-guides/x-communities.md +1 -1
- package/task-guides/x-lists.md +1 -1
- package/task-guides/x-spaces.md +1 -1
- package/task-guides/x-trends.md +6 -6
- package/skills/x-twitter-scraper/references/types-mcp-add-webhook.md +0 -14
- package/skills/x-twitter-scraper/references/types-mcp-check-follow.md +0 -10
- package/skills/x-twitter-scraper/references/types-mcp-compose-tweet.md +0 -31
- package/skills/x-twitter-scraper/references/types-mcp-estimate-extraction.md +0 -15
- package/skills/x-twitter-scraper/references/types-mcp-get-account.md +0 -26
- package/skills/x-twitter-scraper/references/types-mcp-get-draw.md +0 -30
- package/skills/x-twitter-scraper/references/types-mcp-get-events.md +0 -19
- package/skills/x-twitter-scraper/references/types-mcp-get-trends.md +0 -16
- package/skills/x-twitter-scraper/references/types-mcp-get-user-info.md +0 -16
- package/skills/x-twitter-scraper/references/types-mcp-list-monitors.md +0 -15
- package/skills/x-twitter-scraper/references/types-mcp-lookup-tweet.md +0 -25
- package/skills/x-twitter-scraper/references/types-mcp-refine-tweet.md +0 -13
- package/skills/x-twitter-scraper/references/types-mcp-run-draw.md +0 -18
- package/skills/x-twitter-scraper/references/types-mcp-run-extraction.md +0 -12
- package/skills/x-twitter-scraper/references/types-mcp-score-tweet.md +0 -16
- package/skills/x-twitter-scraper/references/types-mcp-search-tweets.md +0 -17
- package/skills/x-twitter-scraper/references/types-mcp-test-webhook.md +0 -11
|
@@ -25,8 +25,12 @@ Every delivery is a `POST` request to your URL with a JSON body:
|
|
|
25
25
|
|
|
26
26
|
```json
|
|
27
27
|
{
|
|
28
|
+
"schemaVersion": 1,
|
|
29
|
+
"streamEventId": "9010",
|
|
30
|
+
"deliveryId": "334",
|
|
28
31
|
"eventType": "tweet.new",
|
|
29
32
|
"username": "elonmusk",
|
|
33
|
+
"occurredAt": "2026-02-24T16:45:00.000Z",
|
|
30
34
|
"data": {
|
|
31
35
|
"tweetId": "1893556789012345678",
|
|
32
36
|
"text": "Hello world",
|
|
@@ -37,7 +41,16 @@ Every delivery is a `POST` request to your URL with a JSON body:
|
|
|
37
41
|
|
|
38
42
|
## Signature Verification
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
Each request contains `X-Xquik-Timestamp`, `X-Xquik-Nonce`, and
|
|
45
|
+
`X-Xquik-Signature`. The signature is `sha256=` plus HMAC-SHA256 over:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
<timestamp>.<nonce>.<raw JSON body>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Reject timestamps outside a 5-minute window. Reject reused nonces within that
|
|
52
|
+
window. Compare signatures in constant time before parsing JSON.
|
|
53
|
+
Use an atomic shared nonce store in multi-instance deployments.
|
|
41
54
|
|
|
42
55
|
### Node.js (Standard Library)
|
|
43
56
|
|
|
@@ -47,11 +60,25 @@ import { createServer } from "node:http";
|
|
|
47
60
|
|
|
48
61
|
// This is the per-webhook secret from the POST /webhooks response, not a Xquik account credential
|
|
49
62
|
const WEBHOOK_SECRET = process.env.XQUIK_WEBHOOK_SECRET;
|
|
63
|
+
const recentNonces = new Map();
|
|
50
64
|
|
|
51
|
-
function
|
|
52
|
-
|
|
65
|
+
function claimNonce(nonce) {
|
|
66
|
+
const now = Date.now();
|
|
67
|
+
for (const [value, expiresAt] of recentNonces) {
|
|
68
|
+
if (expiresAt <= now) recentNonces.delete(value);
|
|
69
|
+
}
|
|
70
|
+
if (recentNonces.has(nonce)) return false;
|
|
71
|
+
recentNonces.set(nonce, now + 5 * 60 * 1000);
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
53
74
|
|
|
54
|
-
|
|
75
|
+
function verifySignature(payload, signature, timestamp, nonce, secret) {
|
|
76
|
+
if (![signature, timestamp, nonce, secret].every((value) => typeof value === "string")) return false;
|
|
77
|
+
if (!/^\d+$/.test(timestamp) || !/^[0-9a-f]{32}$/.test(nonce)) return false;
|
|
78
|
+
if (Math.abs(Date.now() - Number(timestamp)) > 5 * 60 * 1000) return false;
|
|
79
|
+
|
|
80
|
+
const input = `${timestamp}.${nonce}.${payload}`;
|
|
81
|
+
const expected = "sha256=" + createHmac("sha256", secret).update(input).digest("hex");
|
|
55
82
|
const expectedBuffer = Buffer.from(expected, "utf8");
|
|
56
83
|
const signatureBuffer = Buffer.from(signature, "utf8");
|
|
57
84
|
|
|
@@ -73,26 +100,25 @@ const server = createServer((req, res) => {
|
|
|
73
100
|
req.on("end", () => {
|
|
74
101
|
const payload = Buffer.concat(chunks).toString("utf8");
|
|
75
102
|
const signature = req.headers["x-xquik-signature"];
|
|
103
|
+
const timestamp = req.headers["x-xquik-timestamp"];
|
|
104
|
+
const nonce = req.headers["x-xquik-nonce"];
|
|
76
105
|
|
|
77
|
-
if (
|
|
106
|
+
if (
|
|
107
|
+
!verifySignature(payload, signature, timestamp, nonce, WEBHOOK_SECRET) ||
|
|
108
|
+
!claimNonce(nonce)
|
|
109
|
+
) {
|
|
78
110
|
res.writeHead(401).end("Invalid signature");
|
|
79
111
|
return;
|
|
80
112
|
}
|
|
81
113
|
|
|
82
114
|
const event = JSON.parse(payload);
|
|
83
115
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
break;
|
|
88
|
-
case "tweet.reply":
|
|
89
|
-
console.log(`Reply from @${event.username}: ${event.data.text}`);
|
|
90
|
-
break;
|
|
91
|
-
case "tweet.retweet":
|
|
92
|
-
console.log(`@${event.username} retweeted`);
|
|
93
|
-
break;
|
|
116
|
+
if (!["tweet.new", "tweet.reply", "tweet.retweet"].includes(event.eventType)) {
|
|
117
|
+
res.writeHead(400).end("Unsupported event type");
|
|
118
|
+
return;
|
|
94
119
|
}
|
|
95
120
|
|
|
121
|
+
console.log("Accepted verified Xquik webhook");
|
|
96
122
|
res.writeHead(200).end("OK");
|
|
97
123
|
});
|
|
98
124
|
});
|
|
@@ -106,6 +132,8 @@ server.listen(3000);
|
|
|
106
132
|
import hmac
|
|
107
133
|
import hashlib
|
|
108
134
|
import json
|
|
135
|
+
import re
|
|
136
|
+
import time
|
|
109
137
|
from http.server import BaseHTTPRequestHandler, HTTPServer
|
|
110
138
|
|
|
111
139
|
def load_secret(name: str) -> str:
|
|
@@ -114,20 +142,36 @@ def load_secret(name: str) -> str:
|
|
|
114
142
|
|
|
115
143
|
# Per-webhook secret from POST /webhooks response, not a Xquik account credential
|
|
116
144
|
WEBHOOK_SECRET = load_secret("XQUIK_WEBHOOK_SECRET")
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
145
|
+
RECENT_NONCES: dict[str, int] = {}
|
|
146
|
+
|
|
147
|
+
def claim_nonce(nonce: str) -> bool:
|
|
148
|
+
now = int(time.time() * 1000)
|
|
149
|
+
for value, expires_at in list(RECENT_NONCES.items()):
|
|
150
|
+
if expires_at <= now:
|
|
151
|
+
RECENT_NONCES.pop(value, None)
|
|
152
|
+
if nonce in RECENT_NONCES:
|
|
153
|
+
return False
|
|
154
|
+
RECENT_NONCES[nonce] = now + 5 * 60 * 1000
|
|
155
|
+
return True
|
|
156
|
+
|
|
157
|
+
def verify_signature(payload: bytes, signature: str, timestamp: str, nonce: str, secret: str) -> bool:
|
|
158
|
+
if not timestamp.isdigit() or not re.fullmatch(r"[0-9a-f]{32}", nonce):
|
|
159
|
+
return False
|
|
160
|
+
if abs(int(time.time() * 1000) - int(timestamp)) > 5 * 60 * 1000:
|
|
161
|
+
return False
|
|
162
|
+
signing_input = timestamp.encode() + b"." + nonce.encode() + b"." + payload
|
|
163
|
+
expected = "sha256=" + hmac.new(secret.encode(), signing_input, hashlib.sha256).hexdigest()
|
|
122
164
|
return hmac.compare_digest(expected, signature)
|
|
123
165
|
|
|
124
166
|
class WebhookHandler(BaseHTTPRequestHandler):
|
|
125
167
|
def do_POST(self):
|
|
126
168
|
signature = self.headers.get("X-Xquik-Signature", "")
|
|
169
|
+
timestamp = self.headers.get("X-Xquik-Timestamp", "")
|
|
170
|
+
nonce = self.headers.get("X-Xquik-Nonce", "")
|
|
127
171
|
length = int(self.headers.get("Content-Length", "0"))
|
|
128
172
|
payload = self.rfile.read(length)
|
|
129
173
|
|
|
130
|
-
if not verify_signature(payload, signature, WEBHOOK_SECRET):
|
|
174
|
+
if not verify_signature(payload, signature, timestamp, nonce, WEBHOOK_SECRET) or not claim_nonce(nonce):
|
|
131
175
|
self.send_response(401)
|
|
132
176
|
self.end_headers()
|
|
133
177
|
self.wfile.write(b"Invalid signature")
|
|
@@ -135,9 +179,13 @@ class WebhookHandler(BaseHTTPRequestHandler):
|
|
|
135
179
|
|
|
136
180
|
event = json.loads(payload)
|
|
137
181
|
|
|
138
|
-
if event
|
|
139
|
-
|
|
182
|
+
if event.get("eventType") not in {"tweet.new", "tweet.reply", "tweet.retweet"}:
|
|
183
|
+
self.send_response(400)
|
|
184
|
+
self.end_headers()
|
|
185
|
+
self.wfile.write(b"Unsupported event type")
|
|
186
|
+
return
|
|
140
187
|
|
|
188
|
+
print("Accepted verified Xquik webhook")
|
|
141
189
|
self.send_response(200)
|
|
142
190
|
self.end_headers()
|
|
143
191
|
self.wfile.write(b"OK")
|
|
@@ -159,13 +207,39 @@ import (
|
|
|
159
207
|
"io"
|
|
160
208
|
"net/http"
|
|
161
209
|
"os"
|
|
210
|
+
"regexp"
|
|
211
|
+
"strconv"
|
|
212
|
+
"sync"
|
|
213
|
+
"time"
|
|
162
214
|
)
|
|
163
215
|
|
|
164
216
|
// Per-webhook secret from POST /webhooks response, not a Xquik account credential
|
|
165
217
|
var webhookSecret = os.Getenv("XQUIK_WEBHOOK_SECRET")
|
|
218
|
+
var recentNonces sync.Map
|
|
219
|
+
|
|
220
|
+
func claimNonce(nonce string) bool {
|
|
221
|
+
now := time.Now().UnixMilli()
|
|
222
|
+
recentNonces.Range(func(key, value any) bool {
|
|
223
|
+
if value.(int64) <= now {
|
|
224
|
+
recentNonces.Delete(key)
|
|
225
|
+
}
|
|
226
|
+
return true
|
|
227
|
+
})
|
|
228
|
+
_, replayed := recentNonces.LoadOrStore(nonce, now+5*60*1000)
|
|
229
|
+
return !replayed
|
|
230
|
+
}
|
|
166
231
|
|
|
167
|
-
func verifySignature(payload []byte, signature, secret string) bool {
|
|
232
|
+
func verifySignature(payload []byte, signature, timestamp, nonce, secret string) bool {
|
|
233
|
+
signedAt, err := strconv.ParseInt(timestamp, 10, 64)
|
|
234
|
+
if err != nil || !regexp.MustCompile(`^[0-9a-f]{32}$`).MatchString(nonce) {
|
|
235
|
+
return false
|
|
236
|
+
}
|
|
237
|
+
age := time.Now().UnixMilli() - signedAt
|
|
238
|
+
if age < -5*60*1000 || age > 5*60*1000 {
|
|
239
|
+
return false
|
|
240
|
+
}
|
|
168
241
|
mac := hmac.New(sha256.New, []byte(secret))
|
|
242
|
+
mac.Write([]byte(timestamp + "." + nonce + "."))
|
|
169
243
|
mac.Write(payload)
|
|
170
244
|
expected := "sha256=" + hex.EncodeToString(mac.Sum(nil))
|
|
171
245
|
return hmac.Equal([]byte(expected), []byte(signature))
|
|
@@ -179,8 +253,10 @@ func webhookHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
179
253
|
}
|
|
180
254
|
|
|
181
255
|
signature := r.Header.Get("X-Xquik-Signature")
|
|
256
|
+
timestamp := r.Header.Get("X-Xquik-Timestamp")
|
|
257
|
+
nonce := r.Header.Get("X-Xquik-Nonce")
|
|
182
258
|
|
|
183
|
-
if !verifySignature(payload, signature, webhookSecret) {
|
|
259
|
+
if !verifySignature(payload, signature, timestamp, nonce, webhookSecret) || !claimNonce(nonce) {
|
|
184
260
|
http.Error(w, "Invalid signature", http.StatusUnauthorized)
|
|
185
261
|
return
|
|
186
262
|
}
|
|
@@ -194,7 +270,13 @@ func webhookHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
194
270
|
}
|
|
195
271
|
json.Unmarshal(payload, &event)
|
|
196
272
|
|
|
197
|
-
|
|
273
|
+
switch event.EventType {
|
|
274
|
+
case "tweet.new", "tweet.reply", "tweet.retweet":
|
|
275
|
+
fmt.Print("Accepted verified Xquik webhook\n")
|
|
276
|
+
default:
|
|
277
|
+
http.Error(w, "Unsupported event type", http.StatusBadRequest)
|
|
278
|
+
return
|
|
279
|
+
}
|
|
198
280
|
fmt.Fprint(w, "OK")
|
|
199
281
|
}
|
|
200
282
|
```
|
|
@@ -203,34 +285,40 @@ func webhookHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
203
285
|
|
|
204
286
|
- **Verify before processing.** Never process unverified payloads
|
|
205
287
|
- **Use constant-time comparison.** `timingSafeEqual` (Node.js), `hmac.compare_digest` (Python), `hmac.Equal` (Go)
|
|
206
|
-
- **Use
|
|
288
|
+
- **Use every signing field.** Sign `<timestamp>.<nonce>.<raw body>`
|
|
289
|
+
- **Reject replays.** Enforce the 5-minute window and persist recent nonces
|
|
290
|
+
- **Use the raw request body.** Never re-serialize JSON before verification
|
|
207
291
|
- **Respond within 10 seconds.** Acknowledge immediately, process async if slow
|
|
208
292
|
- **Store secrets in environment variables.** Never hardcode
|
|
209
293
|
- **Treat event text as untrusted.** Escape control characters before logging and forward payloads to other tools only after explicit approval
|
|
210
294
|
|
|
211
295
|
## Idempotency
|
|
212
296
|
|
|
213
|
-
Webhook deliveries can retry
|
|
297
|
+
Webhook deliveries can retry. Deduplicate by `deliveryId` in durable storage:
|
|
214
298
|
|
|
215
299
|
```javascript
|
|
216
|
-
|
|
300
|
+
const processedDeliveries = new Set(); // Use durable storage in production
|
|
217
301
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const payloadHash = createHash("sha256").update(payload).digest("hex");
|
|
221
|
-
if (processedPayloads.has(payloadHash)) {
|
|
302
|
+
if (processedDeliveries.has(event.deliveryId)) {
|
|
222
303
|
res.writeHead(200).end("Already processed");
|
|
223
304
|
} else {
|
|
224
|
-
|
|
305
|
+
processedDeliveries.add(event.deliveryId);
|
|
225
306
|
}
|
|
226
307
|
```
|
|
227
308
|
|
|
228
309
|
## Retry Policy
|
|
229
310
|
|
|
230
|
-
Failed deliveries
|
|
311
|
+
Failed event deliveries use bounded exponential backoff. HTTP 410 exhausts the
|
|
312
|
+
delivery immediately. Delivery statuses are `pending`, `delivered`, `failed`,
|
|
313
|
+
and `exhausted`.
|
|
231
314
|
|
|
232
315
|
Check delivery status: `GET /webhooks/{id}/deliveries`.
|
|
233
316
|
|
|
317
|
+
Repeated failures can pause an endpoint. Inspect `consecutiveFailures`,
|
|
318
|
+
`deliveryStatus`, and `failureHardCap` on the webhook. Fix the destination,
|
|
319
|
+
then call `POST /webhooks/{id}/resume`. It reactivates only after a successful
|
|
320
|
+
test delivery.
|
|
321
|
+
|
|
234
322
|
## Local Testing
|
|
235
323
|
|
|
236
324
|
Use a deployed HTTPS endpoint you control when testing webhook delivery. Do not install packages or proxy API keys from this skill.
|
|
@@ -13,6 +13,12 @@ Code examples for common integration patterns.
|
|
|
13
13
|
|
|
14
14
|
## Authentication
|
|
15
15
|
|
|
16
|
+
> **External transmission:** These examples send credentials, parameters, and
|
|
17
|
+
> returned data to and from `xquik.com`. Keep the key in a secret store. Get
|
|
18
|
+
> explicit approval before private reads, writes, exports, persistent resources,
|
|
19
|
+
> webhooks, or metered jobs. Never forward private results without separate
|
|
20
|
+
> approval.
|
|
21
|
+
|
|
16
22
|
```javascript
|
|
17
23
|
const apiKey = process.env.XQUIK_API_KEY;
|
|
18
24
|
if (!apiKey) throw new Error("Set XQUIK_API_KEY first.");
|
|
@@ -23,11 +29,14 @@ const headers = { "x-api-key": apiKey, "Content-Type": "application/json" };
|
|
|
23
29
|
|
|
24
30
|
## Retry with Exponential Backoff
|
|
25
31
|
|
|
26
|
-
Retry only `429` and `5xx`. Never retry
|
|
32
|
+
Retry only idempotent requests after `429` and `5xx`. Never automatically retry
|
|
33
|
+
`POST`, `PATCH`, or `DELETE`. Max 3 retries:
|
|
27
34
|
|
|
28
35
|
```javascript
|
|
29
36
|
async function xquikFetch(path, options = {}) {
|
|
30
37
|
const baseDelay = 1000;
|
|
38
|
+
const method = (options.method || "GET").toUpperCase();
|
|
39
|
+
const retrySafe = ["GET", "HEAD", "OPTIONS"].includes(method);
|
|
31
40
|
|
|
32
41
|
for (let attempt = 0; attempt <= 3; attempt++) {
|
|
33
42
|
const response = await fetch(`${BASE}${path}`, {
|
|
@@ -37,7 +46,7 @@ async function xquikFetch(path, options = {}) {
|
|
|
37
46
|
|
|
38
47
|
if (response.ok) return response.json();
|
|
39
48
|
|
|
40
|
-
const retryable = response.status === 429 || response.status >= 500;
|
|
49
|
+
const retryable = retrySafe && (response.status === 429 || response.status >= 500);
|
|
41
50
|
if (!retryable || attempt === 3) {
|
|
42
51
|
const error = await response.json();
|
|
43
52
|
throw new Error(`Xquik API ${response.status}: ${error.error}`);
|
|
@@ -55,7 +64,9 @@ async function xquikFetch(path, options = {}) {
|
|
|
55
64
|
|
|
56
65
|
## Cursor Pagination
|
|
57
66
|
|
|
58
|
-
Events, draws, extractions, and extraction results use cursor-based pagination.
|
|
67
|
+
Events, draws, extractions, and extraction results use cursor-based pagination.
|
|
68
|
+
When more results exist, the response includes `hasMore: true` and a
|
|
69
|
+
`nextCursor` string. Pass it as `cursor`. Radar alone uses `after`.
|
|
59
70
|
|
|
60
71
|
```javascript
|
|
61
72
|
async function fetchAllPages(path, dataKey) {
|
|
@@ -64,7 +75,7 @@ async function fetchAllPages(path, dataKey) {
|
|
|
64
75
|
|
|
65
76
|
while (true) {
|
|
66
77
|
const params = new URLSearchParams({ limit: "100" });
|
|
67
|
-
if (cursor) params.set("
|
|
78
|
+
if (cursor) params.set("cursor", cursor);
|
|
68
79
|
|
|
69
80
|
const data = await xquikFetch(`${path}?${params}`);
|
|
70
81
|
results.push(...data[dataKey]);
|
|
@@ -82,6 +93,10 @@ Cursors are opaque strings. Never decode or construct them manually.
|
|
|
82
93
|
## Complete Extraction Workflow
|
|
83
94
|
|
|
84
95
|
```javascript
|
|
96
|
+
function requireExplicitApproval(scope) {
|
|
97
|
+
throw new Error(`Approval required for ${scope}. Implement the approval gate first.`);
|
|
98
|
+
}
|
|
99
|
+
|
|
85
100
|
// Step 1: Estimate usage before running
|
|
86
101
|
const estimate = await xquikFetch("/extractions/estimate", {
|
|
87
102
|
method: "POST",
|
|
@@ -97,7 +112,8 @@ if (!estimate.allowed) {
|
|
|
97
112
|
return;
|
|
98
113
|
}
|
|
99
114
|
|
|
100
|
-
// Step 2: Create extraction job
|
|
115
|
+
// Step 2: Create extraction job after approving this exact bounded request
|
|
116
|
+
requireExplicitApproval("the bounded extraction job, usage, recipients, and retention");
|
|
101
117
|
let job = await xquikFetch("/extractions", {
|
|
102
118
|
method: "POST",
|
|
103
119
|
body: JSON.stringify({
|
|
@@ -118,7 +134,7 @@ let cursor;
|
|
|
118
134
|
const allResults = [];
|
|
119
135
|
|
|
120
136
|
while (true) {
|
|
121
|
-
const path = `/extractions/${job.id}${cursor ? `?
|
|
137
|
+
const path = `/extractions/${job.id}${cursor ? `?cursor=${cursor}` : ""}`;
|
|
122
138
|
const page = await xquikFetch(path);
|
|
123
139
|
allResults.push(...page.results);
|
|
124
140
|
|
|
@@ -126,7 +142,8 @@ while (true) {
|
|
|
126
142
|
cursor = page.nextCursor;
|
|
127
143
|
}
|
|
128
144
|
|
|
129
|
-
// Step 5: Export
|
|
145
|
+
// Step 5: Export only after reviewing a bounded preview and approving transmission
|
|
146
|
+
requireExplicitApproval("the fixed export scope, audience, storage, and retention");
|
|
130
147
|
const exportUrl = `${BASE}/extractions/${job.id}/export?format=csv`;
|
|
131
148
|
const csvResponse = await fetch(exportUrl, { headers });
|
|
132
149
|
const csvData = await csvResponse.text();
|
|
@@ -160,7 +177,8 @@ const webhook = await xquikFetch("/webhooks", {
|
|
|
160
177
|
const events = await xquikFetch("/events?monitorId=7&limit=50");
|
|
161
178
|
```
|
|
162
179
|
|
|
163
|
-
|
|
180
|
+
Monitor event types include `tweet.new`, `tweet.quote`, `tweet.reply`, and
|
|
181
|
+
`tweet.retweet`. Test deliveries use `webhook.test`; do not subscribe to it.
|
|
164
182
|
|
|
165
183
|
## Endpoint Guide
|
|
166
184
|
|
|
@@ -182,7 +200,7 @@ Event types: `tweet.new`, `tweet.quote`, `tweet.reply`, `tweet.retweet`, `webhoo
|
|
|
182
200
|
| **Get bookmark folders** | `GET /x/bookmarks/folders` | Metered |
|
|
183
201
|
| **Get notifications** | `GET /x/notifications` | Metered per result |
|
|
184
202
|
| **Get home timeline** | `GET /x/timeline` | Metered per result |
|
|
185
|
-
| **Get DM history** | `GET /x/dm/{userId}/history` |
|
|
203
|
+
| **Get DM history** | `GET /x/dm/{userId}/history?account={username}` | Private; approve exact account and block ambiguity |
|
|
186
204
|
| **Monitor an X account** | `POST /monitors` | Active monitors are metered hourly |
|
|
187
205
|
| **Poll for events** | `GET /events` | Included |
|
|
188
206
|
| **Receive events via webhook** | `POST /webhooks` | Included; confirmation required for destination URL |
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: xquik-social-research
|
|
3
3
|
description: Research public X data with Xquik. Use for tweet search, tweet lookup, user discovery, profile timelines, threads, followers, trends, exports, monitoring plans, or MCP setup. Keep public reads bounded. Require explicit approval before private reads, writes, persistent resources, or bulk jobs. Not affiliated with X Corp.
|
|
4
|
+
license: MIT
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Xquik Social Research
|
package/stub-server.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: export-tweets-csv
|
|
3
|
-
description: "Use when the user wants to export X (Twitter) data to CSV,
|
|
3
|
+
description: "Use when the user wants to export X (Twitter) data to CSV, JSON, Markdown, PDF, TXT, or XLSX. Covers extraction results and giveaway entrant files. Download handling only."
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
6
|
internal: true
|
|
7
7
|
author: Xquik
|
|
8
|
-
version: "2.6.
|
|
8
|
+
version: "2.6.2"
|
|
9
9
|
openclaw:
|
|
10
10
|
requires:
|
|
11
11
|
env:
|
|
@@ -26,7 +26,7 @@ metadata:
|
|
|
26
26
|
credentialProxy: false
|
|
27
27
|
---
|
|
28
28
|
|
|
29
|
-
# Export X Data
|
|
29
|
+
# Export X Data
|
|
30
30
|
|
|
31
31
|
Download completed extractions or draw entrant lists in spreadsheet-friendly formats.
|
|
32
32
|
|
|
@@ -35,7 +35,7 @@ Download completed extractions or draw entrant lists in spreadsheet-friendly for
|
|
|
35
35
|
| Endpoint | Purpose | Usage |
|
|
36
36
|
|---|---|---|
|
|
37
37
|
| GET /extractions/{id}/export?format=csv | CSV export | Read tier |
|
|
38
|
-
| GET /extractions/{id}/export?format=
|
|
38
|
+
| GET /extractions/{id}/export?format=json | JSON export | Read tier |
|
|
39
39
|
| GET /extractions/{id}/export?format=xlsx | Excel workbook | Read tier |
|
|
40
40
|
| GET /draws/{id}/export?format=csv | Giveaway entrants/winners | Read tier |
|
|
41
41
|
|
|
@@ -59,7 +59,16 @@ GET /extractions/{id}/export?format=csv
|
|
|
59
59
|
|
|
60
60
|
- CSV: broad compatibility, Excel/Sheets open directly
|
|
61
61
|
- XLSX: preserves types, multiple sheets per extraction
|
|
62
|
-
-
|
|
62
|
+
- JSON: structured data for scripts or databases
|
|
63
|
+
- Markdown, PDF, or TXT: human-readable reports
|
|
64
|
+
|
|
65
|
+
## Export Filters
|
|
66
|
+
|
|
67
|
+
The endpoint accepts follower, following, post, engagement, profile, media,
|
|
68
|
+
language, search, and date filters. Use `minFollowers`, `maxFollowers`,
|
|
69
|
+
`minFollowing`, `maxFollowing`, `minPosts`, `maxPosts`, `minLikes`,
|
|
70
|
+
`minReplies`, `minRetweets`, `minViews`, `hasDescription`, `hasLocation`,
|
|
71
|
+
`hasMedia`, `verified`, `lang`, `search`, `sinceDate`, and `untilDate`.
|
|
63
72
|
|
|
64
73
|
## Security
|
|
65
74
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: extract-followers
|
|
3
|
-
description: "Use when the user wants to extract the follower list of any public X (Twitter) account. Pulls follower profiles, filters by verified status, and exports
|
|
3
|
+
description: "Use when the user wants to extract the follower list of any public X (Twitter) account. Pulls follower profiles, filters by verified status, and exports supported files for analysis. Read-only."
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
6
|
internal: true
|
|
7
7
|
author: Xquik
|
|
8
|
-
version: "2.6.
|
|
8
|
+
version: "2.6.2"
|
|
9
9
|
openclaw:
|
|
10
10
|
requires:
|
|
11
11
|
env:
|
|
@@ -5,7 +5,7 @@ license: MIT
|
|
|
5
5
|
metadata:
|
|
6
6
|
internal: true
|
|
7
7
|
author: Xquik
|
|
8
|
-
version: "2.6.
|
|
8
|
+
version: "2.6.2"
|
|
9
9
|
openclaw:
|
|
10
10
|
requires:
|
|
11
11
|
env:
|
|
@@ -44,7 +44,9 @@ Base URL: `https://xquik.com/api/v1`. Auth: `x-api-key: xq_...` header.
|
|
|
44
44
|
|
|
45
45
|
1. Get a handle from the user.
|
|
46
46
|
2. `GET /x/users/{id}` to get the baseline follower count and numeric `id`.
|
|
47
|
-
3.
|
|
47
|
+
3. Page `GET /x/users/{id}/tweets?pageSize=300&cursor=<>`, then sort
|
|
48
|
+
client-side. Continue until `has_next_page` is false. Or use Tweet Search
|
|
49
|
+
with a `minFaves` filter and `queryType=Top`.
|
|
48
50
|
4. Compute engagement rate per tweet = (likes + RTs + replies) / followers.
|
|
49
51
|
5. Surface tweets with engagement rate more than 3-5x the median for that author. Those are bangers.
|
|
50
52
|
|
|
@@ -5,7 +5,7 @@ license: MIT
|
|
|
5
5
|
metadata:
|
|
6
6
|
internal: true
|
|
7
7
|
author: Xquik
|
|
8
|
-
version: "2.6.
|
|
8
|
+
version: "2.6.2"
|
|
9
9
|
openclaw:
|
|
10
10
|
requires:
|
|
11
11
|
env:
|
|
@@ -51,15 +51,18 @@ POST /extractions
|
|
|
51
51
|
-> 202 { "id": "<extractionId>", "toolType": "people_search", "status": "running" }
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
The
|
|
54
|
+
The request also accepts profile filters. Examples include `minFollowers`,
|
|
55
|
+
`maxFollowers`, `minPosts`, `minAccountAgeDays`, `verifiedType`,
|
|
56
|
+
`hasWebsite`, `hasLocation`, and text-match fields. Apply them before
|
|
57
|
+
estimation so excluded rows are not delivered.
|
|
55
58
|
|
|
56
59
|
## Typical flow
|
|
57
60
|
|
|
58
|
-
1. Ask
|
|
61
|
+
1. Ask for the niche, result bound, and profile filters.
|
|
59
62
|
2. Call `POST /extractions/estimate`, show the usage estimate.
|
|
60
63
|
3. On approval, `POST /extractions`.
|
|
61
64
|
4. Poll `GET /extractions/{id}` until `completed`.
|
|
62
|
-
5. Retrieve `GET /extractions/{id}?
|
|
65
|
+
5. Retrieve `GET /extractions/{id}?cursor=<cursor>` until `hasMore` is false.
|
|
63
66
|
6. Optionally enrich the shortlist with `GET /x/users/{id}` for recency signals. The `{id}` segment accepts a username or numeric user ID.
|
|
64
67
|
7. Export via `GET /extractions/{id}/export?format=csv` if raw data is needed.
|
|
65
68
|
|
|
@@ -5,7 +5,7 @@ license: MIT
|
|
|
5
5
|
metadata:
|
|
6
6
|
internal: true
|
|
7
7
|
author: Xquik
|
|
8
|
-
version: "2.6.
|
|
8
|
+
version: "2.6.2"
|
|
9
9
|
openclaw:
|
|
10
10
|
requires:
|
|
11
11
|
env:
|
|
@@ -40,13 +40,15 @@ Follow and unfollow accounts as a connected user, and check follow state.
|
|
|
40
40
|
| GET /x/followers/check?source=<a>&target=<b> | Does A follow B? | Read tier |
|
|
41
41
|
|
|
42
42
|
Base URL: `https://xquik.com/api/v1`. Auth: `x-api-key: xq_...` header.
|
|
43
|
+
Every follow or unfollow needs a unique `Idempotency-Key` header.
|
|
44
|
+
Direct REST callers supply it. Hosted MCP injects it automatically.
|
|
43
45
|
|
|
44
46
|
## Quick reference
|
|
45
47
|
|
|
46
48
|
```
|
|
47
49
|
POST /x/users/{id}/follow
|
|
48
50
|
{ "account": "<connected_username>" }
|
|
49
|
-
->
|
|
51
|
+
-> XWriteAction (HTTP 200 terminal or HTTP 202 accepted)
|
|
50
52
|
|
|
51
53
|
DELETE /x/users/{id}/follow
|
|
52
54
|
{ "account": "<connected_username>" }
|
|
@@ -59,11 +61,14 @@ For follow/unfollow, `{id}` is the numeric user ID. Resolve a @handle with `GET
|
|
|
59
61
|
1. `GET /x/accounts` to pick the acting account.
|
|
60
62
|
2. `GET /x/users/{id}` to resolve each target handle to a numeric `id`.
|
|
61
63
|
3. Show the user the target handle and the acting account. Wait for approval.
|
|
62
|
-
4.
|
|
64
|
+
4. Send the write. Direct REST supplies the key. Hosted MCP injects it.
|
|
65
|
+
5. Poll `statusUrl` after a `202` response until `terminal` is true.
|
|
63
66
|
|
|
64
67
|
## Bulk operations
|
|
65
68
|
|
|
66
|
-
If the user asks to follow or unfollow many accounts at once, list every target
|
|
69
|
+
If the user asks to follow or unfollow many accounts at once, list every target
|
|
70
|
+
first and require explicit confirmation for the full list. Process serially.
|
|
71
|
+
Honor `Retry-After` when returned. Never silently batch.
|
|
67
72
|
|
|
68
73
|
Hard no:
|
|
69
74
|
- Mass-following random accounts based on a scrape
|
|
@@ -5,7 +5,7 @@ license: MIT
|
|
|
5
5
|
metadata:
|
|
6
6
|
internal: true
|
|
7
7
|
author: Xquik
|
|
8
|
-
version: "2.6.
|
|
8
|
+
version: "2.6.2"
|
|
9
9
|
openclaw:
|
|
10
10
|
requires:
|
|
11
11
|
env:
|
|
@@ -44,7 +44,9 @@ Base URL: `https://xquik.com/api/v1`. Auth: `x-api-key: xq_...` header.
|
|
|
44
44
|
|
|
45
45
|
1. Ask the user for their handle.
|
|
46
46
|
2. `GET /x/users/{id}` to resolve to a numeric `id` and capture the baseline follower count.
|
|
47
|
-
3. Page `GET /x/users/{id}/tweets?cursor
|
|
47
|
+
3. Page `GET /x/users/{id}/tweets?pageSize=100&cursor=<>`. Use
|
|
48
|
+
`includeReplies`, `includeRetweets`, or other documented filters as needed.
|
|
49
|
+
Stop only when `has_next_page` is false or 100 rows are collected.
|
|
48
50
|
4. Compute: average engagement rate, best-performing format, best day/time, ratio of replies-to-posts-to-threads.
|
|
49
51
|
5. Call `/styles/{id}/performance` for a server-side breakdown.
|
|
50
52
|
6. Present 3-5 concrete recommendations (e.g., "Your threads get 4x the engagement of single tweets. Post 1-2 threads per week.").
|