Skip to content

HSM API (Bulk sending)

Send bulk messages through the official WhatsApp API.

Authentication

Get the authentication token used in each iteration. It is valid for 8 hours and only for the logged-in user.

Request

curl --request POST \
  --url 'https://massive.chattigo.com/message/login' \
  --header 'Content-Type: application/json' \
  --data '{
    "username": "<user>",
    "password": "<password>"
  }'

Response

Success (200)

{
  "access_token": "<JWT>"
}

Errors

CodeCase
400Bad Request
401Unauthorized

Send a template to multiple recipients

To send the same HSM to multiple recipients, use the payload below. Use ONLY this method when sending the same template to multiple destinations, to improve platform performance.

  • The platform supports up to 1000 recipients per send.
  • Inside the destinations object, a <customer_message_id> is sent only if the client has that feature.
  • Parameters inside destinations reach only the recipients in question.

Request

POST /inbound

curl --request POST \
  --url 'https://massive.chattigo.com/message/inbound' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "did": "<did>",
    "type": "HSM",
    "channel": "WHATSAPP",
    "hsm": {
      "component": {
        "buttons": [{ "index": 0 }]
      },
      "destinations": [
        {
          "id": "<customer_message_id>",
          "destination": "<customer_number>",
          "parameters": [
            "<customer_body_dynamic_parameter1>",
            "<customer_body_dynamic_parameter2>",
            "<customer_body_dynamic_parameter3>"
          ],
          "buttonsParameters": ["<customer_button_dynamic_parameter1>"],
          "headerParameters": ["<customer_dynamic_parameter1>"]
        }
      ],
      "parameters": [
        "<body_static_parameter1>",
        "<body_static_parameter2>",
        "<body_static_parameter3>"
      ],
      "buttonsParameters": ["<button_static_parameter1>"],
      "headerParameters": ["<header_static_parameter1>"],
      "namespace": "<namespaces>",
      "template": "<template_name>",
      "botAttention": true,
      "languageCode": "es"
    }
  }'

Response

Success (200)

Status code 200.

Errors

CodeCase
400Bad Request
401Unauthorized

Send a template to multiple recipients — example with values

Inside destinations you must enter the needed values; they reach only the recipients in question.

Request

curl --request POST \
  --url 'https://massive.chattigo.com/message/inbound' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "did": "56940581384",
    "type": "HSM",
    "channel": "WHATSAPP",
    "hsm": {
      "destinations": [
        {
          "id": "168423779",
          "destination": "359882346677",
          "parameters": ["Pedro", "Juan", "Chattigo"],
          "buttonsParameters": ["http://www.chattigo.com"],
          "headerParameters": ["Chattigo"]
        },
        {
          "id": "2568423779",
          "destination": "3590986924",
          "parameters": ["Esteban", "Armando", "Diana"],
          "buttonsParameters": ["http://www.google.com"],
          "headerParameters": ["Roberto"]
        }
      ],
      "namespace": "8bea77b1_b5db_43a3_ba0c_c927708a17ab",
      "template": "template_name",
      "botAttention": true,
      "languageCode": "es"
    }
  }'

Response

Success (200)

Status code 200.

Send a template with static parameters

Values are sent in the templates to all recipients.

Request

curl --request POST \
  --url 'https://massive.chattigo.com/message/inbound' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "<id>",
    "did": "<did>",
    "type": "HSM",
    "channel": "WHATSAPP",
    "hsm": {
      "component": {
        "buttons": [{ "index": 0 }]
      },
      "destinations": [
        { "id": "168423779", "destination": "359882346677" },
        { "id": "2568423779", "destination": "3590986924" }
      ],
      "parameters": ["Compra", "Empresa", "Chattigo"],
      "buttonsParameters": ["http://www.chattigo.com/planes"],
      "headerParameters": ["Telefono"],
      "namespace": "8bea77b1_b5db_43a3_ba0c_c927708a17ab",
      "template": "template_name",
      "botAttention": true,
      "languageCode": "es"
    }
  }'

Response

Success (200)

Status code 200.

Send a template with a flow (no parameters)

Request

curl --request POST \
  --url 'https://massive.chattigo.com/message/inbound' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "campaign",
    "did": "did",
    "channel": "WHATSAPP",
    "hsm": {
      "totalContactToSend": 1,
      "destinations": [{ "destination": "destination" }],
      "template": "prueba_flow_1",
      "botAttention": false,
      "offlineAssignment": false,
      "attends": {
        "attend": 3,
        "assignedAgent": 0,
        "botType": 0,
        "waitTime": -1,
        "typification": 0
      }
    }
  }'

Response

