2. Create your first campaign π€³
With your API key in hand, you're ready to kick off your first campaign. In this guide, we'll focus on creating an SMS campaign, the perfect way to engage with your audience through text messages. Let's get started!
Making Your First Request
Specify the URL
To initiate an SMS campaign, send a POST request to the following endpoint:
POST https://api-uat.gliderpay.com/v2/campaign/invoiceBatch/sms
Authorization: Bearer {{token}}
POST https://api.gliderpay.com/v2/campaign/invoiceBatch/sms
Authorization: Bearer {{token}}
β οΈ Remember to replace {{token}}
with your unique API token.
Specify Request Body
Include the following details in the body of your request:
{
"name": "GLIDER Campaign",
"template": "Hi {{name}}! β¦",
"recipients": [
{
"mobile": "+61432222000",
"name": "John Doe",
"account_number": "22222",
"amount": 5000
}
]
}
- name: A unique name for your campaign.
- template: Your SMS message template, with personalised placeholders like
{{name}}
. - recipients: An array with recipient details, including mobile number, name, account number, and amount.
Ensure the mobile number you specify is accurate, as actual SMS will be sent to it.
Initiating the API Call
Once you trigger the API call, you'll receive a response indicating the success or failure of the request. Here's what you can expect:
Successful API Call Response:
Upon a successful API call, you'll receive a response similar to the following. Please note that the invoice_id
and campaign_id
may vary.
{
"name": "GLIDER Campaign",
"recipients": [
{
"account_number": "22222",
"invoice_id": 192324,
"mobile": "+61432222000"
}
],
"id": 5444,
"status": 2,
"numberOfRecords": 1,
"numberOfInvoices": 1,
"channel": "mobile",
"isInstalment": false,
"errors": []
}
Additionally, you'll receive an SMS sent to the phone number specified in the API call.
Failed API Call Response:
If the API call encounters an error, you'll receive a response detailing the issue, including the HTTP status code, error message, method used, URL accessed, and additional metadata for troubleshooting:
{
"code": 400,
"name": "Error",
"method": "POST",
"message": "Name must be unique",
"meta": {
"name": "GLIDER Campaign",
"template": "Hi {{name}}! β¦",
"recipients": [
{
"mobile": "0413083368",
"name": "John Doe",
"account_number": "22222",
"amount": 5000
}
]
}
}
Congratulations! You've just initiated your first SMS campaign through our API. π
Updated 10 months ago