Setting up event-triggers
This document outlines how to programmatically trigger scheduled messages in Yazi through the API.
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending
.mdto page URLs; this page is available as Markdown.
Setting up event-triggers
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending
.mdto page URLs; this page is available as Markdown.
Setting up event-triggers
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending
.mdto page URLs; this page is available as Markdown.
Setting up event-triggers
Yazi API
The Yazi API lets you programmatically send WhatsApp template messages and access your research data. You can trigger on-demand messages to individual phone numbers, broadcast to study participants, and pull study results -- all via simple REST endpoints.
Base URL: https://api.askyazi.com/v1
Authentication
All requests require an API key sent as a header:
x-api-key: your-api-key-hereThe header name must be exactly x-api-key (all lowercase). It is case-sensitive.
Your API key is provided by the Yazi team. Include it on every request.
Example:
Contact the Yazi team if you need your API key or have any questions about the integration.
Conventions
Most request and response fields use camelCase (e.g.
phoneNumber,campaignId). The schedule endpoints (/v1/jobs/schedule) are an exception and use snake_case (e.g.template_name,message_variables).Authentication uses the
x-api-keyheader with your organisation API key, unless stated otherwise.Phone numbers must be in E.164 format with a leading
+(e.g.+27821234567). Numbers without the+are rejected.
Quick reference
List event schedules
GET
/v1/jobs/schedule
Create event schedule
POST
/v1/jobs/schedule
Update event schedule
PUT
/v1/jobs/schedule/{configurationId}
Trigger schedule (send message)
POST
/v1/jobs
List studies
GET
/v1/study
Study details
GET
/v1/study/{studyId}
Study results
GET
/v1/study/{studyId}/results
Study participants
GET
/v1/study/{studyId}/participants
Event-triggered schedules
Event-triggered schedules let your system send a WhatsApp template message to a single phone number on demand. You set up a schedule configuration once (choosing the template, variables, and buttons), then trigger it whenever you need to send a message.
Typical use case: Your CRM fires a webhook when a new lead signs up. That webhook calls the trigger endpoint with the lead's phone number and name, and a personalised WhatsApp message goes out instantly.
You have two options:
Option A: Create the schedule yourself via API, then trigger it.
Option B: Ask the Yazi team to create the schedule for you -- then you only need to call the trigger endpoint.
List event schedules
Returns all event-triggered schedule configurations for your organisation. Use this to find your configurationId if you don't have it.
Example:
Create a schedule
Define which WhatsApp template to send and what variables it expects. You create it once, then trigger it as many times as you need.
Headers:
Body:
name
string
Yes
A name for this schedule (for your reference)
description
string
No
A description of what this schedule does
template_name
string
Yes
The exact WhatsApp template name (must exist and be approved)
message_variables
string[]
No
Variable names your template uses, in order
buttons
object[]
No
Button definitions (see Advanced sections below)
language
string
No
Template language code (default: en_US)
status
string
No
ACTIVE or INACTIVE (default: ACTIVE)
Response (201):
Save the returned id. This is your configurationId that you will use to trigger messages.
Update a schedule
Update any field of a schedule. Send only the fields you want to change. All fields are optional.
name
string
Schedule name
description
string
Schedule description
template_name
string
WhatsApp template name (must exist and be approved)
message_variables
string[]
Variable names for the template
buttons
object[]
Button definitions
language
string
Template language code
status
string
ACTIVE or INACTIVE
Example: deactivate a schedule
Example: change the template
Trigger a schedule (send a message)
Send a WhatsApp template message to a single phone number.
Headers:
Body:
configurationId
string
Yes
The schedule configuration to trigger. Find it with GET /v1/jobs/schedule.
phoneNumber
string
Yes
E.164 format with a leading + (e.g. +27821234567). Required.
variables
object
Depends
Key-value pairs matching the parameter names from your template
Response (202):
Sending and receiving your own participant data
Variables: how they work
Variables are the dynamic parts of your WhatsApp template. For example, if your template says:
Hi {{1}}, we are conducting research on {{2}}. Press Start to begin.
And the template has parameters defined as ["Name", "Topic"], then:
When creating the schedule:
When triggering, use the exact parameter names:
The result: "Hi Thabo Mokoena, we are conducting research on Customer Satisfaction. Press Start to begin."
Key points:
Variable names must exactly match the parameter names defined in your WhatsApp template.
Variables are a simple flat object -- just
"name": "value"pairs.The order is handled automatically based on the
message_variablesarray.If you're missing a required variable, the API will tell you exactly which ones are needed.
Advanced: templates with URL buttons
If your template has a button that links to a URL with a dynamic part (e.g. a survey link), you can include button variables.
Creating the schedule:
Triggering: all variables go in one flat object
You don't need to separate message variables from button variables. Put everything in variables and the service handles the rest.
Advanced: templates with quick reply buttons
Quick reply buttons let the recipient tap a button to start a campaign or opt out.
Creating the schedule:
Send broadcast
Send a WhatsApp template message to all (or filtered) participants of a study.
Headers:
Body:
templateName
string
Yes
The WhatsApp template name to send
variables
object
No
Key-value pairs for template variables
filterByActivity
UUID
No
Only send to participants in this activity
filterByStatus
string
No
Filter by participant status: active, completed, dropped_out, paused
Error handling
All errors return a JSON body with details about what went wrong.
Template not found
If the template_name you provide doesn't exist for your organisation:
The availableTemplates list shows all approved templates you can use.
Template not approved
If the template exists but hasn't been approved by Meta yet:
Missing variables
If required template variables are not included when triggering a schedule:
Validation error
Schedule configuration not found
Invalid or missing API key
Missing (401):
Invalid (401):
Status codes
200
Success
201
Created successfully
202
Accepted for processing
400
Bad request -- check the error message for details
401
Missing or invalid API key
404
Resource not found (study, schedule, etc.)
429
Rate limit exceeded -- wait and retry
500
Server error -- contact Yazi support
Postman collection
A ready-to-import Postman collection is available. To get started:
Open Postman
Click Import and select the
postman-collection.jsonfileClick the collection name, go to the Variables tab
Fill in:
baseUrl-- the API URL (provided by the Yazi team)apiKey-- your API keystudyId-- a study ID (use the List Studies endpoint to find one)configurationId-- a schedule ID (after creating one, or provided by the Yazi team)
Save and start testing
Need help?
Contact the Yazi team if you need:
Your API key
Help choosing or creating a WhatsApp template
A schedule configuration set up for you
Access to additional endpoints
Any questions about the integration
Last updated