コンテンツにスキップ
Twexapi
日本語
Esc
移動開く⌘Jプレビュー

DM送信 (XChat v3)

DM送信 (XChat v3).

POST/v3/twitter/send-dm
API 認証
AuthorizationBearer token · header必須
TwexAPIのグローバル認証トークン (Bearer Token)。ヘッダーに含める必要があります:Authorization: Bearer <YOUR_TWEXAPI_KEY>。
リクエストボディ
必須application/json
recipientstring必須
User id, @handle, or a group id (g...) for an existing group.
textstring必須
メッセージ本文
media_urlsstring[] | any
添付する画像または動画の公開URL一覧(最大4枚の画像または1本の動画)
プロパティを表示
Any of:
string[]
Array of string
string
any
any
video_urlstring | any
Public http(s) URL of one video to attach (mutually exclusive with image).
プロパティを表示
Any of:
string
string
any
any
pinstring | any
Identity PIN (default 1234).
default: "1234"
プロパティを表示
Any of:
string
string
any
any
cookiestring必須
ユーザー自身が承認した Twitter セッション資格情報または auth_token(BYOC — Bring Your Own Cookie)。機密情報は保存されず、完全なステートレスプロキシとして実行されます。詳細は [認証・セキュリティガイド](/ja/authentication#write-operations--byoc-bring-your-own-cookie) および [Cookie 取得手順](https://youtube-promotion.pages.dev/how-to-get-twitter-cookie) を参照。
proxystring | any
Optional HTTP proxy. Example: http://username:password@ip:port
プロパティを表示
Any of:
string
string
any
any
レスポンス
200A message object.
codeinteger必須
HTTP ステータスコード(200 は成功)
msgstring必須
レスポンスメッセージ(例: 'success')
dataMessageModel | any必須
返却されるコアデータオブジェクトまたは配列
プロパティを表示
Any of:
MessageModel
idstring必須
Message ID
textstring必須
メッセージ本文
timestring必須
Message time
attachmentobject | any
Message attachment
プロパティを表示
Any of:
object
object
any
any
attachmentsobject[] | any
XChat media attachments (v3).
プロパティを表示
Any of:
object[]
Array of object
object
any
any
sequence_idstring | any
XChat sequence id. Use the oldest message's sequence_id as before for pagination.
プロパティを表示
Any of:
string
string
any
any
sender_idstring | any
Sender ID
プロパティを表示
Any of:
string
string
any
any
recipient_idstring | any
送信先相手のTwitterユーザーID
プロパティを表示
Any of:
string
string
any
any
any
any
422パラメータバリデーションエラー
detailValidationError[]
プロパティを表示
Array of ValidationError
locstring | integer[]必須
プロパティを表示
Array of string | integer
Any of:
string
string
integer
integer
msgstring必須
レスポンスメッセージ(例: 'success')
typestring必須
inputany
ctxobject
インタラクティブテストPOST
インタラクティブテスト / Try APIPOST
Live Console
🌐対象サーバー:https://api.twexapi.io
● 本番環境レディ
✍️
書き込み操作の認証情報ガイド(TwexAPIキー + Twitter Cookie)

1. TwexAPIプラットフォームキー (Bearer Token): 下記の「API認証」に入力してください(API呼び出しと課金認証に使用)。

2. TwitterアカウントCookie: ツイート・いいね・フォロー等の書き込み操作のため、下記リクエストボディの cookie フィールドに対象TwitterアカウントのCookie(例: auth_token=...; ct0=...)を入力してください。

🔑API 認証
📝リクエストボディapplication/json
📡
暂无响应数据

请在「请求配置」中确认参数后,点击底部的「发送请求」按钮。

リクエスト例
curl -X POST "https://api.twexapi.io/v3/twitter/send-dm" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "recipient": "baker_donn80196",
  "text": "hello from docs",
  "media_urls": [
    "https://example.com/image.jpg"
  ],
  "video_url": "https://video.twimg.com/amplify_video/2077160248830275584/vid/avc1/320x568/kwNDLTm",
  "pin": "1234",
  "cookie": "ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7",
  "proxy": "http://username:password@ip:port"
}'
レスポンス例
{
  "code": 200,
  "msg": "success",
  "data": {
    "attachment": {
      "type": "image",
      "url": "https://example.com/image.jpg"
    },
    "id": "1234567890123456789",
    "text": "Hello, how are you?",
    "time": "2024-01-01T12:00:00Z"
  }
}