Get sample payload
Returns the payload the trigger of the workflow would produce, so you know which fields your conditions and
placeholders can use and what to send to Test workflow. Pass contact_id to fill the contact
part with one of your contacts; without it a generic test contact is used. Send the parameter as query string.
Base URL:
GET: https://api.smsgatewayapi.com/v1/flows/{flow_id}/sample-payloadExample:
GET: https://api.smsgatewayapi.com/v1/flows/flw_5d41402abc4b2a76b9719d911017c592/sample-payload
| Parameter | Input | Description | |
|---|---|---|---|
| client_id | API client ID | Developer › API & Webhooks › API credentials | Required |
| client_secret | API client secret | A cs_ credential, shown once when you create it under Developer › API & Webhooks › API credentials | Required |
| flow_id | workflow ID | The public ID (flw_...) of the workflow as returned by List workflows; the numeric ID is accepted too | Required |
| contact_id | contact ID | Public ID (con_...) or numeric ID of one of your contacts | Optional |
<?php
//PHP - cURL
$ch = curl_init();
$url = "https://api.smsgatewayapi.com/v1/flows/{flow_id}/sample-payload";
$client_id = "XXX"; // Your API client ID (required)
$client_secret = "YYY"; // Your API client secret (required)
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-Client-Id: $client_id",
"X-Client-Secret: $client_secret",
"Content-Type: application/json",
]);
$response = curl_exec($ch);
?>
Example request:
GET: https://api.smsgatewayapi.com/v1/flows/flw_5d41402abc4b2a76b9719d911017c592/sample-payload?contact_id=con_5d41402abc4b2a76b9719d911017c592
Example success response (inbound_message trigger):
{
"message": {
"body": "Test message",
"channel": "sms",
"inbox_id": 0
},
"contact": {
"phone": "32470123456",
"name": "Jane Doe",
"firstname": "Jane",
"lastname": "Doe",
"group_id": "115113",
"country_code": "BE",
"opted_out": false,
"extra1": "vip",
"extra2": null,
"extra3": null,
"extra4": null,
"extra5": null,
"extra6": null,
"extra7": null,
"extra8": null,
"extra9": null,
"extra10": null
},
"system": []
}
A delivery_report trigger adds delivery_report.status; birthday and cron triggers return only contact and system (birthday with contact.birthday and contact.age).
Example error response:
{
"error": 139,
"errorMsg": "Contact con_5d41402abc4b2a76b9719d911017c592 not found"
}