Success (200)

Status code 200.

Send a location template

To send a template with location, footer and buttons.

Request

curl --request POST \
  --url 'https://massive.chattigo.com/message/inbound' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "<id>",
    "did": "<did>",
    "type": "HSM",
    "channel": "WHATSAPP",
    "hsm": {
      "component": {
        "header": {
          "type": "location",
          "location": {
            "latitude": "<latitude>",
            "longitude": "<longitude>",
            "name": "location name",
            "address": "location name"
          }
        },
        "footer": "<Footer>",
        "buttons": [
          {
            "index": 0,
            "type": "quick_reply",
            "title": "Button Title"
          }
        ]
      },
      "destinations": [
        {
          "destination": "<destination>",
          "parameters": ["<body_parameter>"],
          "buttonsParameters": ["<button_parameter>"]
        }
      ],
      "namespace": "<namespaces>",
      "template": "<template_name>",
      "botAttention": true,
      "languageCode": "es"
    }
  }'

Response

Success (200)

Status code 200.

Errors

CodeCase
400Bad Request
401Unauthorized

Send a template with image

To send a template with image, footer and buttons. The header type may vary according to the object to send.

Request

curl --request POST \
  --url 'https://massive.chattigo.com/message/inbound' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "<id>",
    "did": "<did>",
    "type": "template",
    "channel": "WHATSAPP",
    "hsm": {
      "destinations": [{ "destination": "<destination>" }],
      "namespace": "<namespace>",
      "template": "<template_name>",
      "languageCode": "es",
      "botAttention": false,
      "component": {
        "header": {
          "type": "image_url",
          "value": "https://media.chattigo.com/files/media/storage/image_name..jpg",
          "isBinaryFile": true,
          "filename": "<filename>.jpg"
        },
        "footer": "<Footer>",
        "buttons": [
          {
            "index": 0,
            "type": "quick_reply",
            "title": "Button Title"
          }
        ]
      },
      "attends": {
        "attend": 3,
        "assignedAgent": 0,
        "botType": 0,
        "waitTime": -1,
        "typification": 0
      }
    }
  }'
header.type accepts: text, video, document, payload, image_url, location.

Response

Success (200)

Status code 200.

Chat attention configuration

Possible chat assignment combinations:

ConditionResult
idUser == 0 and botAttention == falseChat handled by a random agent
idUser == 0 and botAttention == trueChat handled by the bot
idUser > 0 and botAttention == falseChat handled by a specific agent

Example 1 (hsm object)

curl --request POST \
  --url 'https://massive.chattigo.com/message/inbound' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "12",
    "did": "56940581384",
    "channel": "WHATSAPP",
    "campaignId": 12,
    "hsm": {
      "totalContactToSend": 1,
      "destinations": [{ "destination": "56978949142" }],
      "template": "prueba_asignacion_hsm1",
      "offlineAssignment": false,
      "attends": {
        "waitTime": -1,
        "typification": 0
      },
      "botAttention": false
    },
    "idUser": 1345555
  }'

Example 2 (messageTemplate object)

curl --request POST \
  --url 'https://massive.chattigo.com/message/inbound' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "12",
    "did": "56940581384",
    "channel": "WHATSAPP",
    "campaignId": 12,
    "messageTemplate": {
      "totalContactToSend": 1,
      "destinations": [{ "destination": "56978949142" }],
      "name": "prueba_asignacion_hsm2",
      "botAttention": false
    },
    "idUser": 1345555
  }'

Send an authentication template with copy-code button

The code sent in the template must have up to 15 digits.

Request

curl --request POST \
  --url 'https://massive.chattigo.com/message/inbound' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "<id>",
    "did": "<did>",
    "type": "HSM",
    "channel": "WHATSAPP",
    "hsm": {
      "component": {
        "buttons": [{ "index": 0 }]
      },
      "destinations": [
        {
          "destination": "<destination>",
          "parameters": ["<body_parameter>"],
          "buttonsParameters": ["<button_parameter>"]
        }
      ],
      "namespace": "<namespaces>",
      "template": "<template_name>",
      "botAttention": true,
      "languageCode": "es"
    }
  }'

Response

Success (200)

Status code 200.

Send a message

Service that allows sending messages once the HSM has been sent and the client has replied. When the client replies to an HSM, a 24-hour session opens for conversation.

Request

POST /inbound/message

curl --request POST \
  --url 'https://massive.chattigo.com/message/inbound/message' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "123123",
    "did": "56949321905",
    "msisdn": "56984643056",
    "type": "media",
    "channel": "WHATSAPP",
    "content": "Imagen chat",
    "name": "Johans Morales",
    "isAttachment": true,
    "attachment": {
      "mimeType": "image/png",
      "mediaUrl": "https://k8s.chattigo.com/files/chattigostorage/Captura-de-Pantalla-2019-06-04-a-la(s)-23.50.28.png"
    }
  }'

