Description
Summary: Creates a new stream event template via the TextPeak API.
Details: This endpoint creates a new stream event template that defines a reusable event configuration for messaging streams. Stream event templates specify the event name, associated stream, message text, and a unique event key used to trigger the template programmatically. Templates can be created in an active or inactive state using the activated flag. Once created, the template can be referenced by other endpoints (e.g., WhatsApp template sending) to deliver structured messages to recipients. Authentication is performed via a TextPeak API key passed in the Authorization header.
Authentication & Scopes
Authentication is handled via a TextPeak API key provided in the Authorization header. No OAuth scopes are defined; access is granted or denied based on the validity of the API key.
| Method | Details |
|---|---|
| API Key | Pass your TextPeak API key directly in the Authorization header value. |
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Your TextPeak API key that authenticates the request. |
Content-Type | Yes | Must be set to application/json. The API only accepts JSON-formatted request bodies. |
accept | Yes | Must be set to application/json. Indicates that the client expects a JSON response. |
Parameters
This endpoint does not use path or query parameters.
Request Body
The request body is a JSON object defining the new stream event template.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | A human-readable name for the stream event template (e.g., "Welcome Message", "OTP Verification"). |
streamId | integer | Yes | The numeric ID of the stream this event template belongs to. Associates the template with a specific messaging stream. |
text | string | Yes | The message text content of the template. This is the default text that will be sent when the event is triggered. |
eventKey | string | Yes | A unique key used to identify and trigger this event template programmatically (e.g., "welcome_msg", "otp_verify"). |
activated | boolean | Yes | Whether the template is active and available for use. Set to true to enable or false to create in a disabled state. |
Examples
This endpoint has a saved example demonstrating usage:
- Create stream event template — Creating a new stream event template with a name, stream association, text content, event key, and activation status.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||