1. Home
  2. Extra
  3. Samba API
  4. Export SMS events via API

Export SMS events via API

Contents

This post is also available in: Czech

By using this API you can get a list of all events related to SMS message processing. You can query for a specific time interval <from,to> when the event should have occurred.

Endpoint URL

Depending on your account, select the appropriate endpoint URL.

  • If you are logging in at app.samba.ai –> choose the URL api.samba.ai
  • If you are logging in at enterprise.samba.ai –> choose the URL api.yottly.com

Your Trackpoint ID can be found in the Settings > Overview section.

POST

https://api.samba.ai/shop/trackpointId/export-sms-events
header: X-Api-Key: your-api-key
{"from": timestamp, "to": timestamp}
  • trackpointId – Trackpoint ID of your eshop
  • your-api-key – Samba API key for your eshop
  • from, to – [optional] timestamp of the event in milliseconds
    • If from parameter is omitted, then it is automatically set to to - 90 days.
    • If to parameter is omitted, then it is automatically set to the minimum of now() and from + 90 days.
    • If both to and from parameters are omitted, request body has to be set to {}. In this case, to is automatically set to now() and from is set to now() - 90 days.
    • The history of the last 90 days is always available.

RESPONSE

  • format: JSON stream, one json object per line (application/json-seq)
{
"smsEvent":{
"trackpoint": trackpointId,
"userId": "user id",
"status": "STATUS",
"date": 1654853160310
},
"source":{
"type":"flow",
"campaign":{
"id": "campaignId",
"name": "campaignName"
},
"node":{
"id": "nodeId",
"name": "nodenName"
},
"sendDate":1654853160010
}
}
  • trackpoint: trackpoint ID of the Samba account
  • userId: user ID of the SMS recipient 
  • status: one of these events
    • DELIVERED, ACCEPTED, EXPIRED, DELETED, UNDELIVERABLE, REJECTED, SKIPPED

  • date: timestamp in milliseconds when the event occurred
  • source: identification of the campaign
    • "type": "one-off" – One-off SMS campaign
      • campaign id, name
    • "type": "flow" – SMS node in the Flow campaign
      • campaign id, name
      • node id, name
    • sendDate: timestamp in milliseconds when the message was sent

EXAMPLE

curl -d '{"from": 1673617501000, "to": 1676380261000}' -H 'X-Api-Key: key' 'https://api.samba.ai/shop/4541245641234564/export-sms-events'
 
{
"smsEvent":{
"trackpoint": 4541245641234564,
"userId": "123456",
"status": "DELIVERED",
"date": 1673763160310
},
"source":{
"type":"one-off",
"campaign":{
"id": "b2c8c642-ad39-11ed-afa1-0242ac120002",
"name": "Black Friday"
},
"sendDate":1673763160010
}
}
{
"smsEvent":{
"trackpoint": 4541245641234564,
"userId": "123456",
"status": "DELIVERED",
"date": 1673753160310
},
"source":{
"type":"flow",
"campaign":{
"id": "cd434c68-ad39-11ed-afa1-0242ac120002",
"name": "Retention"
},
"node":{
"id": "32411fb4-ad3a-11ed-afa1-0242ac120002",
"name": "Retention VIP SMS"
},
"sendDate":1673753160010
}
}

This post is also available in: Czech

Updated on January 5, 2024

Was this article helpful?

Related Articles