Message Hooks allow your external system to trigger WhatsApp template messages automatically by sending data to chatlyn via a webhook.
Prerequisites
Before creating a Message Hook, make sure you have:
- A published WhatsApp Template in chatlyn.
- Logic in your own system that can send an HTTP POST request to the Message Hook endpoint.
- A payload that includes at least the recipient's phone number.
- The recipient's phone number must be in E.164 format (for example:
+491701234567).
Steps
Endpoint Information
Navigate to:
Settings → Message Hooks → Create new Message Hook
In the Endpoint Information step, you'll receive everything needed for your integration.
Copy and save:
- The cURL – shows how to send data to the Message Hook.
- The request headers – including the API Key, which authenticates your requests.
Your external system will use this endpoint, together with the provided headers, to send data to chatlyn.
Define Payload
Next, define the structure of the data your system will send.
You can either:
- Paste an example JSON payload, or
- Send a sample request directly to the endpoint.
Requirements
Your payload:
- Must include a valid recipient phone number in E.164 format
- Must not contain arrays
- Should include all values you want to use for template placeholders
Example Payload
{
"phone": "+431701234567",
"firstName": "John",
"language": "en",
"bookingNumber": "123456"
}Select a WhatsApp Template
Choose the WhatsApp template that should be sent whenever this Message Hook receives a request.
Only approved WhatsApp templates are available for selection.
Map WhatsApp Placeholders
Map the fields from your incoming payload to the corresponding WhatsApp template fields.
Typically you'll map:
- Recipient phone number
- Language
- Contact name
If your WhatsApp template contains placeholders, map each placeholder to the appropriate field from your payload.
Test the WhatsApp Message
Before activating the Message Hook, send a test message.
Enter your own phone number and verify that:
- The template is delivered successfully.
- All placeholders are populated correctly.
- The message appears exactly as expected.
Finish and Create the Message Hook
Finally:
- Enter a Name for your Message Hook.
- Add an optional Description to help identify its purpose.
- Click Create and enable Message Hook.
Your Message Hook is now live and ready to receive requests from your external system.
How It Works
Once enabled, the process is straightforward:
- Your system sends an HTTP POST request to the Message Hook endpoint.
- chatlyn validates the payload.
- The payload fields are mapped to the selected WhatsApp template.
- The WhatsApp template is sent to the recipient using the provided phone number.
As long as your payload matches the defined structure and includes a valid E.164 phone number, messages can be sent automatically without any manual interaction.