Send one message to a list of people, on one or more channels, and read the result. These calls take
a login token: see Authentication.
One at a time with Create a contact, or many at once from a file with
Import contacts from CSV.
curl -X POST https://api.veloconnect.me/api/v2/contacts \
-H "Authorization: Bearer <login token>" -H "Content-Type: application/json" \
-d '{"firstName": "Anna", "lastName": "Petrosyan", "phoneNumber": "+37491234567", "externalReference": "CRM-1042"}'
Each channel reads its own kind of contact detail: SMS reads Phone, Viber reads Viber, WhatsApp reads
WhatsApp, e-mail reads Email. The CSV import saves a phone number as all three phone kinds for you.
Create a contact does not look for duplicates, so check before you add.
Create a segment with the contact ids, and keep the segment id.
curl -X POST https://api.veloconnect.me/api/v2/segments \
-H "Authorization: Bearer <login token>" -H "Content-Type: application/json" \
-d '{"name": "Yerevan customers", "contactIds": [5301, 5302, 5310]}'
| For | Call |
|---|---|
SMS and e-mail sender (senderId) | List sender names |
SMS rate plan (customerTrunkId) | List trunks |
Message templates (templateId) | List message templates |
Create a campaign. This example tries Viber first and sends an SMS to everyone Viber cannot
reach:
curl -X POST https://api.veloconnect.me/api/v2/campaigns \
-H "Authorization: Bearer <login token>" -H "Content-Type: application/json" \
-d '{
"name": "Order ready",
"segmentIds": [57],
"channels": [
{"providerType": "Viber", "priorityOrder": 1, "communicationType": "Trasnsactional", "templateId": 318},
{"providerType": "SMS", "priorityOrder": 2, "communicationType": "Trasnsactional",
"message": "Hello {{name|customer}}, your order is ready for pickup. MyBrand",
"senderId": 124, "customerTrunkId": 18}
]
}'
{"data": ["3f2b8c1e-5d47-4a9b-9c0e-7a1d2e3f4b5c"]}
The value Trasnsactional is spelt this way in the API.
Without scheduleDate the campaign starts at the next 5-minute mark (UTC). With scheduleDate and
timezone it starts then.
The price is worked out and the balance is checked when sending starts, not when you create the campaign.
Preview campaign recipients shows how many people each channel will reach and who cannot be
reached, with the reason. Nothing is sent.
Get a campaign returns the status and the counters.
status | Meaning |
|---|---|
Scheduled | Waiting to start. |
InProcess | Sending. |
Completed | Finished; nobody failed or was skipped. |
PartiallyFinished | Finished; some were sent, some failed or were skipped. |
Failed | Finished; nothing was sent. |
InsufficientCredits | The balance was too low when sending started; nothing was sent. |
totalSentCount is final when sending ends. totalDeliveredCount keeps growing as delivery reports come in,
so read the campaign again later for the final figure.