Skip to content
PluginStats

@chat-adapter/x weekly downloads statistics

By chat-adapter (14 listings) · npm · AI SDKs

X (Twitter) adapter for Chat SDK: reply to mentions, send direct messages, and post from your bot account with the X API v2, plus encrypted XChat conversations from the @chat-adapter/x/chat subpath

View on npm Fresh · Dec 6, 2026

@chat-adapter/x has 131,808 recorded weekly downloads on npm, a decrease of 9.2% over the past 30 days, ranking #600 of 3,247 tracked listings.

Weekly downloads
131,808
Official API · Dec 5, 2026
7-day growth
+12.0%
+14.1K weekly downloads
30-day growth
-9.2%
-13.4K weekly downloads
90-day growth
+778%
+116.8K weekly downloads
Rank
#600
▼ 1 in 7 days

About @chat-adapter/x

X adapter for Chat SDK

@chat-adapter/x

npm package: @chat-adapter/x

Agent Stack MIT License

X (Twitter) adapter for Chat SDK, using the X API v2 and the X Activity API. Reply to public mentions, hold DM conversations, post from the bot account, and like posts.

Documentation: chat-sdk.dev/adapters/official/x · Guides: vercel.com/kb/chat-sdk

Installation

pnpm add @chat-adapter/x

Scaffold with the CLI

To scaffold a new X bot with this adapter preselected:

npx create-chat-sdk@latest my-bot --adapter x memory

Visit the adapters directory to see other available official and vendor-official adapters.

Usage

import { Chat } from "chat";
import { createXAdapter } from "@chat-adapter/x";

const bot = new Chat({
  userName: "mybot",
  adapters: {
    x: createXAdapter(),
  },
});

bot.onNewMention(async (thread, message) => {
  await thread.post(`Hi @${message.author.userName}!`);
});

bot.onDirectMessage(async (thread, message) => {
  await thread.post("Hello from X!");
});

When using createXAdapter() without arguments, credentials are auto-detected from environment variables.

X setup

1. Create an X app
  1. Go to the X developer portal and create a Project and App
  2. Under Keys and tokens, copy the API Key Secret (consumer secret): this becomes X_CONSUMER_SECRET
  3. Enable OAuth 2.0 user authentication with the scopes tweet.read, tweet.write, users.read, dm.read, dm.write, like.write, and offline.access
  4. Complete the OAuth 2.0 flow for the bot account. Either store the access token as X_USER_ACCESS_TOKEN, or store X_CLIENT_ID plus X_REFRESH_TOKEN to let the adapter manage token refresh
2. Register a webhook

