LetsBot Μενού
Ξεκινήστε Ελληνικά Γλώσσα

Meta Business Partner Εταιρεία εγγεγραμμένη στο Ηνωμένο Βασίλειο

Γλώσσα

Templates (Official API) · Endpoint API

POST /api/v1/template/send Νέο

Send Template Message (Full Featured)

Send any WhatsApp template message with full component support.

Send any WhatsApp template message with full component support.

Supports:

  • Header: text, image, document, video, location
  • Body: text parameters (variables)
  • Buttons: URL buttons, Quick Reply buttons

Example for added_to_course template:

  • Header with confirmation title
  • Body with customer name and course name
  • URL buttons for iOS and Android app download

Σώμα JSON

{
  "phone": "{{phone}}",
  "template_name": "added_to_course",
  "template_language": "ar",
  "components": {
    "header": {
      "type": "text",
      "parameters": [
        {"type": "text", "text": "تأكيد التسجيل"}
      ]
    },
    "body": [
      "أحمد",
      "دورة البرمجة المتقدمة"
    ],
    "buttons": [
      {
        "index": 0,
        "sub_type": "url",
        "parameters": [{"type": "text", "text": "app/course/123"}]
      },
      {
        "index": 1,
        "sub_type": "url",
        "parameters": [{"type": "text", "text": "store/app/456"}]
      }
    ]
  }
}

Παράδειγμα αιτήματος

curl -X POST "https://letsbot.net/api/v1/template/send" \
  -H "Authorization: Bearer YOUR_LB_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
  "phone": "9665xxxxxxxx",
  "template_name": "added_to_course",
  "template_language": "ar",
  "components": {
    "header": {
      "type": "text",
      "parameters": [
        {"type": "text", "text": "تأكيد التسجيل"}
      ]
    },
    "body": [
      "أحمد",
      "دورة البرمجة المتقدمة"
    ],
    "buttons": [
      {
        "index": 0,
        "sub_type": "url",
        "parameters": [{"type": "text", "text": "app/course/123"}]
      },
      {
        "index": 1,
        "sub_type": "url",
        "parameters": [{"type": "text", "text": "store/app/456"}]
      }
    ]
  }
}'
const response = await fetch("https://letsbot.net/api/v1/template/send", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_LB_API_KEY",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "phone": "9665xxxxxxxx",
    "template_name": "added_to_course",
    "template_language": "ar",
    "components": {
      "header": {
        "type": "text",
        "parameters": [
          {
            "type": "text",
            "text": "تأكيد التسجيل"
          }
        ]
      },
      "body": [
        "أحمد",
        "دورة البرمجة المتقدمة"
      ],
      "buttons": [
        {
          "index": 0,
          "sub_type": "url",
          "parameters": [
            {
              "type": "text",
              "text": "app/course/123"
            }
          ]
        },
        {
          "index": 1,
          "sub_type": "url",
          "parameters": [
            {
              "type": "text",
              "text": "store/app/456"
            }
          ]
        }
      ]
    }
  }),
});

const data = await response.json();
console.log(data);
<?php

$ch = curl_init('https://letsbot.net/api/v1/template/send');

curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer YOUR_LB_API_KEY',
        'Accept: application/json',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => <<<'JSON'
    {
        "phone": "9665xxxxxxxx",
        "template_name": "added_to_course",
        "template_language": "ar",
        "components": {
            "header": {
                "type": "text",
                "parameters": [
                    {
                        "type": "text",
                        "text": "تأكيد التسجيل"
                    }
                ]
            },
            "body": [
                "أحمد",
                "دورة البرمجة المتقدمة"
            ],
            "buttons": [
                {
                    "index": 0,
                    "sub_type": "url",
                    "parameters": [
                        {
                            "type": "text",
                            "text": "app/course/123"
                        }
                    ]
                },
                {
                    "index": 1,
                    "sub_type": "url",
                    "parameters": [
                        {
                            "type": "text",
                            "text": "store/app/456"
                        }
                    ]
                }
            ]
        }
    }
    JSON,
]);

$data = json_decode(curl_exec($ch), true);
curl_close($ch);

print_r($data);
import requests

response = requests.request(
    "POST",
    "https://letsbot.net/api/v1/template/send",
    headers={
        "Authorization": "Bearer YOUR_LB_API_KEY",
        "Accept": "application/json",
        "Content-Type": "application/json",
    },
    json={
        "phone": "9665xxxxxxxx",
        "template_name": "added_to_course",
        "template_language": "ar",
        "components": {
            "header": {
                "type": "text",
                "parameters": [
                    {
                        "type": "text",
                        "text": "تأكيد التسجيل",
                    },
                ],
            },
            "body": [
                "أحمد",
                "دورة البرمجة المتقدمة",
            ],
            "buttons": [
                {
                    "index": 0,
                    "sub_type": "url",
                    "parameters": [
                        {
                            "type": "text",
                            "text": "app/course/123",
                        },
                    ],
                },
                {
                    "index": 1,
                    "sub_type": "url",
                    "parameters": [
                        {
                            "type": "text",
                            "text": "store/app/456",
                        },
                    ],
                },
            ],
        },
    },
)

print(response.json())

Απαντήσεις

Success Response200
{
  "success": true,
  "message": "The message has been successfully sent.",
  "data": {
    "key": {
      "remoteJid": "966500000000@s.whatsapp.net",
      "fromMe": true,
      "id": "wamid.HBgLMTIzNDU2Nzg5MBUTQ"
    },
    "messageTimestamp": 1706900000,
    "status": "PENDING"
  }
}

Έτοιμοι όποτε είστε κι εσείς

Δοκιμάστε αυτό το endpoint με τον δικό σας αριθμό

Το API λειτουργεί κατά τη δωρεάν δοκιμή. Δημιουργήστε λογαριασμό, συνδέστε τον αριθμό WhatsApp σας και αντιγράψτε το κλειδί σας από API → Δεδομένα ταυτοποίησης.