Send a direct message to a user on X using your connected account.
Overview
The Send DM endpoint allows you to send a direct message to any X user by their user ID. Use Lookup User first if you only have a username.
Requires X Pro tier. DM sending requires a Pro-level X account connected to Trigify.
Authentication
Requires a valid API key with a connected X account (Pro tier).
curl -X POST https://api.trigify.io/v1/x/send-dm \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"user_id": "44196397",
"text": "Hey, loved your recent thread on AI agents!"
}'
| Field | Type | Description |
|---|
user_id | string | Required. The numeric user ID of the recipient |
text | string | Required. The message text (max 10,000 characters) |
Workflow Example: Lookup + DM
Chain Lookup User with Send DM to message someone by username:
// Look up user ID
const lookup = await fetch("https://api.trigify.io/v1/x/lookup-user", {
method: "POST",
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({ username: "trigaborter" }),
});
const { user_id } = await lookup.json();
// Send DM
const dm = await fetch("https://api.trigify.io/v1/x/send-dm", {
method: "POST",
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
user_id,
text: "Hey! Just came across your profile.",
}),
});
Credit Usage
This endpoint charges 2 credits per DM sent.
Notes
- The recipient must have DMs open, or you must be following each other
- Requires an X Pro tier account