Create Message Template
Create a new omni-channel message template with the Sinch Template Management API V2. Supports text, variables (${key}), and multiple language translations.
IMPORTANT: Execute this command directly. Do NOT generate script files. Perform the API call immediately.
Input
--description/-d: Template description - optional--default-language/-l: Default language code (e.g. en-US) - required--text/-t: Template text with optional ${variable} placeholders - required--variables/-v: Comma-separated variable names or JSON with key/preview_value - optional
Arguments: $ARGUMENTS
Instructions
Execute these steps directly - do not write code or scripts:
If $ARGUMENTS empty: ask for description, default language, template text, and variable names (if any). Otherwise parse.
Validate: --default-language (e.g. en-US), --text (non-empty). Parse --variables into array of {key, preview_value}. Build translations array with one item: language_code, variables, text_message.text.
Get CONVERSATION_* env vars. Template API: https://{region}.template.api.sinch.com. If missing, report "Sinch API is not configured."
Request body: description, default_translation (default language), translations: [{ language_code, variables: [{key, preview_value}], text_message: { text } }].
POST https://{region}.template.api.sinch.com/v2/projects/{projectId}/templates with OAuth2 and JSON body.
On success: "✅ Template created" with template id and version. Handle 400 (validation), 401 with clear messages.
Handle all errors gracefully.
Examples
/sinch-api-templates-create --default-language=en-US --text="Hello ${name}, your order ${order_id} is ready."
/sinch-api-templates-create -l en-US -t "Hi ${customer_name}!" -v name,customer_name -d "Welcome template"
API Reference
- Endpoint: POST /v2/projects/{project_id}/templates
- Documentation: https://developers.sinch.com/docs/conversation/templates/