> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/cloud/sms/campaigns/log.md).

# Message log

Read one SMS of a campaign — who got it, what it said, and what went wrong if it failed.

**Where:** SMS → Campaigns → **View** → a batch → a message · inside `/projects/<project>/sms/campaigns/<id>/view`

## Before you start

* The campaign has at least one batch — see [Campaign details](/codemash/cloud/sms/campaigns/details.md).
* You need the `sms:read` permission on SMS campaigns.

## Steps

1. Open the campaign's [details page](/codemash/cloud/sms/campaigns/details.md) and press a batch card. The **Batch** view lists its messages: the phone number, the message id (`ntf_…`), the time and the status. **Back** returns to the campaign.

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-1f6eeaf1dbbcb4bf197ed5429d915f88f380947d%2Fcampaigns-log-1.png?alt=media" alt="Batch cmpb_4dXMLWkzgEBHtnFMWcIEuu Completed with three messages: +37060000003, +37060000002 and +37060000001, each with its ntf_ id and Completed"><figcaption><p>The messages of one batch.</p></figcaption></figure>

   A batch that failed as a whole shows a red **Batch has errors** box.
2. Press a message. **SMS Details** shows a timeline:

   * **Batch processed** — the batch id.
   * **Delivery Strategy** — *Delivery strategy from campaign.*: the recipients rule (all users, the users, the phone numbers, or the collection with **Schema:** and **Fields:**) and a link to the **Template**.
   * **Receiver(s)** — the phone number and the time of the last status.
   * **SMS Errors** — only when the message failed: each error with its time.
   * **SMS message** — the text exactly as it was sent, with the tokens filled in, and the `x / 160 characters` counter.

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-02f16541cef41712d67dc80493f1dd24766b7103%2Fcampaigns-log-2.png?alt=media" alt="SMS Details of one ntf_ message: Batch processed, Delivery Strategy Recipients (All users) and Template Winter sale, Receiver(s) +37060000001, and the SMS message Acme winter sale: 20% off everything until Sunday. Shop at acme.example, 71 / 160 characters"><figcaption><p>One message of the Winter sale campaign.</p></figcaption></figure>
3. Press **Back** to return to the batch.

## Result

You know what one person received: no **SMS Errors** block and the finished text under **SMS message** means the message was handed to the provider. With the Fake provider the message is recorded as sent and nothing reaches a phone.

The batch and message views have no address of their own: the address bar keeps `…/campaigns/<id>/view`, so a reload or a copied link opens the campaign again, not the message. Open a message from its campaign.

## Change or remove it later

* A single message cannot be changed or deleted. Deleting the campaign on its [details page](/codemash/cloud/sms/campaigns/details.md#change-or-remove-it-later) deletes its batches and message log with it.
* A message can be shown without signing in through its signed **preview link** — see [Preview link](/codemash/cloud/concepts/message-templates/preview-link.md).

## Do it from code

You need the campaign id and the batch id.

```ts
const { list } = await norbix.hub.notifications.getSmsCampaignMessages({
  campaignId: 'cmp_2lIlYHe8UpSd9mz1fv0Bw9',
  campaignBatchId: 'cmpb_4dXMLWkzgEBHtnFMWcIEuu',
});
console.log(list.items.map((m) => `${m.recipients.to[0].phoneNumber}: ${m.body}`));
// [ '+37060000003: Acme winter sale: 20% off everything until Sunday. Shop at acme.example', … ]
```

```sh
norbix hub notifications sms campaign messages get --campaignId cmp_2lIlYHe8UpSd9mz1fv0Bw9 --campaignBatchId cmpb_4dXMLWkzgEBHtnFMWcIEuu
```

The client setup is on the [SMS page](/codemash/cloud/sms.md#use-it-from-code). API: [Get Sms Campaign Messages](/codemash/api-reference/notifications/sms/get-sms-campaign-messages.md) · [Get Sms Campaign Batch Notification](/codemash/api-reference/notifications/sms/get-sms-campaign-batch-notification.md) (one message, by its `ntf_…` id)
