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
Header
Value
Required
x-api-key
cfy_your_api_key
Yes
Content-Type
application/json
Yes
Request Body
{ "content": "Hi Jane! Just checking in on your quote.", "ai": false, "conversation_id": "conv_abc123", "channel": "sms"}
Body Parameters
Field
Type
Required
Description
content
string
Required
Message text, or AI prompt when ai=true
ai
boolean
Required
false = send content as-is, true = AI generates the reply
conversation_id
string (UUID)
Required
Conversation to send in
channel
string
Required
One of: sms, email, whatsapp, facebook, instagram
agent_id
string (UUID)
Conditional
Agent to generate the reply. Required when ai=true. Must be active and in the same sub-account.
message_id
string
Optional
Inbound 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
Field
Type
Description
message_id
string
Unique message identifier
content
string
The message content that was delivered
sender_type
string
Who sent the message (e.g., “agent”)
channel
string
Channel used for delivery
ai
boolean
Whether the message was AI-generated
delivered
boolean
Whether delivery succeeded
timestamp
string
ISO 8601 delivery timestamp
Response Codes
Status
Meaning
200
Message delivered and stored
400
Missing required field, invalid channel, or missing agent_id when ai=true
401
Invalid API key
404
Conversation not found, or agent not in this sub-account