Schedule a message
Schedule an AI-written follow-up: once scheduled_at passes, the agent writes a message from context and sends it to the contact through your connected messaging account. Messages are billed when sent.
POST
https://api.centerfy.ai/webhooks/inbound/scheduled-messages Headers
| Header | Required | Value | Description |
|---|---|---|---|
x-api-key | Yes | your sub-account API key (cfy_…) | Authenticates the request; or use Authorization: Bearer <key>. |
Body parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
agent_id | string (uuid) | Yes | — | Agent that will act; must be in this sub-account. |
contact_id | string (uuid) | Yes | — | Contact to reach; must be in this sub-account. |
scheduled_at | string (ISO 8601) | Yes | — | When to run, in the future, with a UTC offset or Z, e.g. 2026-10-08T14:00:00Z. |
context | string | Yes | — | What it’s about — the agent uses this to know what to say (max 4000 characters). |
preferred_channel | string | No | — | Channel to use when the contact’s conversation history doesn’t decide it. One of sms, email, whatsapp, instagram, facebook, live_chat. Otherwise SMS or email is used. |
Request body
{
"agent_id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
"contact_id": "3f1c2a9e-7b4d-4c8a-9e2f-1a2b3c4d5e6f",
"scheduled_at": "2026-10-08T14:00:00Z",
"context": "Remind them about tomorrow's appointment and ask them to confirm.",
"preferred_channel": "sms"
}Example
curl -X POST "https://api.centerfy.ai/webhooks/inbound/scheduled-messages" \
-H "x-api-key: $CENTERFY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
"contact_id": "3f1c2a9e-7b4d-4c8a-9e2f-1a2b3c4d5e6f",
"scheduled_at": "2026-10-08T14:00:00Z",
"context": "Remind them about tomorrow'\''s appointment and ask them to confirm.",
"preferred_channel": "sms"
}' import { CenterfyClient } from "@centerfy/sdk";
const centerfy = new CenterfyClient({ apiKey: process.env.CENTERFY_API_KEY! });
const result = await centerfy.scheduledMessages.create({
"agent_id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
"contact_id": "3f1c2a9e-7b4d-4c8a-9e2f-1a2b3c4d5e6f",
"scheduled_at": "2026-10-08T14:00:00Z",
"context": "Remind them about tomorrow's appointment and ask them to confirm.",
"preferred_channel": "sms"
});
console.log(result); centerfy scheduledMessages create '{"agent_id":"2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e","contact_id":"3f1c2a9e-7b4d-4c8a-9e2f-1a2b3c4d5e6f","scheduled_at":"2026-10-08T14:00:00Z","context":"Remind them about tomorrow'\''s appointment and ask them to confirm.","preferred_channel":"sms"}' MCP tool: centerfy_scheduled_messages_create (see MCP server)
Response
{
"status": "success",
"scheduled_message": {
"id": "9a0b1c2d-3e4f-4a5b-8c6d-7e8f9a0b1c2d",
"agent_id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
"contact_id": "3f1c2a9e-7b4d-4c8a-9e2f-1a2b3c4d5e6f",
"context": "Remind them about tomorrow's appointment and ask them to confirm.",
"preferred_channel": "sms",
"scheduled_at": "2026-10-08T14:00:00.000Z",
"status": "pending",
"last_error": null,
"sent_message": null,
"sent_channel": null,
"sent_at": null,
"created_at": "2026-10-06T09:00:00.000Z",
"updated_at": "2026-10-06T09:00:00.000Z"
}
}Errors
400— if context is missing or too long, scheduled_at is malformed or not in the future, an id isn’t a UUID, preferred_channel isn’t allowed, or the contact has neither a phone number nor an email.404— if the agent or contact is not in this sub-account.
Notes
Returns 201. The status moves pending → processing → completed or failed; after sending, sent_message, sent_channel and sent_at are filled in, and last_error explains a failure.