Retrieve Campaign Message
We will be updating our response payload to include a creatorId
field from 27 Jan 2025. Please read the last section to find out where the amendment is and update your own systems if necessary, before 27 Jan 2025.
Retrieves messages and their delivery statuses given a campaign ID, as well as information about the campaign template. Please refer to this table in Possible message statuses and what they mean on what each message status means.
GET /campaigns/:campaignId/messages
Supported Query Parameters
limit
string (Mandatory)
limit
string (Mandatory) You can specify the number of messages to return per page using the limit query parameter. The minimum value is 1, and the maximum value is 1000.
after
string (Optional)
after
string (Optional) Find messages after the cursorId
before
string (Optional)
before
string (Optional) Find messages before the cursorId
search
string (Optional)
search
string (Optional) This supports searching by recipient phone number only. It is a substring match, eg. a "11" would match with "91122233"
[Now to 26 Jan 2025] Example response body
{
"data": [
{
"createdAt": "2024-05-16T17:04:09.071+08:00",
"updatedAt": "2024-05-16T17:05:39.704+08:00",
"id": "<YOUR_MESSAGE_ID>",
"recipient": "6511112222",
"values": {
"otp": "123456",
"name": "tom"
},
"fullMessage": "This is a test message used for training purposes.\n\nOpen Government Products\n\n---\n\nDear tom, here is your 123456.\n\n---\n\nThis is an automated message sent by the Singapore Government.",
"latestStatus": "failure",
"templateBodyId": "<YOUR_TEMPLATE_BODY_ID>",
"campaignId": "<YOUR_CAMPAIGN_ID>",
"templateBody": {
"createdAt": "2024-05-16T16:55:30.736+08:00",
"updatedAt": "2024-05-16T16:55:30.736+08:00",
"id": "<YOUR_TEMPLATE_BODY_ID>",
"templateId": "<YOUR_TEMPLATE_ID>",
"language": "english",
"body": "Dear {{name}}, here is your {{otp}}.",
"creatorId": "<YOUR_CREATOR_ID>"
},
"batches": [
{
"createdAt": "2024-05-16T17:02:59.467+08:00",
"updatedAt": "2024-05-16T17:05:09.690+08:00",
"id": "<YOUR_BATCH_ID>",
"originalFileName": "(sample) API Test.csv",
"status": "messages_enqueued",
"campaignId": "<YOUR_CAMPAIGN_ID>",
"creatorId": "<YOUR_CREATOR_ID>",
"totalMessages": 3,
"BatchMessage": {
"createdAt": "2024-05-16T17:04:09.079+08:00",
"updatedAt": "2024-05-16T17:04:09.079+08:00",
"id": "30234",
"batchId": "<YOUR_BATCH_ID>",
"messageId": "<YOUR_MESSAGE_ID>",
}
}
],
"messageAttempts": [
{
"sentAt": "2024-05-16T17:05:39.702+08:00",
"deliveredAt": null,
"createdAt": "2024-05-16T17:04:09.092+08:00",
"updatedAt": "2024-05-16T17:05:39.702+08:00",
"id": "<YOUR_MESSAGE_ATTEMPT_ID>",
"messageId": "<YOUR_MESSAGE_ID>",
"externalAttemptId": "",
"status": "failure",
"errorType": "delivery_error",
"errorCode": "recipient_unavailable",
"metadata": {},
"creatorId": "<YOUR_CREATOR_ID>",
"creator": {
"email": "<YOUR_GENERATED_CAMPAIGN_EMAIL>"
}
}
],
"language": "english",
"batchId": "<YOUR_BATCH_EMAIL>",
"creatorEmail": "<YOUR_CREATOR_ID>"
"numAttempts": 1
},
{
"createdAt": "2024-05-16T17:04:09.071+08:00",
"updatedAt": "2024-05-16T17:05:09.746+08:00",
"id": "<YOUR_MESSAGE_ID>",
"recipient": "6522222222",
"values": {
"otp": "123456",
"name": "mary"
},
"fullMessage": "This is a test message used for training purposes.\n\nOpen Government Products\n\n---\n\nDear mary, here is your 123456.\n\n---\n\nThis is an automated message sent by the Singapore Government.",
"latestStatus": "failure",
"templateBodyId": "<YOUR_TEMPLATE_BODY_ID>",
"campaignId": "<YOUR_CAMPAIGN_ID>",
"templateBody": {
"createdAt": "2024-05-16T16:55:30.736+08:00",
"updatedAt": "2024-05-16T16:55:30.736+08:00",
"id": "<YOUR_TEMPLATE_BODY_ID>",
"templateId": "<YOUR_TEMPLATE_ID>",
"language": "english",
"body": "Dear {{name}}, here is your {{otp}}.",
"creatorId": "<YOUR_CREATOR_ID>"
},
"batches": [
{
"createdAt": "2024-05-16T17:02:59.467+08:00",
"updatedAt": "2024-05-16T17:05:09.690+08:00",
"id": "<YOUR_BATCH_EMAIL>",
"originalFileName": "(sample) API Test.csv",
"status": "messages_enqueued",
"campaignId": "<YOUR_CAMPAIGN_ID>",
"creatorId": "<YOUR_CREATOR_ID>",
"totalMessages": 3,
"BatchMessage": {
"createdAt": "2024-05-16T17:04:09.079+08:00",
"updatedAt": "2024-05-16T17:04:09.079+08:00",
"id": "30235",
"batchId": "<YOUR_BATCH_ID>",
"messageId": "<YOUR_MESSAGE_ID>"
}
}
],
"messageAttempts": [
{
"sentAt": "2024-05-16T17:05:09.743+08:00",
"deliveredAt": null,
"createdAt": "2024-05-16T17:04:09.092+08:00",
"updatedAt": "2024-05-16T17:05:09.743+08:00",
"id": "<YOUR_MESSAGE_ATTEMPT_ID>",
"messageId": "<YOUR_MESSAGE_ID>",
"externalAttemptId": "",
"status": "failure",
"errorType": "server_error",
"errorCode": "server_unknown_error",
"metadata": {},
"creatorId": "<YOUR_CREATOR_ID>",
"creator": {
"email": "<YOUR_CREATOR_EMAIL>"
}
}
],
"language": "english",
"batchId": "<YOUR_BATCH_EMAIL>",
"creatorEmail": "<YOUR_CREATOR_ID>",
"numAttempts": 1
},
{
"createdAt": "2024-05-16T17:04:09.071+08:00",
"updatedAt": "2024-05-16T17:04:09.071+08:00",
"id": "message_6e4fedf2-9377-50ef-8457-81cb1f1c8831",
"recipient": "6599999999",
"values": {
"otp": "123456",
"name": "john"
},
"fullMessage": "This is a test message used for training purposes.\n\nOpen Government Products\n\n---\n\nDear john, here is your 123456.\n\n---\n\nThis is an automated message sent by the Singapore Government.",
"latestStatus": "created",
"templateBodyId": "<YOUR_TEMPLATE_BODY_ID>",
"campaignId": "<YOUR_CAMPAIGN_ID>",
"templateBody": {
"createdAt": "2024-05-16T16:55:30.736+08:00",
"updatedAt": "2024-05-16T16:55:30.736+08:00",
"id": "template-body_6df15c76-cbd4-4c5b-ac8b-c66fefaf634a",
"templateId": "template_738af768-8050-41d6-8bc5-2a140b5b67df",
"language": "english",
"body": "Dear {{name}}, here is your {{otp}}.",
"creatorId": "<YOUR_CREATOR_ID>"
},
"batches": [
{
"createdAt": "2024-05-16T17:02:59.467+08:00",
"updatedAt": "2024-05-16T17:05:09.690+08:00",
"id": "batch_f1896233-7f4e-4162-bdd5-888fcf5e85c9",
"originalFileName": "(sample) API Test.csv",
"status": "messages_enqueued",
"campaignId": "<YOUR_CAMPAIGN_ID>",
"creatorId": "<YOUR_CREATOR_ID>",
"totalMessages": 3,
"BatchMessage": {
"createdAt": "2024-05-16T17:04:09.079+08:00",
"updatedAt": "2024-05-16T17:04:09.079+08:00",
"id": "30233",
"batchId": "<YOUR_BATCH_ID>",
"messageId": "<YOUR_MESSAGE_ID>"
}
}
],
"messageAttempts": [
{
"sentAt": "2024-05-16T17:05:39.757+08:00",
"deliveredAt": null,
"createdAt": "2024-05-16T17:04:09.092+08:00",
"updatedAt": "2024-05-16T17:05:39.757+08:00",
"id": "<YOUR_MESSAGE_ATTEMPT_ID>",
"messageId": "<YOUR_MESSAGE_ID>",
"externalAttemptId": "<YOUR_EXTERNAL_ATTEMPT_ID>",
"status": "sent",
"errorType": null,
"errorCode": null,
"metadata": {},
"creatorId": "<YOUR_CREATORN_ID>",
"creator": {
"email": "<YOUR_GENERATED_CAMPAIGN_EMAIL>"
}
}
],
"language": "english",
"batchId": "batch_f1896233-7f4e-4162-bdd5-888fcf5e85c9",
"creatorEmail": "campaign_da25c9b7-7540-4ca4-aa4a-66d4d7ddcd7b@postman.gov.sg",
"numAttempts": 1
},
{
"createdAt": "2024-05-16T16:57:53.761+08:00",
"updatedAt": "2024-05-16T16:58:06.526+08:00",
"id": "<YOUR_MESSAGE_ID>",
"recipient": "6599999999",
"values": {
"otp": "12345",
"name": "John Doe"
},
"fullMessage": "This is a test message used for training purposes.\n\nOpen Government Products\n\n---\n\nDear John Doe, here is your 12345.\n\n---\n\nThis is an automated message sent by the Singapore Government.",
"latestStatus": "success",
"templateBodyId": "<YOUR_TEMPLATE_BODY_ID>",
"campaignId": "<YOUR_CAMPAIGN_ID>",
"templateBody": {
"createdAt": "2024-05-16T16:55:30.736+08:00",
"updatedAt": "2024-05-16T16:55:30.736+08:00",
"id": "<YOUR_TEMPLATE_BODY_ID>",
"templateId": "<YOUR_TEMPLATE_ID>",
"language": "english",
"body": "Dear {{name}}, here is your {{otp}}.",
"creatorId": "<YOUR_CREATOR_ID>"
},
"batches": [],
"messageAttempts": [
{
"sentAt": "2024-05-16T16:57:53.908+08:00",
"deliveredAt": null,
"createdAt": "2024-05-16T16:57:53.763+08:00",
"updatedAt": "2024-05-16T16:58:06.525+08:00",
"id": "<YOUR_MESSAGE_ATTEMPT_ID>",
"messageId": "<YOUR_MESSAGE_ID>",
"externalAttemptId": "<YOUR_EXTERNAL_ATTEMPT_ID>",
"status": "success",
"errorType": null,
"errorCode": null,
"metadata": {},
"creatorId": "<YOUR_CREATOR_ID>",
"creator": {
"email": "<YOUR_CREATOR_EMAIL>"
}
}
],
"language": "english",
"creatorEmail": "<YOUR_CREATOR_EMAIL>",
"numAttempts": 1
}
],
"pageData": {
"hasNextPage": false,
"hasPreviousPage": false,
"startCursor": "WyIyMDI0LTA1LTE2VDE3OjA0OjA5LjA3MSswODowMCIsIm1lc3NhZ2VfZTgxN2NjM2EtMTA0NC01ODYxLWJmZDUtMDMwM2IwYzczYjcxIl0=",
"endCursor": "WyIyMDI0LTA1LTE2VDE2OjU3OjUzLjc2MSswODowMCIsIm1lc3NhZ2VfZDhiNWY5M2QtZDgyYi00NWRkLWIyZTctMWYxMTlmMjUwMTcyIl0="
}
}
[From 27 Jan 2025] The creatorId
field will be inserted in the response payload for each message object from 27 Jan 2025. In this above example it will be inserted once per message object i.e. total of 4 times. Please amend your own code accordingly for
"creatorId": "<USER_ID_OF_MESSAGE_CREATOR>"
Last updated