Method: POST
URL: https://api.trypopcorn.ai/template/:templateId

Headers

  • POPCORN-API-KEY (string, required) - API key provided by the Popcorn team.

Parameters

  • Path Parameter:

    • templateId (string) - Unique ID of the template to send.
  • Body Parameters:

    • recipientNumber (string, required) - Phone number of the recipient.
    • variables (array, optional) - Custom variables to be used in the template. Include this only if the template is dynamic and requires variables. The array of values should be ordered, with each variable corresponding sequentially to the placeholders in the template.

Example Request

POST https://api.trypopcorn.ai/template/12345
Content-Type: application/json
POPCORN-API-KEY: your_popcorn_api_key

{
  "recipientNumber": "1234567890",
  "variables": ["John Doe"]
}

Example Response

{
  "success": true
}

If there’s an error, the response may look like:

{
  "success": false,
  "error": "recipientNumber is required"
}

Errors

  • 400 - Invalid request, e.g., missing recipientNumber or templateId.
  • 500 - Internal server error.