Response

Success (200)

Status code 200.

Errors

CodeCase
400Bad Request
401Unauthorized
500Internal Server Error

Send multimedia

Service that allows sending multimedia files: JPG images up to 5 MB; PDF, Word, Excel and PPT up to 20 MB. Requires an open 24-hour session.

Request

POST /inbound/attach

curl --request POST \
  --url 'https://massive.chattigo.com/message/inbound/attach' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "<identifier>",
    "did": "<channel identifier>",
    "msisdn": "<destination identifier>",
    "type": "media",
    "channel": "WHATSAPP",
    "content": "<message content>",
    "isAttachment": true,
    "attachment": {
      "mediaUrl": "<multimedia url>",
      "mimeType": "<multimedia type>",
      "base64": "<base64 encoded multimedia>",
      "fileName": "<FileName.jpg>"
    }
  }'

Response

Success (200)

Status code 200.

Errors

CodeCase
400Bad Request
401Unauthorized
500Internal Server Error

Event notification

Every message sent through this API can notify WhatsApp events to a service provided by the client.

Request

POST /{https URL provided by the client} — optional header.

curl --request POST \
  --url 'https://{client-https-url}' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "<identifier>",
    "did": "<channel identifier>",
    "msisdn": "<destination identifier>",
    "type": "SENT|DELIVERY|READ|INVALID|SESSION",
    "channel": "WHATSAPP",
    "timestamp": "20193940560",
    "answer": "true|false",
    "nodo": "RECHAZO_TDC",
    "errors": [
      {
        "code": 131026,
        "title": "Message undeliverable"
      }
    ]
  }'

Fields

FieldTypeRequiredDescription
idIntegerYesMessage identifier. For SESSION, the id is internal to Chattigo.
didStringYesWhatsApp number associated with the HSM send.
msisdnStringYesCustomer contact number.
typeStringYesNotification type generated.
channelStringYesChannel of the transaction.
timestampStringYesEvent date.
nodoStringNoNode where the response originates. Applies only for BOT.
errorsArrayNoList of objects with Cloud API error code and error title.

Type enum

TypeDescription
SENTThe message was sent (one check).
DELIVERYThe message was delivered (double check).
READThe message was read (blue double check).
SESSIONA 24-hour window exists to send outbound without HSM.
INVALIDThe phone number is invalid or does not have WhatsApp.

Bulk sending of multimedia messages with template

Bulk multimedia sending requires a Facebook-authorized template, enabled on the platform.

Do not use this method for bulk message sending (use the destinations send instead).

Request

curl --request POST \
  --url 'https://massive.chattigo.com/message/inbound' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "1111111",
    "did": "234235325532",
    "type": "HSM",
    "channel": "WHATSAPP",
    "messageTemplate": {
      "destinations": [{ "destination": "333333333333" }],
      "namespace": "311a2215_7e0d_4664_b597_999847630f2",
      "botAttention": false,
      "name": "template_name",
      "language": {
        "policy": "deterministic",
        "code": "es"
      },
      "components": [
        {
          "type": "header",
          "sub_type": "document",
          "parameters": [
            {
              "type": "document",
              "value": {
                "link": "https://media.chattigo.com/files/media/storage/this-is-an-archive..pdf"
              },
              "location": {
                "latitude": "<latitude>",
                "longitude": "<longitude>",
                "name": "location name",
                "address": "location name"
              },
              "payload": "button text"
            }
          ]
        },
        {
          "type": "body",
          "parameters": [{ "type": "text", "text": "text_value" }]
        }
      ]
    }
  }'

Response

Success (200)

Status code 200.

Bulk sending of catalog templates (single product)

To send single-product catalog messages you must have the inventory uploaded to Meta in an e-commerce catalog connected to your WhatsApp business account.

Request

curl --request POST \
  --url 'https://massive.chattigo.com/message/inbound' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "id",
    "did": "did",
    "channel": "WHATSAPP",
    "hsm": {
      "destinations": [{ "destination": "DESTINATION" }],
      "productsParameters": [
        {
          "type": "action",
          "action": {
            "thumbnail_product_retailer_id": "THUMBNAIL_PRODUCT_RETAILER_ID"
          }
        }
      ],
      "template": "template_name",
      "botAttention": false,
      "offlineAssignment": false,
      "attends": {
        "attend": 3,
        "assignedAgent": 0,
        "botType": 0,
        "waitTime": -1,
        "typification": 0
      }
    }
  }'

