πŸ’¬ SalesByte

Templates

List templates and send them to a phone number via the API.

List templates

GET /api/v1/templates

Query parameters

ParamDescription
statusFilter by status (APPROVED, PENDING, REJECTED)
channelbusiness or personal
curl "https://app.salesbyte.in/api/v1/templates?channel=business&status=APPROVED" \
  -H "Authorization: Bearer YOUR_API_KEY"

Each template includes its status, rejection_reason, updated_at, the full WhatsApp components, and a ready-to-use summary β€” enough to show and send a template without parsing WhatsApp's format:

{
  "id": "template-uuid",
  "name": "test_policy_doc_link",
  "channel": "business",
  "category": "UTILITY",
  "status": "APPROVED",
  "summary": {
    "body": "Hi {{1}}, your policy document {{2}} is attached. Tap below to view your dashboard.",
    "header_type": "DOCUMENT",
    "header_text": null,
    "footer": "Incremint",
    "variable_count": 2,
    "named_placeholders": [],
    "buttons": [{ "type": "URL", "text": "View dashboard", "url": "https://team.incremint.in/{{1}}" }],
    "send_requires": ["header_url (optional β€” defaults to the saved sample)", "button_values"]
  }
}

variable_count is how many values to pass in variables; send_requires lists any extra fields a send needs.


Send a template

POST /api/v1/templates/:id/send

Send an approved template to a phone number, with variable substitution. :id is the template's id from GET /api/v1/templates, or its name (e.g. /api/v1/templates/order_update/send). If a name exists in more than one language, also pass language (e.g. "en") or use the id.

Request body

{
  "to": "+919876543210",
  "variables": ["Rahul", "Order #1234", "tomorrow"]
}

Parameters

FieldTypeRequiredDescription
tostringβœ…Recipient phone number with country code
variablesstring[]❌Values for {{1}}, {{2}}, etc. in order
languagestring❌Only when sending by name and the template exists in several languages, e.g. "en" or "hi".
contact_namestring❌Sets/updates the recipient contact's name, used to resolve {{name}}. Omit to leave the existing name untouched.
contact_companystring❌Sets/updates the recipient contact's company, used to resolve {{company}}. Omit to leave untouched.
custom_fieldsobject❌Sets/updates custom field values on the recipient contact, used to resolve a matching {{field_key}} placeholder (e.g. {{bni_date}}). Keys must match the field_key values defined in your workspace's Custom Fields settings β€” not the field's display label. Merged into the contact's existing custom fields; omitted keys are left untouched.
connection_idstring❌Which number to send from (alias: from), from GET /api/v1/connections. Personal templates need a Personal number and Business templates a Business number. If omitted, a Personal template uses your API key's account (or the only connected one), and a Business template uses the number it was created on.
header_urlstring❌Business templates with a photo, video or PDF header. Public URL of the file to show for this send. Omit to use the sample file saved with the template.
header_filenamestring❌Business templates with a PDF header. The file name the customer sees.
button_valuesstring[]❌Business templates with a link button whose URL ends in {{1}} (e.g. https://example.com/track/{{1}}): the value for each such button, in order β€” e.g. ["order/1234"].

Business WhatsApp templates

Templates approved for Business WhatsApp (source: "meta" in GET /api/v1/templates) are sent from your Business number and can be sent at any time β€” unlike free-form messages, they aren't limited to the 24 hours after the customer's last message.

  • Pass exactly one value in variables for each {{1}}, {{2}}… in the template body.
  • For a template with a photo, video or PDF header, pass the file in header_url (and header_filename for a PDF) β€” for example a different invoice for each customer.
  • Buttons defined on the template are sent automatically.
  • Each send is charged to your wallet at the template's category rate (marketing, utility…).
curl -X POST https://app.salesbyte.in/api/v1/templates/template-uuid/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+919876543210",
    "variables": ["Rahul", "INV-1234"],
    "header_url": "https://example.com/invoices/INV-1234.pdf",
    "header_filename": "Invoice-INV-1234.pdf"
  }'

The response also includes "channel": "business" and the connection_id it was sent from.

