Setting up event-triggers
This document outlines how to programmatically trigger scheduled messages in Yazi through the API.
Overview
The Yazi API allows you to:
Retrieve available schedule configurations
Trigger specific schedule configurations to send messages to customers
Setup Process
Step 1: Create the Schedule in Yazi Web App
Navigate to the schedules section in your Yazi dashboard
Click "Create Event Triggered Schedule"
Configure the schedule details:
Select a message template
Provide a name and description
Configure any buttons to link to campaigns (e.g., connecting a "Start" button to a survey campaign)
Set activation status
Save the schedule
Step 2: Get the Schedule Configuration ID
Make a GET request to
https://api.askyazi.co/schedule-job/{organisationId}
Include your API key in the header
organisationId
is in the Settings page in the Yazi platformFrom the response, locate the schedule you created and note its
id
(this is yourconfigurationId
)
Step 3: Trigger the Schedule
Make a POST request to
https://api.askyazi.co/schedule-job/{organisationId}/{configurationId}
Include your API key in the header
Provide the phone number and any necessary variables in the request body
Receive confirmation of successful processing
Authentication
All API requests require an API key which should be included in the request headers:
You can find your API key in your Yazi dashboard settings.
Endpoints
1. Get Available Schedule Configurations
Retrieves all schedule configurations for your organisation.
Request:
Headers:
Response Example:
From this response, take note of the id
field of the configuration you want to trigger. This is your configurationId
.
2. Trigger a Scheduled Message
Sends a message based on a predefined schedule configuration.
Request:
Headers:
Request Body:
Basic (no variables):
With message and button variables:
Response Example:
Variables
Two types of variables can be included in the request:
Message Variables: Used to replace placeholders in the message template
Button Variables: Used to dynamically set campaign IDs for buttons
Important Notes
The
phone_number
parameter should include the country code without a plus symbol (e.g., "27609463829" for South Africa)The API key is organization-specific and should be kept secure
Button indices start at 0 for the first button in your template
All requests will return a 200 status code on success with a confirmation message
Last updated