> ## Documentation Index
> Fetch the complete documentation index at: https://docs.whatsable.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Template Message

> Send a template-based message to users via their phone numbers



## OpenAPI

````yaml /openapi/notifier-system-api.json post /api:hFrjh8a1/send_template_message_by_api
openapi: 3.0.0
info:
  title: Notifyer System API
  description: >-
    Notifyer System API Documentation - A comprehensive API for sending WhatsApp
    messages and managing templates
  version: 1.0.0
servers:
  - url: https://api.insightssystem.com
    description: Notifyer System API
security: []
paths:
  /api:hFrjh8a1/send_template_message_by_api:
    post:
      tags:
        - Templates
      summary: Send Template Message
      description: Send a template-based message to users via their phone numbers
      operationId: sendTemplateMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateMessageRequest'
            examples:
              withVariablesAndMedia:
                value:
                  template: f10695a9-38d6-4f5f-8444-1f7bf52c6164
                  variables:
                    body1: Axel
                    body2: Shampoo
                    body3: $1
                    media: >-
                      https://drive.google.com/file/d/1D35uTbceRPmCgwxVfBJZ2yxD2lQgs0bi/view?usp=sharing
                    visit_website: '1'
                  phone_number: '+123476529999'
              singleVariable:
                value:
                  template: b65081ed-a0f6-4aaf-b148-31719b5bc567
                  variables:
                    body1: Edith Mireles
                  phone_number: '+123476529999'
      responses:
        '200':
          description: Message sent successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateMessageResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: cURL
          source: |-
            curl -X POST \
              'https://api.insightssystem.com/api:hFrjh8a1/send_template_message_by_api' \
              -H 'Content-Type: application/json' \
              -H 'Authorization: Bearer YOUR_API_KEY' \
              -d '{
                "template": "f10695a9-38d6-4f5f-8444-1f7bf52c6164",
                "variables": {
                  "body1": "Axel",
                  "body2": "Shampoo",
                  "body3": "$1",
                  "media": "https://drive.google.com/file/d/1D35uTbceRPmCgwxVfBJZ2yxD2lQgs0bi/view?usp=sharing"
                },
                "phone_number": "123476529999"
              }'
        - lang: JavaScript
          source: |-
            const fetch = require("node-fetch");

            async function sendMessage() {
              const response = await fetch(
                "https://api.insightssystem.com/api:hFrjh8a1/send_template_message_by_api",
                {
                  method: "POST",
                  headers: {
                    "Content-Type": "application/json",
                    Authorization: "Bearer YOUR_API_KEY",
                  },
                  body: JSON.stringify({
                    template: "f10695a9-38d6-4f5f-8444-1f7bf52c6164",
                    variables: {
                      body1: "Axel",
                      body2: "Shampoo",
                      body3: "$1",
                      media: "https://drive.google.com/file/d/1D35uTbceRPmCgwxVfBJZ2yxD2lQgs0bi/view?usp=sharing",
                    },
                    phone_number: "123476529999",
                  }),
                }
              );
              const data = await response.json();
              console.log(data);
            }

            sendMessage();
        - lang: Go
          source: |-
            package main

            import (
                "bytes"
                "encoding/json"
                "fmt"
                "net/http"
            )

            type RequestBody struct {
                Template    string            `json:"template"`
                Variables   map[string]string `json:"variables"`
                PhoneNumber string            `json:"phone_number"`
            }

            func main() {
                requestBody := RequestBody{
                    Template: "f10695a9-38d6-4f5f-8444-1f7bf52c6164",
                    Variables: map[string]string{
                        "body1": "Axel",
                        "body2": "Shampoo",
                        "body3": "$1",
                        "media": "https://drive.google.com/file/d/1D35uTbceRPmCgwxVfBJZ2yxD2lQgs0bi/view?usp=sharing"
                    },
                    PhoneNumber: "123476529999",
                }

                jsonData, _ := json.Marshal(requestBody)
                resp, err := http.Post("https://api.insightssystem.com/api:hFrjh8a1/send_template_message_by_api", "application/json", bytes.NewBuffer(jsonData))
                if err != nil {
                    fmt.Println("Error:", err)
                    return
                }
                defer resp.Body.Close()
                fmt.Println("Response Status:", resp.Status)
            }
components:
  schemas:
    TemplateMessageRequest:
      type: object
      required:
        - template
        - variables
        - phone_number
      properties:
        template:
          type: string
          format: uuid
          description: The unique template ID used for sending the message
        variables:
          type: object
          description: >-
            A JSON object containing dynamic placeholders for the message
            template. The keys should match the variables in your template.
            Common variable keys include:

            - body1, body2, body3: Text variables for message content

            - media: URL for image, video, or document attachments

            - visit_website: URL's parameter for the dynamic button link
          additionalProperties:
            type: string
            description: Value for the template variable
        phone_number:
          type: string
          description: >-
            The recipient's phone number in international format (e.g.,
            +123476529999)
    TemplateMessageResponse:
      type: object
      properties:
        success:
          type: boolean
          description: Indicates if the message was sent successfully
        whatsapp_response_info:
          type: object
          properties:
            contacts:
              type: array
              items:
                type: object
                properties:
                  input:
                    type: string
                    description: The input phone number
                  wa_id:
                    type: string
                    description: The WhatsApp ID
            messages:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    description: The WhatsApp message ID
                  message_status:
                    type: string
                    description: The status of the message
            messaging_product:
              type: string
              description: The messaging product (e.g., whatsapp)
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Error code
            message:
              type: string
              description: Error message
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Your Notifyer System API Token

````