Send Message

Send a message to a contact via SMS, email, WhatsApp, Facebook, or Instagram — manually or AI-generated.

POST

Send Message

Deliver a message to a contact over any supported channel. Set ai: true to have an AI agent generate the reply instead of sending your text as-is.

Endpoint

POST https://crmwebhook.com/functions/v1/crm-api/send-message

Headers

HeaderValueRequired
x-api-keycfy_your_api_keyYes
Content-Typeapplication/jsonYes

Request Body

{
  "content": "Hi Jane! Just checking in on your quote.",
  "ai": false,
  "conversation_id": "conv_abc123",
  "channel": "sms"
}

Body Parameters

FieldTypeRequiredDescription
contentstringRequiredMessage text, or AI prompt when ai=true
aibooleanRequiredfalse = send content as-is, true = AI generates the reply
conversation_idstring (UUID)RequiredConversation to send in
channelstringRequiredOne of: sms, email, whatsapp, facebook, instagram
agent_idstring (UUID)ConditionalAgent to generate the reply. Required when ai=true. Must be active and in the same sub-account.
message_idstringOptionalInbound message ID being replied to (stored in metadata)

Example — Manual Message

curl -X POST \
  https://crmwebhook.com/functions/v1/crm-api/send-message \
  -H "x-api-key: cfy_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Hi Jane! Just checking in on your quote.",
    "ai": false,
    "conversation_id": "conv_abc123",
    "channel": "sms"
  }'

Example — AI-Generated Reply

curl -X POST \
  https://crmwebhook.com/functions/v1/crm-api/send-message \
  -H "x-api-key: cfy_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Ask the customer if they are free for a callback this afternoon.",
    "ai": true,
    "agent_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "conversation_id": "conv_abc123",
    "channel": "whatsapp"
  }'

Response Shape

{
  "message_id": "msg_001",
  "content": "Hi Jane, are you free for a quick callback this afternoon?",
  "sender_type": "agent",
  "channel": "whatsapp",
  "ai": true,
  "delivered": true,
  "timestamp": "2026-04-20T11:42:03.000Z"
}

Response Fields

FieldTypeDescription
message_idstringUnique message identifier
contentstringThe message content that was delivered
sender_typestringWho sent the message (e.g., “agent”)
channelstringChannel used for delivery
aibooleanWhether the message was AI-generated
deliveredbooleanWhether delivery succeeded
timestampstringISO 8601 delivery timestamp

Response Codes

StatusMeaning
200Message delivered and stored
400Missing required field, invalid channel, or missing agent_id when ai=true
401Invalid API key
404Conversation not found, or agent not in this sub-account
500Message delivery failed
502AI chatbot unreachable (when ai=true)
© 2026 Centerfy AI. All rights reserved.