सामग्री पर जाएँ
मेनू

साइट में खोजें

गाइड, ब्लॉग, API और प्रोडक्ट में खोजने के लिए लिखें।

↑ ↓ से आगे-पीछे · Enter से खोलें · Esc से बंद करें

API रेफ़रेंस

API

टेम्पलेट

मंज़ूर हुए WhatsApp मैसेज टेम्पलेट की लिस्ट देखें और भेजें

Markdown के रूप में देखें

टेम्पलेट पहले से मंज़ूर WhatsApp मैसेज फ़ॉर्मेट हैं, जो 24 घंटे की मैसेजिंग विंडो के बाहर बातचीत शुरू करने के लिए ज़रूरी हैं। सिर्फ़ वही टेम्पलेट भेजे जा सकते हैं जिन्हें Meta ने मंज़ूरी दी है।

MethodPathविवरण
GET/v1/templatesList approved WhatsApp templates
GET/v1/templates/:idGet template detail
POST/v1/templates/:id/sendSend template to a contact
GET/v1/channels/:channel_id/templatesApproved templates of one WhatsApp line
GET/v1/campaigns/:key/executionsDelivery status per recipient (sends made with a campaign key)

टेम्पलेट की लिस्ट

GET/v1/templates
curl "https://rest-api.tbit.app/v1/templates" \
  -H "X-API-Key: $TBIT_API_KEY"
const response = await fetch('https://rest-api.tbit.app/v1/templates', {
  headers: {
    'X-API-Key': process.env.TBIT_API_KEY,
  },
});
const data = await response.json();
import axios from 'axios';

const { data } = await axios.get(
  'https://rest-api.tbit.app/v1/templates',
  {
    headers: {
      'X-API-Key': process.env.TBIT_API_KEY,
    },
  },
);
import os
import requests

response = requests.get(
    'https://rest-api.tbit.app/v1/templates',
    headers={'X-API-Key': os.environ['TBIT_API_KEY']},
)
data = response.json()
<?php
$ch = curl_init('https://rest-api.tbit.app/v1/templates');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'X-API-Key: ' . getenv('TBIT_API_KEY'),
    ],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);

टेम्पलेट का विवरण पाएँ

GET/v1/templates/tpl_abc123
curl "https://rest-api.tbit.app/v1/templates/tpl_abc123" \
  -H "X-API-Key: $TBIT_API_KEY"
const response = await fetch('https://rest-api.tbit.app/v1/templates/tpl_abc123', {
  headers: {
    'X-API-Key': process.env.TBIT_API_KEY,
  },
});
const data = await response.json();
import axios from 'axios';

const { data } = await axios.get(
  'https://rest-api.tbit.app/v1/templates/tpl_abc123',
  {
    headers: {
      'X-API-Key': process.env.TBIT_API_KEY,
    },
  },
);
import os
import requests

response = requests.get(
    'https://rest-api.tbit.app/v1/templates/tpl_abc123',
    headers={'X-API-Key': os.environ['TBIT_API_KEY']},
)
data = response.json()
<?php
$ch = curl_init('https://rest-api.tbit.app/v1/templates/tpl_abc123');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'X-API-Key: ' . getenv('TBIT_API_KEY'),
    ],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);

एक टेम्पलेट एक ही WhatsApp Business अकाउंट में मंज़ूर होता है, इसलिए कई लाइनों वाले एजेंट के पास हर लाइन का अपना टेम्पलेट सेट होता है। GET /v1/templates सभी लाइनों को मिलाकर दिखाता है (हर item के साथ उसका channel_id आता है); किसी एक लाइन से क्या भेजा जा सकता है, सिर्फ़ वह देखने के लिए यह endpoint इस्तेमाल करें। चैनल id वही है जो Platform → Channels में दिखता है।

GET/v1/channels/6a7268abec6ecaf999a6c0ba/templates
curl "https://rest-api.tbit.app/v1/channels/6a7268abec6ecaf999a6c0ba/templates" \
  -H "X-API-Key: $TBIT_API_KEY"
const response = await fetch('https://rest-api.tbit.app/v1/channels/6a7268abec6ecaf999a6c0ba/templates', {
  headers: {
    'X-API-Key': process.env.TBIT_API_KEY,
  },
});
const data = await response.json();
import axios from 'axios';

const { data } = await axios.get(
  'https://rest-api.tbit.app/v1/channels/6a7268abec6ecaf999a6c0ba/templates',
  {
    headers: {
      'X-API-Key': process.env.TBIT_API_KEY,
    },
  },
);
import os
import requests

response = requests.get(
    'https://rest-api.tbit.app/v1/channels/6a7268abec6ecaf999a6c0ba/templates',
    headers={'X-API-Key': os.environ['TBIT_API_KEY']},
)
data = response.json()
<?php
$ch = curl_init('https://rest-api.tbit.app/v1/channels/6a7268abec6ecaf999a6c0ba/templates');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'X-API-Key: ' . getenv('TBIT_API_KEY'),
    ],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);

टेम्पलेट भेजें

भेजने से जुड़ा नोट

components array, WhatsApp Business API के फ़ॉर्मेट को फ़ॉलो करता है। अपने टेम्पलेट की ज़रूरत के हिसाब से header, body और button components शामिल करें।

