API Documentation

Quick Start

Welcome to the SocialAPI API. Build powerful WhatsApp messaging integrations directly into your applications.

Authentication

Authenticate your requests by including your API token in the Authorization header.

Authorization: Bearer <YOUR_TOKEN>

Templates

GET/api/v1/templates

Retrieve a list of all WhatsApp templates available for your company.

POST/api/v1/templates

Create a new WhatsApp Template. To add an attachment (media), specify a HEADER component with format IMAGE, VIDEO, or DOCUMENT.

Request Body (Example with Image Header)
{
  "name": "my_media_template",
  "category": "MARKETING",
  "language": "en_US",
  "components": [
    {
      "type": "HEADER",
      "format": "IMAGE",
      "example": { "header_handle": ["<upload_handle_id>"] }
    },
    {
      "type": "BODY",
      "text": "Hello {{1}}, check out this image!",
      "example": { "body_text": [["John"]] }
    },
    {
      "type": "FOOTER",
      "text": "Reply STOP to unsubscribe"
    },
    {
      "type": "BUTTONS",
      "buttons": [
         { "type": "QUICK_REPLY", "text": "Yes, I am interested" }
      ]
    }
  ]
}

Campaigns

GET/api/v1/campaigns

List all your campaigns.

GET/api/v1/campaigns/123

Get details of a specific campaign, including its status and statistics.

POST/api/v1/campaigns

Create a draft campaign. You can specify precise recipients for testing or transactional use.

Request Body
{
  "name": "Summer Sale Blast",
  "template_name": "hello_world",
  "language": "en_US",
  "recipients": ["919876543210"],
  "whatsapp_number_key": "AK7MXP2RBNCQ"
}
Response
{
  "message": "Campaign initiated...",
  "campaign_id": 123,
  "total_contacts": 1
}
POST/api/v1/campaigns/123/send

Trigger the sending process for a campaign.


Send Messages

POST/api/v1/messages/text

Send a standard text message to a user.

{
  "to": "1234567890",
  "text": "Hello, this is a test message from API.",
  "whatsapp_number_key": "AK7MXP2RBNCQ"
}
POST/api/v1/messages/attachment

Send media (image, video, document, audio) via URL.

{
  "to": "1234567890",
  "type": "image",
  "url": "https://example.com/image.png",
  "caption": "Check this out!",
  "whatsapp_number_key": "AK7MXP2RBNCQ"
}

Supported types: image, video, audio, document.

POST/api/v1/messages/template

Send a template message with dynamic variables. We support a simplified payload format for easy integration.

{
   "to": "1234567890",
   "template_name": "welcome_user",
   "language": "en_US",
   "variables": ["John", "123"],
   "header_variable": "Order #456",
   "header_media_url": "https://example.com/invoice.pdf",
   "header_media_type": "document",
   "whatsapp_number_key": "AK7MXP2RBNCQ"
 }
Field Definitions
  • to: (Required) Recipient's phone number with country code (e.g., "919876543210").
  • template_name: (Required) The unique name of the approved template.
  • whatsapp_number_key: (Optional) The unique 12-char key for your WhatsApp account. Find this in Developer Settings.
  • language: (Optional) Language code. Defaults to "en_US".
  • variables: Array of strings for body parameters {{1}}, {{2}}, etc.
  • header_variable: (Optional) String for a text header parameter {{1}}.
  • header_media_url: (Optional) URL for image/video/document header.
  • header_media_type: (Optional) image, video, or document. Defaults to image.

Contacts

POST/api/v1/contacts/import

Import or update contacts in bulk. Requires a JSON array of contact objects.

{
  "contacts": [
    {
       "country_code": "91",
       "phone": "9876543210",
       "first_name": "John",
       "last_name": "Doe",
       "tags": ["lead", "vip"]
    },
    { "phone": "15550001234" }
  ]
}