X delivers events through the X Activity API. Set this up once in the X developer console, which handles the auth for you:

  1. Register your webhook URL (https://your-domain.com/api/webhooks/x). It must be public HTTPS without a port. X immediately sends a CRC challenge, which the adapter answers automatically
  2. Create subscriptions for the events the adapter consumes: post.mention.create, dm.received, and dm.sent (private events, so the bot user must have authorized your app first)

Subscription and webhook management is one-time setup, not adapter runtime. If you script it instead of using the console, the Activity API endpoints are auth-picky and operation-specific and do not fully match the published spec (creating a private-event subscription needed OAuth 1.0a user context in testing, while list and delete used the app-only bearer token), so the console is the simpler path.

3. Environment variables
X_CONSUMER_SECRET=...      # App API key secret, used for webhook CRC and signature verification

# Auth option A: static access token
X_USER_ACCESS_TOKEN=...    # OAuth 2.0 user-context access token for outbound calls

# Auth option B: managed OAuth refresh (recommended for long-running bots)
X_CLIENT_ID=...            # OAuth 2.0 client ID
X_REFRESH_TOKEN=...        # OAuth 2.0 refresh token (requires the offline.access scope)
X_CLIENT_SECRET=...        # Optional, only for confidential clients
X_ENCRYPTION_KEY=...       # Optional, base64 32-byte key to encrypt persisted tokens

X_USER_ID=...              # Bot account user ID. Optional if omitted it is fetched from /2/users/me; the adapter requires a resolvable bot id and fails init otherwise
X_USERNAME=...             # Optional, bot @handle for mention detection (fetched when omitted)
X_API_BASE_URL=...         # Optional, override the X API base URL
Token refresh

X OAuth 2.0 user tokens are short-lived (about two hours). With X_CLIENT_ID and X_REFRESH_TOKEN set, the adapter refreshes the access token before expiry and persists the rotated refresh token in your state adapter, so the bot survives restarts. Set X_ENCRYPTION_KEY to store those tokens AES-256-GCM encrypted.

Alternatively, pass a token provider and plug in your own refresh logic:

import { createXAdapter } from "@chat-adapter/x";

const adapter = createXAdapter({
  userAccessToken: async () => refreshTokenFromMyStore(),
});

Webhook setup

X uses two webhook mechanisms, both handled by the adapter:

  1. CRC challenge (GET): X sends a crc_token that the adapter answers with an HMAC-SHA256 response keyed by your consumer secret. X re-validates hourly
  2. Event delivery (POST): activity events signed via the x-twitter-webhooks-signature header, verified against the raw request body
// Next.js App Router example
import { bot } from "@/lib/bot";

export async function GET(request: Request) {
  return bot.webhooks.x(request);
}

export async function POST(request: Request) {
  return bot.webhooks.x(request);
}

Features

Messaging
FeatureSupported
Post messageYes (mention replies and DMs)
Top-level postsYes (channel.post on x:public)
Edit messagePosts only (X edit eligibility rules apply)
Delete messagePosts and own DM events
StreamingBuffered (accumulates then posts once)
Typing indicatorNo
Rich content…

Description from the npm listing.

  • chat
  • chat-sdk
  • chatbot
  • x
  • twitter
  • x-api
  • bot
  • adapter
  • messaging
  • ai-agent
  • ai-sdk
  • vercel
  • xchat

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

@chat-adapter/x weekly downloads on npm, last 90 days: 131,808 weekly downloads as of Dec 5, 2026, +778% over 90 days.@chat-adapter/xWeekly downloads on npm · Last 90 days131,808downloads / week+778% over 90 days020K40K60K80K100K120K140K160K180KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
@chat-adapter/x weekly downloads on npm, last 90 days: 131,808 weekly downloads as of Dec 5, 2026, +778% over 90 days.

7/30/90-day growth

@chat-adapter/x weekly downloads growth on npm: +12.0% over 7 days, -9.2% over 30 days, +778% over 90 days.@chat-adapter/xWeekly downloads growth on npm131,808downloads / week now7-day growth+14,096 weekly downloads+12.0%30-day growth-13,430 weekly downloads-9.2%90-day growth+116,794 weekly downloads+778%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
@chat-adapter/x weekly downloads growth on npm: +12.0% over 7 days, -9.2% over 30 days, +778% over 90 days.

Ranking history

@chat-adapter/x npm ranking history: currently #600 (by weekly downloads).@chat-adapter/xnpm ranking · by weekly downloads · Last 90 days#600current rank#540#560#580#600#620#640Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
@chat-adapter/x npm ranking history: currently #600 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 30, #20 (overall #600)
All npm: every listing in weekly downloads order

Listing placement

AI SDKs378 listings · 19 pages · page 2, #18 (overall #38)
AI SDKs: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (170)
Recent weekly downloads observations for @chat-adapter/x
Date (UTC)Weekly downloadsChange vs. previous
131,808+3.3K
128,548+16.1K
112,494+13.5K
98,974+161
98,813-4.9K
103,667-9.8K
113,513-4.2K
117,712-15.7K
133,396-17.2K
150,593-10.7K
161,282+5.1K
156,217+5.2K
151,037+8.5K
142,567—

Similar npm AI SDKs plugins

All 20 @chat-adapter/x alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/@chat-adapter/x. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.