Login / OTP (authentication) templates: pass the code as the first value in variables. It fills both the message and the Copy code (or one-tap) button β€” you don't send it twice.

curl -X POST https://app.salesbyte.in/api/v1/templates/template-uuid/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "to": "+919876543210", "variables": ["482913"] }'

Link button with a per-customer URL: if the template's button URL ends in {{1}} (for example https://example.com/track/{{1}}), pass the ending in button_values β€” one value per such button, in order:

curl -X POST https://app.salesbyte.in/api/v1/templates/template-uuid/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "to": "+919876543210", "variables": ["Rahul"], "button_values": ["order/1234"] }'

The customer's button then opens https://example.com/track/order/1234. If a required value is missing, the API returns 400 naming the button.

Named and custom-field placeholders

A template body can contain named placeholders like {{name}}, {{company}}, {{address_as}}, and any workspace custom field by its field_key, e.g. {{bni_date}}. These resolve from the recipient's contact record. See Variables & Personalisation for the full placeholder syntax, including fallback text ({{bni_date|TBD}}).

To set a custom field's value as part of the same send β€” rather than requiring it to already be on the contact β€” pass it in custom_fields:

curl -X POST https://app.salesbyte.in/api/v1/templates/template-uuid/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+919876543210",
    "custom_fields": {
      "bni_date": "15 Oct 2026",
      "bni_time": "9:00 AM"
    }
  }'

Example

curl -X POST https://app.salesbyte.in/api/v1/templates/template-uuid/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+919876543210",
    "variables": ["Rahul", "your order", "tomorrow at 3 PM"]
  }'

Response

{
  "success": true,
  "message_id": "3EB0A1B2C3D4E5",
  "text": "Hi Rahul, your order ships tomorrow at 3 PM."
}

text is the fully resolved message as sent β€” useful for confirming your variables and custom fields resolved as expected while testing.


Create a template

POST /api/v1/templates

Personal WhatsApp template

Ready to use immediately (no review). Supports a body and an optional media header.

{
  "name": "welcome_message",
  "body": "Hi {{name|there}}! Thanks for reaching out. We'll get back to you shortly."
}

Business WhatsApp template

Pass "channel": "business". The template is submitted to WhatsApp for approval and returns status PENDING; approval usually arrives within minutes to a few hours.

FieldDescription
nameLowercase letters, numbers and underscores
bodyThe message. Use {{1}}, {{2}}… for values filled at send time
categoryMARKETING (default), UTILITY or AUTHENTICATION
languagee.g. en (default), hi
variablesA sample for each {{n}}, for WhatsApp's review: [{ "name": "1", "sample": "Rahul" }]
header_typeTEXT, IMAGE, VIDEO or DOCUMENT
header_text / header_media_urlThe header text, or a sample file for a media header
footer_textSmall text at the bottom (max 60 characters)
buttonsUp to 10: QUICK_REPLY, URL (max 2) or PHONE_NUMBER (max 1) β€” see below
connection_idWhich Business number, if you have more than one

Link button with a per-customer URL: end the button's url with {{1}} and give an example β€” you'll pass the actual ending with button_values when sending.

{
  "name": "order_shipped",
  "channel": "business",
  "category": "UTILITY",
  "body": "Hi {{1}}, your order has shipped.",
  "variables": [{ "name": "1", "sample": "Rahul" }],
  "buttons": [
    { "type": "URL", "text": "Track order", "url": "https://example.com/track/{{1}}", "url_example": "https://example.com/track/order-1234" }
  ]
}

Login / OTP (authentication) template

WhatsApp writes the message itself β€” "<code> is your verification code." β€” with a Copy code button, so you don't pass a body, header, footer or buttons. Optional settings:

FieldDescription
add_security_recommendationAdds "For your security, do not share this code." Default true
code_expiration_minutesAdds "This code expires in N minutes." (1–90)
otp_button_textButton label, default Copy code
{
  "name": "login_otp",
  "channel": "business",
  "category": "AUTHENTICATION",
  "code_expiration_minutes": 10
}

Once approved, send it with POST /api/v1/templates/:id/send and "variables": ["482913"] β€” the code fills both the message and the Copy code button.

On this page