Skip to content
← Public packages

@kentcdodds/x

X API v2 helpers for tweets, search, legacy DMs, and encrypted X Chat via a Fly XDK sidecar.

src/get-chat-conversation.ts

21 lines · 885 B · TypeScript
import { getChatConversation } from './chat.ts'
import type { XGetChatConversationParams } from './types.ts'

/**
 * Read one encrypted X Chat thread as plaintext.
 *
 * Fetches ciphertext from api.x.com with the account OAuth token, then decrypts
 * through the Fly XDK sidecar using the existing X Chat PIN (xChatPin). Does
 * not generate a new Chat identity.
 *
 * @returns Decrypted messages for the conversation (ciphertext omitted).
 * @example
 * import getChatConversation from 'kody:@kentcdodds/x/get-chat-conversation'
 * const thread = await getChatConversation({ conversationId: '384666406-389681470', maxResults: 10 })
 * // => { conversationId: '...', data: [{ senderId: '...', text: '...', createdAt: '...' }] }
 */
export default async function getChatConversationEntrypoint(
  params: XGetChatConversationParams = {},
) {
  return await getChatConversation(params)
}