Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { data, error } = await rewrite.messages.send({
to: '+5511999999999',
content: 'Rewrite: seu codigo e 478201',
tags: { flow: 'login', origin: 'checkout' },
});
if (error) throw error;{
"ok": true,
"data": {
"id": "748395130237498412",
"createdAt": "2026-03-20T14:22:31.562Z",
"analysis": {
"characters": 28,
"encoding": "gsm7",
"segments": {
"concat": 153,
"count": 1,
"reason": "fits",
"single": 160
}
},
"sandbox": false
}
}Messages
Send a message
Send one SMS with inline content or by rendering a saved template. You can target either a direct E.164 number in to or a saved project contact in contact. Projects with international numbers enabled can send beyond the default +55 traffic profile.
POST
/
messages
Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { data, error } = await rewrite.messages.send({
to: '+5511999999999',
content: 'Rewrite: seu codigo e 478201',
tags: { flow: 'login', origin: 'checkout' },
});
if (error) throw error;{
"ok": true,
"data": {
"id": "748395130237498412",
"createdAt": "2026-03-20T14:22:31.562Z",
"analysis": {
"characters": 28,
"encoding": "gsm7",
"segments": {
"concat": 153,
"count": 1,
"reason": "fits",
"single": 160
}
},
"sandbox": false
}
}Authorizations
Headers
Body
application/json
- With content and direct number
- With content and saved contact
- Using templates and direct number
- Using templates and saved contact