| Pattern | Best for | Real-time | Setup effort |
|---|---|---|---|
| Monitor & poll | Batch processing, dashboards, low-frequency checks | No (interval-based) | Low |
| Real-time webhooks | Instant notifications, event-driven pipelines | Yes | Medium |
| AI agent (MCP) | Natural language queries, conversational analysis | Yes | Low |
| Tweet composition | Algorithm-optimized drafts, content workflows | N/A | Low |
- Monitor & Poll
- Real-Time Webhooks
- AI Agent (MCP)
- Tweet Composition
Monitor & poll
Create an API key, start monitoring an X account, then poll for events with pagination.Step 1: Create a monitor
curl -X POST https://xquik.com/api/v1/monitors \
-H "x-api-key: xq_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"username": "elonmusk",
"eventTypes": ["tweet.new", "tweet.reply", "tweet.quote"]
}' | jq
{
"id": "7",
"username": "elonmusk",
"xUserId": "44196397",
"eventTypes": ["tweet.new", "tweet.reply", "tweet.quote"],
"createdAt": "2026-02-24T10:30:00.000Z"
}
Step 2: Poll for events
Poll on an interval and paginate through all available events.# First page
curl "https://xquik.com/api/v1/events?monitorId=7&limit=50" \
-H "x-api-key: xq_YOUR_KEY_HERE" | jq
# Next page (use nextCursor from previous response)
curl "https://xquik.com/api/v1/events?monitorId=7&limit=50&after=MjAyNi0wMi0yNFQxNTowNTozMC4wMDBafDkwMDI=" \
-H "x-api-key: xq_YOUR_KEY_HERE" | jq
For real-time delivery without polling, use webhooks instead.
Real-time webhooks
Create a monitor, register a webhook endpoint, then verify signatures and process events as they arrive.Step 1: Create a monitor
Same as Step 1 above. You need at least 1 active monitor before events can be delivered.Step 2: Create a webhook
curl -X POST https://xquik.com/api/v1/webhooks \
-H "x-api-key: xq_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-server.com/webhook",
"eventTypes": ["tweet.new", "tweet.reply"]
}' | jq
The
secret is returned only once. Store it securely. You need it to verify signatures on incoming deliveries.Step 3: Handle & verify events
Build a webhook handler that verifies the HMAC signature before processing events.import express from "express";
import { createHmac, timingSafeEqual } from "node:crypto";
const app = express();
const WEBHOOK_SECRET = "your_webhook_secret_here";
function verifySignature(payload, signature, secret) {
const expected =
"sha256=" + createHmac("sha256", secret).update(payload).digest("hex");
return timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
}
app.post("/webhook", express.raw({ type: "application/json" }), (req, res) => {
const signature = req.headers["x-xquik-signature"];
const payload = req.body.toString();
if (!verifySignature(payload, signature, WEBHOOK_SECRET)) {
return res.status(401).send("Invalid signature");
}
const event = JSON.parse(payload);
switch (event.eventType) {
case "tweet.new":
console.log(`New tweet from @${event.username}: ${event.data.text}`);
break;
case "tweet.reply":
console.log(`Reply from @${event.username}: ${event.data.text}`);
break;
}
res.status(200).send("OK");
});
app.listen(3000, () => console.log("Webhook server running on :3000"));
We recommend responding within 10 seconds. If your handler is slow, acknowledge the delivery immediately and process the event asynchronously.
AI agent integration
Connect an AI agent to Xquik via the MCP server, then use natural language to monitor accounts and retrieve events. The MCP server uses a code-execution sandbox model where the agent writes async JavaScript functions.Step 1: Configure MCP
Connect your AI agent or IDE to the Xquik MCP server. See the MCP setup guide for configuration instructions for Claude Desktop, Claude Code, ChatGPT, Codex CLI, Cursor, VS Code, Windsurf, and OpenCode.Step 2: Search tweets
Ask your AI agent:“Search for tweets about TypeScript performance”The agent uses the
xquik tool to execute an API call:async () => {
return xquik.request('/api/v1/x/tweets/search', {
query: { q: 'TypeScript performance', limit: '20' }
});
}
{
"tweets": [
{
"id": "1893456789012345678",
"text": "TypeScript 6.0 compiler is 10x faster. The rewrite in Go was worth it.",
"author": {
"username": "typescript",
"name": "TypeScript"
},
"createdAt": "2026-02-24T14:22:00.000Z"
}
],
"has_next_page": false,
"next_cursor": ""
}
Step 3: Monitor a user
Ask your AI agent:“Monitor @typescript for new tweets and replies”The agent writes:
async () => {
return xquik.request('/api/v1/monitors', {
method: 'POST',
body: { username: 'typescript', eventTypes: ['tweet.new', 'tweet.reply'] }
});
}
{
"id": "12",
"username": "typescript",
"eventTypes": ["tweet.new", "tweet.reply"],
"createdAt": "2026-02-24T15:00:00.000Z"
}
Step 4: Get events
Ask your AI agent:“Show me the latest events from my monitors”
async () => {
return xquik.request('/api/v1/events', {
query: { limit: '10' }
});
}
{
"events": [
{
"id": "9010",
"type": "tweet.new",
"username": "typescript",
"monitorId": "12",
"data": { "text": "TypeScript 5.8 is out...", "tweetId": "1893710452812718080" },
"occurredAt": "2026-02-24T16:45:00.000Z"
}
],
"hasMore": false
}
Example prompts
Once connected, try these with your AI agent:- “Monitor @veraborovic for new tweets and quote tweets”
- “How many followers does @elonmusk have?”
- “Search for tweets mentioning xquik”
- “Show me all tweet.reply events from the last page”
- “Set up a webhook at https://my-server.com/events for new tweets”
- “Remove the monitor for @oldaccount”
- “List all my active webhooks”
Tweet composition
Compose algorithm-optimized tweets using a 3-step workflow: get algorithm knowledge, refine with preferences, then score the draft. All 3 steps are free and do not consume usage quota.Tweet composition is available through both the MCP server and the REST API (
POST /api/v1/compose). Use MCP for natural language workflows or the REST API for programmatic access.Step 1: Start composing
Ask your AI agent:“Help me compose a tweet about launching my new SaaS product, optimized for engagement”The agent uses the
xquik tool:async () => {
return xquik.request('/api/v1/compose', {
method: 'POST',
body: {
step: 'compose',
topic: 'launching my new SaaS product',
goal: 'engagement'
}
});
}
{
"contentRules": [{ "rule": "Keep under 280 characters" }, { "rule": "Front-load the hook in the first line" }],
"engagementMultipliers": [{ "action": "Reply-worthy content", "multiplier": "2x algorithmic boost" }],
"engagementVelocity": "High engagement in the first 30 minutes boosts reach significantly",
"followUpQuestions": [
"What tone do you want? (casual, professional, bold)",
"Will you attach media (photo, video, none)?",
"What call-to-action do you prefer? (reply, retweet, link click)"
],
"intentUrl": "https://x.com/intent/tweet?text=...",
"nextStep": "refine",
"scorerWeights": [{ "signal": "Replies", "weight": 1, "context": "Replies are the strongest ranking signal" }],
"source": "X algorithm analysis",
"topPenalties": ["External links reduce reach by ~50%", "Hashtag stuffing (3+) triggers spam filters"]
}
Step 2: Refine with preferences
After you answer the follow-up questions, the agent calls refine:async () => {
return xquik.request('/api/v1/compose', {
method: 'POST',
body: {
step: 'refine',
topic: 'launching my new SaaS product',
goal: 'engagement',
tone: 'casual',
hasMedia: true,
mediaType: 'photo',
callToAction: 'reply with your take'
}
});
}
{
"compositionGuidance": [
"Lead with a personal story or metric",
"End with an open question",
"Attach a product screenshot"
],
"examplePatterns": [
{ "description": "Surprising metric hook", "pattern": "Hook: surprising metric or confession → Context: 1-2 sentences → CTA: open question" },
{ "description": "Bold claim hook", "pattern": "Hook: bold claim → Evidence: screenshot or demo → CTA: 'What would you build?'" }
],
"intentUrl": "https://x.com/intent/tweet?text=...",
"nextStep": "score"
}
Step 3: Score the draft
Once the agent drafts a tweet, it scores the text:async () => {
return xquik.request('/api/v1/compose', {
method: 'POST',
body: {
step: 'score',
draft: 'Just shipped dark mode for our app.\n\nWhat do you think?',
hasMedia: true
}
});
}
{
"passed": false,
"passedCount": 9,
"totalChecks": 11,
"topSuggestion": "Add a specific detail or metric to the first line for a stronger hook.",
"nextStep": "done",
"checklist": [
{ "factor": "No external links in body", "passed": true },
{ "factor": "No hashtags", "passed": true },
{ "factor": "No excessive capitalization", "passed": true },
{ "factor": "Conversation-driving CTA", "passed": false, "suggestion": "End with a question or call to reply" },
{ "factor": "Optimal length (50-280 characters)", "passed": true },
{ "factor": "Media attached", "passed": true },
{ "factor": "No excessive punctuation", "passed": true },
{ "factor": "No emojis", "passed": true },
{ "factor": "No em dashes or double dashes", "passed": true },
{ "factor": "Sufficient substance", "passed": false, "suggestion": "Add a specific detail or metric" },
{ "factor": "Link-in-reply strategy", "passed": true }
]
}
Example prompts
Once connected via MCP, try these with your AI agent:- “Help me write a tweet about our product launch, optimized for engagement”
- “Compose a thread-starter tweet about TypeScript best practices”
- “Draft a tweet announcing our new feature, keep it casual”
- “Score this tweet: ‘We just hit 10k users. Here’s what we learned.’”
- “Analyze @username’s style and compose a tweet matching their voice”
All 3 composition steps are free and do not count toward your monthly usage quota. Iterate on your draft and re-score until all checks pass.
Public draw results
Completed giveaway draws have a public results page athttps://xquik.com/results/{drawId}. No authentication required. Share the URL with participants for transparency.
Create a Monitor
Start monitoring a user for real-time events.
Register a Webhook
Receive events on your server in real time.
MCP Server
Connection details and setup instructions.
Signature Verification
Verify webhook payloads with HMAC-SHA256.