POST/v1/templates/tpl_abc123/send
curl -X POST "https://rest-api.tbit.app/v1/templates/tpl_abc123/send" \
  -H "X-API-Key: $TBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "573001234567",
    "components": [
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "John"
          },
          {
            "type": "text",
            "text": "your order #1234"
          }
        ]
      }
    ]
  }'
const response = await fetch('https://rest-api.tbit.app/v1/templates/tpl_abc123/send', {
  method: 'POST',
  headers: {
    'X-API-Key': process.env.TBIT_API_KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    to: '573001234567',
    components: [
      {
        type: 'body',
        parameters: [
          {
            type: 'text',
            text: 'John',
          },
          {
            type: 'text',
            text: 'your order #1234',
          },
        ],
      },
    ],
  }),
});
const data = await response.json();
import axios from 'axios';

const { data } = await axios.post(
  'https://rest-api.tbit.app/v1/templates/tpl_abc123/send',
  {
    to: '573001234567',
    components: [
      {
        type: 'body',
        parameters: [
          {
            type: 'text',
            text: 'John',
          },
          {
            type: 'text',
            text: 'your order #1234',
          },
        ],
      },
    ],
  },
  {
    headers: {
      'X-API-Key': process.env.TBIT_API_KEY,
    },
  },
);
import os
import requests

response = requests.post(
    'https://rest-api.tbit.app/v1/templates/tpl_abc123/send',
    headers={'X-API-Key': os.environ['TBIT_API_KEY']},
    json={
        'to': '573001234567',
        'components': [
            {
                'type': 'body',
                'parameters': [
                    {
                        'type': 'text',
                        'text': 'John',
                    },
                    {
                        'type': 'text',
                        'text': 'your order #1234',
                    },
                ],
            },
        ],
    },
)
data = response.json()
<?php
$ch = curl_init('https://rest-api.tbit.app/v1/templates/tpl_abc123/send');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'X-API-Key: ' . getenv('TBIT_API_KEY'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'to' => '573001234567',
        'components' => [
            [
                'type' => 'body',
                'parameters' => [
                    [
                        'type' => 'text',
                        'text' => 'John',
                    ],
                    [
                        'type' => 'text',
                        'text' => 'your order #1234',
                    ],
                ],
            ],
        ],
    ]),
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);

डिलीवरी स्टेटस

भेजने का response सिर्फ़ इतना बताता है कि Meta ने मैसेज स्वीकार (ACCEPT) कर लिया; delivered / read / failed कुछ मिनट बाद Meta के webhooks से आते हैं। इन्हें पढ़ने के लिए भेजते समय body में `campaign` {key, name} दें (भेजा गया मैसेज उसी key के तहत दर्ज होता है, जो Platform → Campaigns में भी दिखता है) और यह endpoint चेक करें। `status` इनमें से एक है: sent, delivered, read या failed; `message_id` वह wamid है जो भेजने पर मिलता है (यह भेजने के response में भी आता है)।

GET/v1/campaigns/my-app/executions
curl "https://rest-api.tbit.app/v1/campaigns/my-app/executions?since=2026-08-27T00:00:00Z&limit=100" \
  -H "X-API-Key: $TBIT_API_KEY"
const response = await fetch('https://rest-api.tbit.app/v1/campaigns/my-app/executions?since=2026-08-27T00:00:00Z&limit=100', {
  headers: {
    'X-API-Key': process.env.TBIT_API_KEY,
  },
});
const data = await response.json();
import axios from 'axios';

const { data } = await axios.get(
  'https://rest-api.tbit.app/v1/campaigns/my-app/executions?since=2026-08-27T00:00:00Z&limit=100',
  {
    headers: {
      'X-API-Key': process.env.TBIT_API_KEY,
    },
  },
);
import os
import requests

response = requests.get(
    'https://rest-api.tbit.app/v1/campaigns/my-app/executions?since=2026-08-27T00:00:00Z&limit=100',
    headers={'X-API-Key': os.environ['TBIT_API_KEY']},
)
data = response.json()
<?php
$ch = curl_init('https://rest-api.tbit.app/v1/campaigns/my-app/executions?since=2026-08-27T00:00:00Z&limit=100');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'X-API-Key: ' . getenv('TBIT_API_KEY'),
    ],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
Response
{
  "data": [
    {
      "id": "6a90ea1f...",
      "to": "573001234567",
      "template_id": "tpl_abc123",
      "message_id": "wamid.HBgLNTcz...",
      "status": "failed",
      "error_message": "This message was not delivered to maintain healthy ecosystem engagement.",
      "sent_at": "2026-08-28T02:17:59.494Z",
      "delivered_at": null,
      "read_at": null
    }
  ]
}

एक टेम्पलेट ऑब्जेक्ट:

json
{
  "data": [
    {
      "id": "tpl_abc123",
      "name": "order_confirmation",
      "language": "es",
      "status": "APPROVED",
      "category": "UTILITY",
      "channel_id": "6a7268abec6ecaf999a6c0ba",
      "components": [
        {
          "type": "BODY",
          "text": "Hola {{1}}, {{2}} ha sido confirmado."
        }
      ],
      "created_at": "2024-08-15T10:00:00Z"
    }
  ]
}

सफलता से भेजने पर मैसेज ID लौटाई जाती है:

json
{
  "data": {
    "message_sent": true,
    "message_id": "wamid.HBgLNTczMDAxMjM0NTY3FQIAERgSMUY2RUZGM0Y3RTJCRTQ5AA==",
    "parsed_message": "Hola John, your order #1234 ha sido confirmado."
  }
}