Skip to main content
These examples use bearer auth for readability. Use HMAC signing when a request should be signed instead of carrying the secret directly.

Send a first message

curl https://console.trychert.com/api/v1/send \
  -H "Authorization: Bearer $CHERT_SIGNING_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"phone":"+14155551234","body":"Hi Sam - got a minute?"}'

Create a chat, then follow up

CHAT_ID=$(
  curl -s https://console.trychert.com/api/v1/chats \
    -H "Authorization: Bearer $CHERT_SIGNING_SECRET" \
    -H "Content-Type: application/json" \
    -d '{
      "from": "+15555550100",
      "to": ["+14155551234"],
      "message": {
        "parts": [{ "type": "text", "value": "Hi Sam - got a minute?" }]
      }
    }' | jq -r '.chat.id'
)

curl -X POST "https://console.trychert.com/api/v1/chats/$CHAT_ID/messages" \
  -H "Authorization: Bearer $CHERT_SIGNING_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "message": {
      "parts": [{ "type": "text", "value": "Following up here." }]
    }
  }'
The rich_link part shape is the same on every Chert sender line.
curl -X POST "https://console.trychert.com/api/v1/chats/$CHAT_ID/messages" \
  -H "Authorization: Bearer $CHERT_SIGNING_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "message": {
      "parts": [
        { "type": "text", "value": "Here is the review link." },
        { "type": "rich_link", "url": "https://example.com/review" }
      ]
    }
  }'
Use this follow-up endpoint for existing DMs and groups. For a new group, create the group with text first, then send this message after you have the chat.id.
curl -X POST "https://console.trychert.com/api/v1/chats/$CHAT_ID/messages" \
  -H "Authorization: Bearer $CHERT_SIGNING_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "message": {
      "parts": [
        { "type": "media", "attachment_id": "att_review_image" },
        { "type": "text", "value": "Hi Marcus, this is Todd from Texas Prime Plumbing. I would really appreciate a Google review." },
        { "type": "rich_link", "url": "https://search.google.com/local/writereview?placeid=..." }
      ]
    }
  }'

Upload and send a file

UPLOAD=$(
  curl -s https://console.trychert.com/api/v1/attachments \
    -H "Authorization: Bearer $CHERT_SIGNING_SECRET" \
    -H "Content-Type: application/json" \
    -d '{"filename":"invoice.pdf","content_type":"application/pdf","size_bytes":204800}'
)

UPLOAD_URL=$(echo "$UPLOAD" | jq -r '.upload_url')
ATTACHMENT_ID=$(echo "$UPLOAD" | jq -r '.attachment_id')

curl -X PUT "$UPLOAD_URL" \
  -H "Authorization: Bearer $CHERT_SIGNING_SECRET" \
  -H "Content-Type: application/pdf" \
  --data-binary @invoice.pdf

curl -X POST "https://console.trychert.com/api/v1/chats/CHAT_ID/messages" \
  -H "Authorization: Bearer YOUR_SIGNING_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "message": {
      "parts": [
        { "type": "text",  "value": "See attached." },
        { "type": "media", "attachment_id": "att_abc..." }
      ]
    }
  }'

Send multiple images

Upload multiple images, then request grouped delivery from an existing chat.
curl -X POST "https://console.trychert.com/api/v1/chats/$CHAT_ID/messages" \
  -H "Authorization: Bearer $CHERT_SIGNING_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "parallel_attachments": true,
    "message": {
      "parts": [
        { "type": "media", "attachment_id": "att_photo_1" },
        { "type": "media", "attachment_id": "att_photo_2" },
        { "type": "media", "attachment_id": "att_photo_3" },
        { "type": "media", "attachment_id": "att_photo_4" }
      ]
    }
  }'

Stream replies while developing

curl -N https://console.trychert.com/api/v1/events/stream \
  -H "Authorization: Bearer $CHERT_SIGNING_SECRET"
For production, create a webhook subscription and listen for message.received.
curl -X POST https://console.trychert.com/api/v1/webhook-subscriptions \
  -H "Authorization: Bearer $CHERT_SIGNING_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-app.example/webhooks/chert",
    "events": ["message.received"]
  }'

React to a message

Use a message id from chat history or a message.received webhook.
curl -X POST "https://console.trychert.com/api/v1/messages/$MESSAGE_ID/react" \
  -H "Authorization: Bearer $CHERT_SIGNING_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"reaction":"like"}'