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 response = await client.notifications.retrieveContent('id');
console.log(response);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
response = client.notifications.retrieve_content(
id="id",
)
print(response)package main
import (
"context"
"fmt"
"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Notifications.GetContent(
context.TODO(),
"id",
courier.NotificationGetContentParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.notifications.NotificationRetrieveContentParams;
import com.courier.models.notifications.NotificationRetrieveContentResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
NotificationRetrieveContentResponse response = client.notifications().retrieveContent("id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
response = courier.notifications.retrieve_content("id")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Courier\Client;
use Courier\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');
try {
$response = $client->notifications->retrieveContent('id', version: 'version');
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Notifications;
CourierClient client = new();
NotificationRetrieveContentParams parameters = new() { ID = "id" };
var response = await client.Notifications.RetrieveContent(parameters);
Console.WriteLine(response);courier notifications retrieve-content \
--api-key 'My API Key' \
--id idcurl --request GET \
--url https://api.courier.com/notifications/{id}/content \
--header 'Authorization: Bearer <token>'{
"version": "2022-01-01",
"elements": [
{
"id": "elem_channel_1",
"type": "channel",
"checksum": "abc123def456",
"locales": {
"es": {
"checksum": "es_abc123"
},
"fr": {
"checksum": "fr_abc123"
}
},
"elements": [
{
"id": "elem_meta_1",
"type": "meta",
"checksum": "meta_abc123"
},
{
"id": "elem_text_1",
"type": "text",
"checksum": "text_abc123"
}
]
}
]
}
Templates
Get Notification Content
Returns a template’s content and checksum. V2 templates return Elemental elements, while V1 templates return blocks and channels instead.
GET
/
notifications
/
{id}
/
content
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 response = await client.notifications.retrieveContent('id');
console.log(response);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
response = client.notifications.retrieve_content(
id="id",
)
print(response)package main
import (
"context"
"fmt"
"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Notifications.GetContent(
context.TODO(),
"id",
courier.NotificationGetContentParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.notifications.NotificationRetrieveContentParams;
import com.courier.models.notifications.NotificationRetrieveContentResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
NotificationRetrieveContentResponse response = client.notifications().retrieveContent("id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
response = courier.notifications.retrieve_content("id")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Courier\Client;
use Courier\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');
try {
$response = $client->notifications->retrieveContent('id', version: 'version');
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Notifications;
CourierClient client = new();
NotificationRetrieveContentParams parameters = new() { ID = "id" };
var response = await client.Notifications.RetrieveContent(parameters);
Console.WriteLine(response);courier notifications retrieve-content \
--api-key 'My API Key' \
--id idcurl --request GET \
--url https://api.courier.com/notifications/{id}/content \
--header 'Authorization: Bearer <token>'{
"version": "2022-01-01",
"elements": [
{
"id": "elem_channel_1",
"type": "channel",
"checksum": "abc123def456",
"locales": {
"es": {
"checksum": "es_abc123"
},
"fr": {
"checksum": "fr_abc123"
}
},
"elements": [
{
"id": "elem_meta_1",
"type": "meta",
"checksum": "meta_abc123"
},
{
"id": "elem_text_1",
"type": "text",
"checksum": "text_abc123"
}
]
}
]
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Notification template ID (nt_ prefix).
Query Parameters
Accepts draft, published, or a version string (e.g., v001). Defaults to published.
Response
Template content retrieved.
⌘I