Peach
  1. messaging
Peach
  • messaging
    • Send a pre-approved template message
      POST
    • Launch a Broadcast
      POST
  • contacts
    • Create a contact on Peach
      POST
  • orders
    • Create an order
      POST
    • Find order by ID
      GET
    • Create a refund for an order
      POST
  • medias
    • List available Medias
      GET
    • Add a Media
      POST
    • Remove a Media
      DELETE
  1. messaging

Send a pre-approved template message

POST
https://app.trypeach.io/api/v1/events
messaging
Send a template message to a contact. The WhatsApp template should be approved for this API to work.

Request

Authorization
Add parameter in header
Authorization
Example:
Authorization: ********************
Body Params application/json
event_type
enum<string> 
required
Allowed value:
send_template_message
contact
object (Contact) 
required
name
string 
optional
Example:
Alfred Hitchcock
email
string 
optional
Example:
alfred@example.com
phone_number
string 
required
Example:
+19019019191 or +919876543210
template_message
object 
required
whats_app_template_id
string 
required
WhatsApp Template ID on Peach
Example:
your_template_id
liquid_values
object 
optional
An object containing key/value pairs for template variables. If your template has header_media, then the header_media can either be a string or an object with link and filename. filename is only supported for document headers.
Example:
{"product_name":"Product 1","price":112,"currency":"₹","header_media":"https://example.com/image.png"}
retry_until
string 
optional
The datetime (in ISO 8601 format) till which the Template Message will be attempted to be re-sent in case of delivery failure. The datetime should be in the future.
Example:
2024-04-01T17:30:00Z
retry_window
object 
optional
An object to configure the retry delivery window in case of delivery failure.
Example
{
  "event_type": "send_template_message",
  "contact": {
    "name": "Alfred Hitchcock",
    "email": "alfred@example.com",
    "phone_number": "+19019019191 or +919876543210"
  },
  "template_message": {
    "whats_app_template_id": "your_template_id",
    "liquid_values": {
      "product_name": "Product 1",
      "price": 112,
      "currency": "₹",
      "header_media": "https://example.com/image.png"
    },
    "retry_until": "2024-04-01T17:30:00Z",
    "retry_window": {
      "start_at": "08:00",
      "end_at": "20:00",
      "timezone": "The account's default timezone"
    }
  }
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://app.trypeach.io/api/v1/events' \
--header 'Content-Type: application/json' \
--header 'Authorization;' \
--data-raw '{
    "event_type": "send_template_message",
    "contact": {
        "name": "Alfred Hitchcock",
        "email": "alfred@example.com",
        "phone_number": "+19019019191 or +919876543210"
    },
    "template_message": {
        "whats_app_template_id": "your_template_id",
        "liquid_values": {
            "product_name": "Product 1",
            "price": 112,
            "currency": "₹",
            "header_media": "https://example.com/image.png"
        },
        "retry_until": "2024-04-01T17:30:00Z",
        "retry_window": {
            "start_at": "08:00",
            "end_at": "20:00",
            "timezone": "The account'\''s default timezone"
        }
    }
}'

Responses

🟢201Created
application/json
Transactional message has been queued for delivery
Body
event_type
enum<string> 
required
Allowed value:
send_template_message
contact
object (Contact) 
required
name
string 
optional
Example:
Alfred Hitchcock
email
string 
optional
Example:
alfred@example.com
phone_number
string 
required
Example:
+19019019191 or +919876543210
template_message
object 
required
whats_app_template_id
string 
required
WhatsApp Template ID on Peach
Example:
your_template_id
liquid_values
object 
optional
An object containing key/value pairs for template variables. If your template has header_media, then the header_media can either be a string or an object with link and filename. filename is only supported for document headers.
Example:
{"product_name":"Product 1","price":112,"currency":"₹","header_media":"https://example.com/image.png"}
retry_until
string 
optional
The datetime (in ISO 8601 format) till which the Template Message will be attempted to be re-sent in case of delivery failure. The datetime should be in the future.
Example:
2024-04-01T17:30:00Z
retry_window
object 
optional
An object to configure the retry delivery window in case of delivery failure.
Example
{
  "event_type": "send_template_message",
  "contact": {
    "name": "Alfred Hitchcock",
    "email": "alfred@example.com",
    "phone_number": "+19019019191 or +919876543210"
  },
  "template_message": {
    "whats_app_template_id": "your_template_id",
    "liquid_values": {
      "product_name": "Product 1",
      "price": 112,
      "currency": "₹",
      "header_media": "https://example.com/image.png"
    },
    "retry_until": "2024-04-01T17:30:00Z",
    "retry_window": {
      "start_at": "08:00",
      "end_at": "20:00",
      "timezone": "The account's default timezone"
    }
  }
}
🟠422Parameter Error
Next
Launch a Broadcast
Built with