Response

Success (200)

{
  "success": true
}

Errors

CodeCase
400Bad Request
401Unauthorized

Bulk sending of catalog templates (multiple products)

Multi-product template messages must include:

  • A header component (only if the template uses a header variable).
  • A body component (only if the template uses a body variable).
  • A single multi-product message button component.

Request

curl --request POST \
  --url 'https://massive.chattigo.com/message/inbound' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "ID",
    "did": "DID",
    "channel": "WHATSAPP",
    "hsm": {
      "destinations": [{ "destination": "DESTINATION DID" }],
      "productsParameters": [
        {
          "type": "action",
          "action": {
            "thumbnail_product_retailer_id": "THUMBNAIL_PRODUCT_RETAILER_ID",
            "sections": [
              {
                "title": "<TITLE>",
                "product_items": [
                  { "product_retailer_id": "<PRODUCT_RETAILER_ID>" }
                ]
              }
            ]
          }
        }
      ],
      "template": "template_name",
      "botAttention": false,
      "offlineAssignment": false,
      "attends": {
        "attend": 3,
        "assignedAgent": 0,
        "botType": 0,
        "waitTime": -1,
        "typification": 0
      }
    }
  }'
Up to 30 products per section (product_items).

Response

Success (200)

{
  "success": true
}

Errors

CodeCase
400Bad Request
401Unauthorized

Get catalogs

Gets the catalogs by did.

Request

GET /catalogs/{did}

curl --request GET \
  --url 'https://massive.chattigo.com/message/catalogs/{did}' \
  --header 'Authorization: Bearer <JWT>'

Response

Success (200)

{
  "data": [
    {
      "id": "id",
      "name": "name"
    }
  ]
}

Errors

CodeCase
400Bad Request
401Unauthorized

Get products within catalogs

Gets the products of a catalog by did, with optional filters as query params.

Request

GET /catalogs/{did}/products?size=1

curl --request GET \
  --url 'https://massive.chattigo.com/message/catalogs/{did}/products?size=1' \
  --header 'Authorization: Bearer <JWT>'

Available query params:

clientId, catalogId, productId, deleted, name, description, brand, active, inventory, availability, condition, returnTotalElements, retailers, color, currency, category, gender, visibility, inOffer, updateHash, page, size.

Response

Success (200)

{
  "content": [
    {
      "clientId": 6,
      "id": "id",
      "name": "ceviche",
      "availability": "in stock",
      "category": "Food & Beverages",
      "currency": "PEN",
      "description": "ceviche description",
      "inventory": 100,
      "price": "S/30,00",
      "url": "https://ilcb.edu.pe/blog-detalle/el-lomo-saltado",
      "condition": "new",
      "Visibility": "published",
      "UpdateHash": "86763632",
      "retailer_id": "okxspqrepd",
      "image_url": "https://...",
      "retailer_product_group_id": "m7ld4y6fn6",
      "product_catalog": {
        "id": "id",
        "name": "name"
      }
    }
  ]
}

Errors

CodeCase
400Bad Request
401Unauthorized

Bulk sending of flows with template

To send a flow in bulk:

Request

curl --request POST \
  --url 'https://massive.chattigo.com/message/inbound' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "12",
    "did": "56940581384",
    "channel": "WHATSAPP",
    "hsm": {
      "totalContactToSend": 1,
      "destinations": [{ "destination": "56978949142" }],
      "template": "prueba_flow_1",
      "botAttention": false,
      "offlineAssignment": false,
      "attends": {
        "attend": 3,
        "assignedAgent": 0,
        "botType": 0,
        "waitTime": -1,
        "typification": 0
      }
    }
  }'

Response

Success (200)

Status code 200.

Get templates by client

Gets a client’s templates with pagination.

Request

GET /templates

curl --request GET \
  --url 'https://massive.chattigo.com/message/templates?limit=3' \
  --header 'Authorization: Bearer <JWT>'

Query params:

FieldTypeDescription
pageStringPage to query (default 0).
sizeStringTemplates per page (default 25).

Response

Success (200)

{
  "data": [
    {
      "id": "646befe09fed6a112f17d8df",
      "name": "prueba_link_dinamico3",
      "namespace": "8bea77b1_b5db_43a3_ba0c_c927708a17ab",
      "category": "MARKETING",
      "language": "es",
      "clientId": 6,
      "campaignId": 12,
      "campaignName": "Demo Chattigo DEV Pruebas",
      "channelDid": "51938720621",
      "channelId": 10089,
      "fastResponse": false,
      "channelType": "WHATSAPP",
      "active": true,
      "headerType": "IMAGE",
      "buttonsType": "CALL_TO_ACTION_DYNAMIC"
    }
  ],
  "page": 1,
  "total": 65,
  "pageSize": 3
}

