The job: direct messages on X, in and out, from your own code, under your own X app — so X bills the usage to you and every call acts as your account only.
1. Make the X app
On console.x.com, give the app Read and write and Direct message permissions and buy it credits. Then copy four keys from Keys and tokens: the API key and secret, and the access token and secret of the account you will write as — made after the permissions were set, or they will not carry them.
2. Connect once
curl -X PUT https://makehybrid.com/x/v1/connection \
-H "X-API-KEY: $MAKEHYBRID_KEY" -H "content-type: application/json" \
-d '{"api_key":"…","api_secret":"…","access_token":"…","access_secret":"…"}'
The keys are checked with X and kept sealed; they are never shown back. Connecting also tells X to send your account's messages here.
3. Send
curl -X POST https://makehybrid.com/x/v1/messages \
-H "X-API-KEY: $MAKEHYBRID_KEY" -H "content-type: application/json" \
-d '{"to":"@pat","text":"Thanks for reaching out!"}'
4. Hear replies
curl -X POST https://makehybrid.com/x/v1/webhooks/endpoints \
-H "X-API-KEY: $MAKEHYBRID_KEY" -H "content-type: application/json" \
-d '{"url":"https://acme.com/hooks/x","events":["x.message_received"]}'
X decides who may receive a message from your account. Someone who does not take messages from you answers with X's refusal, and no retry changes it.
Questions people ask
What about X Chat's encrypted messages?
Add your X Chat passcode as chat_pin when you connect, and messages in X Chat conversations are read and written encrypted. X allows only a few wrong passcodes, so a refused one is not tried again until you send a new one.
Is it the same connection as the X channel of a project room?
Yes. Connect it in either place and both have it.