Aller au contenu
Twexapi
Français
Esc
naviguerouvrir⌘Japerçu

Envoyer un DM (XChat v3)

Envoyer un DM (XChat v3).

POST/v3/twitter/send-dm
Autorisation API
AuthorizationBearer token · headerrequis
Jeton Bearer global pour TwexAPI. Inclus sous la forme : Authorization: Bearer <YOUR_TWEXAPI_KEY>.
Corps de la requête
requisapplication/json
recipientstringrequis
User id, @handle, or a group id (g...) for an existing group.
textstringrequis
Texte du message
media_urlsstring[] | any
URLs des médias joints (jusqu'à 4 photos ou 1 vidéo)
Afficher les propriétés
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).
Afficher les propriétés
Any of:
string
string
any
any
pinstring | any
Identity PIN (default 1234).
default: "1234"
Afficher les propriétés
Any of:
string
string
any
any
cookiestringrequis
Identifiants de session ou auth_token autorisés de l'utilisateur (BYOC — Bring Your Own Cookie). Exécution proxy sans état avec zéro rétention d'identifiants. Consultez [Sécurité et Authentification](/fr/authentication#write-operations--byoc-bring-your-own-cookie) et [Comment obtenir un Cookie](https://youtube-promotion.pages.dev/how-to-get-twitter-cookie).
proxystring | any
Optional HTTP proxy. Example: http://username:password@ip:port
Afficher les propriétés
Any of:
string
string
any
any
Réponses
200A message object.
codeintegerrequis
Code d'état HTTP (200 indique le succès)
msgstringrequis
Message de réponse (ex. 'success')
dataMessageModel | anyrequis
Données principales renvoyées par l'API
Afficher les propriétés
Any of:
MessageModel
idstringrequis
Message ID
textstringrequis
Texte du message
timestringrequis
Message time
attachmentobject | any
Message attachment
Afficher les propriétés
Any of:
object
object
any
any
attachmentsobject[] | any
XChat media attachments (v3).
Afficher les propriétés
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.
Afficher les propriétés
Any of:
string
string
any
any
sender_idstring | any
Sender ID
Afficher les propriétés
Any of:
string
string
any
any
recipient_idstring | any
ID du destinataire du message direct
Afficher les propriétés
Any of:
string
string
any
any
any
any
422Erreur de validation des paramètres
detailValidationError[]
Afficher les propriétés
Array of ValidationError
locstring | integer[]requis
Afficher les propriétés
Array of string | integer
Any of:
string
string
integer
integer
msgstringrequis
Message de réponse (ex. 'success')
typestringrequis
inputany
ctxobject
Console interactivePOST
Console interactive / Tester l'APIPOST
Live Console
🌐Serveur cible :https://api.twexapi.io
● Prêt pour la production
✍️
Guide d'identification d'écriture (Clé TwexAPI + Cookie Twitter)

1. Clé TwexAPI (Bearer Token) : À renseigner sous "Autorisation API" ci-dessous pour la facturation et l'authentification.

2. Cookie Twitter : Pour les opérations d'écriture (tweet, like, etc.), renseignez le Cookie Twitter (ex : auth_token=...; ct0=...) dans le champ cookie ci-dessous.

🔑Autorisation API
📝Corps de la requêteapplication/json
📡
暂无响应数据

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

Requête
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"
}'
Réponse
{
  "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"
  }
}