Errors

CodeCase
400Bad Request
401Unauthorized

Create a carousel template (Product)

Request

POST /templates/{did}

curl --request POST \
  --url 'https://massive.chattigo.com/message/templates/{did}' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "template_name",
    "language": "es_ES",
    "category": "marketing",
    "components": [
      {
        "type": "body",
        "text": "Esto es un ejemplo con la variable {{1}}",
        "example": { "body_text": [["variable"]] }
      },
      {
        "type": "carousel",
        "cards": [
          {
            "components": [
              { "type": "header", "format": "product" },
              { "type": "buttons", "buttons": [{ "type": "spm", "text": "Ver" }] }
            ]
          }
        ]
      }
    ]
  }'

Response

Success (200)

Status code 200.

Errors

CodeCase
400Bad Request
401Unauthorized

Create a carousel template (Multimedia)

Request

POST /templates/{did}

curl --request POST \
  --url 'https://massive.chattigo.com/message/templates/{did}' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "qa_bug_image_presentation_carousel_template_v2",
    "language": "es_ES",
    "category": "marketing",
    "components": [
      {
        "type": "body",
        "text": "Este template expone productos con imagenes para presentacion {{1}},{{2}}",
        "example": { "body_text": [["Silla", "Mesa"]] }
      },
      {
        "type": "carousel",
        "cards": [
          {
            "components": [
              {
                "type": "header",
                "format": "image",
                "example": {
                  "header_link": ["https://fastly.picsum.photos/id/237/200/300.jpg"]
                }
              },
              {
                "type": "body",
                "text": "Este producto es bueno por .... {{1}}",
                "example": { "body_text": [["ejemplo"]] }
              },
              {
                "type": "buttons",
                "buttons": [
                  { "type": "phone_number", "text": "LLamar", "phone_number": "PHONE_NUMBER" },
                  { "type": "url", "text": "Shop", "url": "https://www.url.com/{{1}}", "example": ["parametro"] }
                ]
              }
            ]
          }
        ]
      }
    ]
  }'

Response

Success (200)

Status code 200.

Errors

CodeCase
400Bad Request
401Unauthorized

Send a carousel template (Product)

Request

POST /templates/{did}

curl --request POST \
  --url 'https://massive.chattigo.com/message/templates/{did}' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "ID",
    "did": "DID",
    "type": "template",
    "channel": "WHATSAPP",
    "campaign": 23423423423,
    "hsm": {
      "totalContactToSend": 1,
      "destinations": [
        { "destination": "DESTINATION_1", "parameters": ["PARAMETER_1"] },
        { "destination": "DESTINATION_2", "parameters": ["PARAMETER_1"] }
      ],
      "carousel": {
        "cards": [
          {
            "product": {
              "productRetailerId": "PRODUCT_ID",
              "catalogId": "ID_CATALOG"
            }
          },
          {
            "product": {
              "productRetailerId": "PRODUCT_ID",
              "catalogId": "ID_CATALOG"
            }
          }
        ]
      },
      "template": "template_name",
      "botAttention": false,
      "offlineAssignment": false,
      "attends": {
        "attend": 3,
        "assignedAgent": 0,
        "botType": 0,
        "waitTime": 5,
        "typification": 341970
      }
    }
  }'

Response

Success (200)

Status code 200.

Errors

CodeCase
400Bad Request
401Unauthorized

Send a carousel template (Multimedia)

Request

POST /templates/{did}

curl --request POST \
  --url 'https://massive.chattigo.com/message/templates/{did}' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "ID",
    "did": "DID",
    "type": "template",
    "channel": "WHATSAPP",
    "campaignId": 1112112,
    "hsm": {
      "totalContactToSend": 1,
      "destinations": [{ "destination": "DESTINATION_1", "parameters": ["param 1", "param 2"] }],
      "carousel": {
        "cards": [
          {
            "media": {
              "link": "https://this_is__a_url",
              "bodyParameters": ["body parameter"],
              "buttonsParameters": ["planes"]
            }
          }
        ]
      },
      "template": "template_name",
      "botAttention": false,
      "offlineAssignment": false,
      "attends": {
        "attend": 3,
        "assignedAgent": 0,
        "botType": 0,
        "waitTime": 5,
        "typification": 341970
      }
    }
  }'

Response

Success (200)

Status code 200.

Errors

CodeCase
400Bad Request
401Unauthorized