Skip to main content
PUT
/
notifications
/
{id}
/
elements
/
{elementId}
JavaScript
import Courier from '@trycourier/courier';

const client = new Courier({
  apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});

const notificationContentMutationResponse = await client.notifications.putElement('elementId', {
  id: 'id',
  type: 'text',
  data: { content: 'Updated text content' },
  state: 'DRAFT',
});

console.log(notificationContentMutationResponse.id);
{
  "id": "nt_01abc123",
  "version": "2022-01-01",
  "elements": [
    {
      "id": "elem_1",
      "checksum": "abc123"
    },
    {
      "id": "elem_2",
      "checksum": "def456"
    }
  ],
  "state": "DRAFT"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

Notification template ID (nt_ prefix).

elementId
string
required

Element ID within the template.

Body

application/json

Request body for updating a single element. Additional type-specific fields are allowed.

type
string
required

Element type (text, meta, action, image, etc.).

channels
string[]
data
object
if
string
loop
string
ref
string
state
enum<string>
default:DRAFT

Template state. Defaults to DRAFT.

Available options:
DRAFT,
PUBLISHED

Response

Element updated.

Shared mutation response for PUT content, PUT element, and PUT locale operations. Contains the template ID, content version, per-element checksums, and resulting state.

id
string
required

Template ID.

version
string
required

Content version identifier.

elements
object[]
required
state
enum<string>
default:DRAFT
required

Template state. Defaults to DRAFT.

Available options:
DRAFT,
PUBLISHED