Description
Summary: Sends template-based messages to one or more recipients via the TextPeak Streams API. Details: This endpoint allows you to send messages using a predefined message template with dynamic variable substitution. Instead of providing raw message content, you supply a message_template string containing placeholders and a template_variables object per recipient that maps placeholder names to their values. This is ideal for bulk personalized messaging such as OTP codes, welcome messages, or notifications where the message structure is consistent but individual values differ. Authentication is performed via a stream token passed in the Authorization header.
Authentication & Scopes
Authentication is handled via a stream token provided in the Authorization header. No OAuth scopes are defined; access is granted or denied based on the validity of the token.
| Method | Details |
|---|---|
| Stream Token | Pass your token directly in the Authorization header value (not as a Bearer token). |
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | The stream token that verifies your access to the API. |
Content-Type | Yes | Must be set to application/json. The API only accepts JSON-formatted request bodies. |
Parameters
This endpoint does not use path or query parameters.
Request Body
The request body is a JSON object containing a sender, a message template, and an array of recipients with their personalized template variables.
Top Level:
| Field | Type | Required | Description |
|---|---|---|---|
sender | string | Yes | The sender's identifier. Can be a name, phone number, or any other identifier. |
message_template | string | Yes | The message template string containing placeholders for dynamic variable substitution (e.g., "Hello {{first_name}}, your code is {{code}}"). |
recipients | array[object] | Yes | An array of recipient objects, each containing contact details and template variable values. |
Recipient Object:
| Field | Type | Required | Description |
|---|---|---|---|
internal_id | string | Yes | A unique identifier for the message, used for tracking and deduplication. |
recipient_phone | string | Yes | The phone number of the message recipient, in international format (e.g., "972524265292"). |
template_variables | object | Yes | A key-value map of template placeholder names to their substitution values for this recipient (e.g., {"first_name": "John", "code": "1234"}). |
Examples
This endpoint has a saved example demonstrating usage:
- template_send - SMS — Sending a template-based message via SMS channel.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||