npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@redonvn/messaging-x

v1.0.0

Published

Enterprise X (Twitter) API v2 Direct Messages & Conversations SDK with CRC Challenge & x-twitter-webhooks-signature

Readme

@redai/messaging-x — Official X (Twitter) Direct Messages API v2 & Account Activity SDK

Enterprise TypeScript SDK cho nền tảng X (Twitter) thuộc hệ sinh thái RedAI Omnichat, được thiết kế theo kiến trúc Speakeasy 4-Layer và tương thích 100% với hợp đồng đa kênh IMessagingProvider.


Tính năng nổi bật

  • 6 Sub-SDKs chuyên biệt (46 phương thức):
    • client.messages: Gửi DM 1-1 (POST /2/dm_conversations/with/:participant_id/messages), gửi DM vào hội thoại (POST /2/dm_conversations/:dm_conversation_id/messages), tạo Group DM (POST /2/dm_conversations), Quick Replies (options), CTA Buttons (ctas), xóa DM (DELETE /2/dm_events/:event_id), Typing Indicator & Mark Read.
    • client.conversations: Bao phủ toàn bộ 4 GET DM v2 Endpoints (listAllDmEvents, getParticipantDmEvents, getConversationDmEvents, getDmEventById) và 8 phương thức quản trị Hội thoại Bài đăng / Bình luận công khai (/2/tweets: replyToTweet, postTweet, deleteTweet, hideReply, getConversationThread, getUserMentions, likeTweet, unlikeTweet).
    • client.media: Quy trình Chunked Media Upload chuẩn (INIT, APPEND, FINALIZE, STATUS) cho dm_image, dm_gif, dm_video, tweet_image, tweet_video kèm Alt Text (setMediaMetadata).
    • client.users: Tra cứu hồ sơ người dùng (/2/users/me, /2/users/:id, /2/users/by/username/:username) & Quản lý vòng đời OAuth 2.0 PKCE Token (exchangeCodeForToken, refreshOAuth2Token, revokeOAuth2Token).
    • client.subscriptions: Quản trị Account Activity Webhooks & User Subscriptions (registerWebhook, listWebhooks, triggerCrcCheck, deleteWebhook, subscribeAccountActivity, unsubscribeAccountActivity).
    • client.webhook: Xử lý GET CRC Challenge (crc_token $\rightarrow$ sha256=<base64>) định kỳ 24h, xác thực chữ ký x-twitter-webhooks-signature và chuẩn hóa 5 nhóm sự kiện Account Activity.

Cài đặt

pnpm add @redai/messaging-x @redai/messaging-common @redai/core

Khởi tạo nhanh

import { XMessagingClient } from '@redai/messaging-x';

const xClient = new XMessagingClient({
  accessToken: process.env.X_ACCESS_TOKEN!,
  consumerSecret: process.env.X_CONSUMER_SECRET!,
  clientId: process.env.X_CLIENT_ID,
  clientSecret: process.env.X_CLIENT_SECRET,
  webhookEnvName: 'production',
});

// Gửi tin nhắn DM 1-1
const res = await xClient.messages.sendTextToParticipant(
  '2244994945',
  'Xin chào từ RedAI Omnichat!'
);

Danh mục Tài liệu SDK