Retrieve Batch

Retrieves messages and their delivery statuses given a batch ID. Please refer to this table in possible message statuses and what they mean on what each message status means.

Endpoint #6
GET /campaigns/:campaignId/batch/:batchId/messages

Supported Query Parameters

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)

Find messages after the cursorId

before string (Optional)

Find messages before the cursorId

search string (Optional)

This supports searching by recipient phone number only.

It is a substring match, eg. a "11" would match with "91122233"

Example response body
{
    "data": [
        {
            "createdAt": "2024-05-16T16:34:06.582+08:00",
            "updatedAt": "2024-05-16T16:35:13.122+08:00",
            "id": "<YOUR_MESSAGE_ID>",
            "recipient": "6522222222",
            "values": {
                "body": "test"
            },
            "fullMessage": "This is a test message used for training purposes.\n\nOpen Government Products\n\n---\n\ntest\n\n---\n\nThis is an automated message sent by the Singapore Government.",
            "latestStatus": "failure",
            "templateBodyId": "<YOUR_GENERATED_TEMPLATE_ID>",
            "campaignId": "<YOUR_GENERATED_CAMPAIGN_ID>",
            "templateBody": {
                "createdAt": "2024-05-06T11:00:03.467+08:00",
                "updatedAt": "2024-05-06T11:00:03.467+08:00",
                "id": "<YOUR_GENERATED_TEMPLATE_BODY_ID>",
                "templateId": "<YOUR_GENERATED_TEMPLATE_ID>",
                "language": "english",
                "body": "{{body}}",
                "creatorId": "<YOUR_GENERATED_CREATOR_ID>"
            },
            "messageAttempts": [
                {
                    "sentAt": "2024-05-16T16:35:13.118+08:00",
                    "deliveredAt": null,
                    "createdAt": "2024-05-16T16:34:06.604+08:00",
                    "updatedAt": "2024-05-16T16:35:13.118+08:00",
                    "id": "<YOUR_GENERATED_MESSAGE_ATTEMPT_ID>",
                    "messageId": "<YOUR_GENERATED_MESSAGE_ID>",
                    "externalAttemptId": "",
                    "status": "failure",
                    "errorType": "server_error",
                    "errorCode": "server_unknown_error",
                    "metadata": {},
                    "creatorId": "<YOUR_GENERATED_CREATOR_ID>",
                    "creator": {
                        "email": "<YOUR_GENERATED_CAMAPIGN_CREATOR_EMAIL>"
                    }
                }
            ],
            "language": "english",
            "creatorEmail": "<YOUR_GENERATED_CAMPAIGN_CREATOR_EMAIL>",
            "numAttempts": 1
        },
        {
            "createdAt": "2024-05-16T16:34:06.582+08:00",
            "updatedAt": "2024-05-16T16:35:13.093+08:00",
            "id": "<YOUR_GENERATED_MESSAGE_ID>",
            "recipient": "6511119999",
            "values": {
                "body": "test"
            },
            "fullMessage": "This is a test message used for training purposes.\n\nOpen Government Products\n\n---\n\ntest\n\n---\n\nThis is an automated message sent by the Singapore Government.",
            "latestStatus": "failure",
            "templateBodyId": "<YOUR_GENERATED_TEMPLATE_ID>",
            "campaignId": "<YOUR_GENERATED_CAMPAIGN_ID>",
            "templateBody": {
                "createdAt": "2024-05-06T11:00:03.467+08:00",
                "updatedAt": "2024-05-06T11:00:03.467+08:00",
                "id": "<YOUR_GENERATED_TEMPLATE_BODY_ID>",
                "templateId": "<YOUR_GENERATED_TEMPLATE_ID>",
                "language": "english",
                "body": "{{body}}",
                "creatorId": "<YOUR_GENERATED_CREATOR_ID>"
            },
            "messageAttempts": [
                {
                    "sentAt": "2024-05-16T16:35:13.089+08:00",
                    "deliveredAt": null,
                    "createdAt": "2024-05-16T16:34:06.604+08:00",
                    "updatedAt": "2024-05-16T16:35:13.090+08:00",
                    "id": "<YOUR_GENERATED_MESSAGE_ATTEMPT_ID>",
                    "messageId": "<YOUR_GENERATED_MESSAGE_ID>",
                    "externalAttemptId": "",
                    "status": "failure",
                    "errorType": "delivery_error",
                    "errorCode": "delivery_unknown_error",
                    "metadata": {},
                    "creatorId": "<YOUR_GENERATED_CREATOR_ID>",
                    "creator": {
                        "email": "<YOUR_GENERATED_CAMAPIGN_CREATOR_EMAIL>"
                    }
                }
            ],
            "language": "english",
            "creatorEmail": <YOUR_GENERATED_CAMAPIGN_CREATOR_EMAIL>,
            "numAttempts": 1
        },
        {
            "createdAt": "2024-05-16T16:34:06.582+08:00",
            "updatedAt": "2024-05-16T16:36:05.595+08:00",
            "id": <YOUR_GENERATED_MESSAGE_ID>,
            "recipient": "6599999999",
            "values": {
                "body": "test"
            },
            "fullMessage": "This is a test message used for training purposes.\n\nOpen Government Products\n\n---\n\ntest\n\n---\n\nThis is an automated message sent by the Singapore Government.",
            "latestStatus": "success",
            "templateBodyId": "<YOUR_GENERATED_TEMPLATE_ID>",
            "campaignId": "<YOUR_GENERATED_CAMPAIGN_ID>",
            "templateBody": {
                "createdAt": "2024-05-06T11:00:03.467+08:00",
                "updatedAt": "2024-05-06T11:00:03.467+08:00",
                "id": "<YOUR_GENERATED_TEMPLATE_BODY_ID>",
                "templateId": "<YOUR_GENERATED_TEMPLATE_ID>",
                "language": "english",
                "body": "{{body}}",
                "creatorId": "<YOUR_GENERATED_CREATOR_ID>"
            },
            "messageAttempts": [
                {
                    "sentAt": "2024-05-16T16:35:43.009+08:00",
                    "deliveredAt": null,
                    "createdAt": "2024-05-16T16:34:06.604+08:00",
                    "updatedAt": "2024-05-16T16:36:05.593+08:00",
                    "id": "<YOUR_GENERATED_MESSAGE_ATTEMPT_ID>",
                    "messageId": "<YOUR_GENERATED_MESSAGE_ID>",
                    "externalAttemptId": "<YOUR_GENERATED_EXTERNAL_ATTEMPT_ID>",
                    "status": "success",
                    "errorType": null,
                    "errorCode": null,
                    "metadata": {},
                    "creatorId": "<YOUR_GENERATED_CREATOR_ID>",
                    "creator": {
                        "email": "<YOUR_GENERATED_CAMAPIGN_CREATOR_EMAIL>"
                    }
                }
            ],
            "language": "english",
            "creatorEmail": <YOUR_GENERATED_CAMAPIGN_CREATOR_EMAIL>,
            "numAttempts": 1
        }
    ],
    "pageData": {
        "hasNextPage": false,
        "hasPreviousPage": false,
        "startCursor": "WyIyMDI0LTA1LTE2VDE2OjM0OjA2LjU5MCswODowMCIsIjMwMjE5Il0=",
        "endCursor": "WyIyMDI0LTA1LTE2VDE2OjM0OjA2LjU5MCswODowMCIsIjMwMjE3Il0="
    }
}

Last updated