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 notificationContentGetResponse = await client.journeys.templates.retrieveContent('x', {
templateId: 'x',
});
console.log(notificationContentGetResponse.elements);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
notification_content_get_response = client.journeys.templates.retrieve_content(
notification_id="x",
template_id="x",
)
print(notification_content_get_response.elements)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"),
)
notificationContentGetResponse, err := client.Journeys.Templates.GetContent(
context.TODO(),
"x",
courier.JourneyTemplateGetContentParams{
TemplateID: "x",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", notificationContentGetResponse.Elements)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.journeys.templates.TemplateRetrieveContentParams;
import com.courier.models.notifications.NotificationContentGetResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
TemplateRetrieveContentParams params = TemplateRetrieveContentParams.builder()
.templateId("x")
.notificationId("x")
.build();
NotificationContentGetResponse notificationContentGetResponse = client.journeys().templates().retrieveContent(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
notification_content_get_response = courier.journeys.templates.retrieve_content("x", template_id: "x")
puts(notification_content_get_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 {
$notificationContentGetResponse = $client
->journeys
->templates
->retrieveContent('x', templateID: 'x', version: 'version');
var_dump($notificationContentGetResponse);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Journeys.Templates;
CourierClient client = new();
TemplateRetrieveContentParams parameters = new()
{
TemplateID = "x",
NotificationID = "x",
};
var notificationContentGetResponse = await client.Journeys.Templates.RetrieveContent(parameters);
Console.WriteLine(notificationContentGetResponse);courier journeys:templates retrieve-content \
--api-key 'My API Key' \
--template-id x \
--notification-id xcurl --request GET \
--url https://api.courier.com/journeys/{templateId}/templates/{notificationId}/content \
--header 'Authorization: Bearer <token>'{
"version": "2022-01-01",
"elements": [
{
"id": "elem_channel_1",
"type": "channel",
"checksum": "abc123def456",
"elements": [
{
"id": "elem_meta_1",
"type": "meta",
"checksum": "meta_abc123"
},
{
"id": "elem_text_1",
"type": "text",
"checksum": "text_abc123"
}
]
}
]
}{
"message": "Example message text",
"type": "invalid_request_error"
}{
"message": "Example message text",
"type": "invalid_request_error"
}Journeys
Fetch the content of a journey-scoped notification template
Retrieve the elemental content of a journey-scoped notification template. The response contains the versioned elements along with their content checksums, which can be used to detect changes between versions. Pass ?version=draft (default published) to retrieve the working draft, or ?version=vN for a historical version.
GET
/
journeys
/
{templateId}
/
templates
/
{notificationId}
/
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 notificationContentGetResponse = await client.journeys.templates.retrieveContent('x', {
templateId: 'x',
});
console.log(notificationContentGetResponse.elements);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
notification_content_get_response = client.journeys.templates.retrieve_content(
notification_id="x",
template_id="x",
)
print(notification_content_get_response.elements)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"),
)
notificationContentGetResponse, err := client.Journeys.Templates.GetContent(
context.TODO(),
"x",
courier.JourneyTemplateGetContentParams{
TemplateID: "x",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", notificationContentGetResponse.Elements)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.journeys.templates.TemplateRetrieveContentParams;
import com.courier.models.notifications.NotificationContentGetResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
TemplateRetrieveContentParams params = TemplateRetrieveContentParams.builder()
.templateId("x")
.notificationId("x")
.build();
NotificationContentGetResponse notificationContentGetResponse = client.journeys().templates().retrieveContent(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
notification_content_get_response = courier.journeys.templates.retrieve_content("x", template_id: "x")
puts(notification_content_get_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 {
$notificationContentGetResponse = $client
->journeys
->templates
->retrieveContent('x', templateID: 'x', version: 'version');
var_dump($notificationContentGetResponse);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Journeys.Templates;
CourierClient client = new();
TemplateRetrieveContentParams parameters = new()
{
TemplateID = "x",
NotificationID = "x",
};
var notificationContentGetResponse = await client.Journeys.Templates.RetrieveContent(parameters);
Console.WriteLine(notificationContentGetResponse);courier journeys:templates retrieve-content \
--api-key 'My API Key' \
--template-id x \
--notification-id xcurl --request GET \
--url https://api.courier.com/journeys/{templateId}/templates/{notificationId}/content \
--header 'Authorization: Bearer <token>'{
"version": "2022-01-01",
"elements": [
{
"id": "elem_channel_1",
"type": "channel",
"checksum": "abc123def456",
"elements": [
{
"id": "elem_meta_1",
"type": "meta",
"checksum": "meta_abc123"
},
{
"id": "elem_text_1",
"type": "text",
"checksum": "text_abc123"
}
]
}
]
}{
"message": "Example message text",
"type": "invalid_request_error"
}{
"message": "Example message text",
"type": "invalid_request_error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Journey id
Minimum string length:
1Notification template id
Minimum string length:
1Query Parameters
Accepts draft, published, or a version string (e.g., v001). Defaults to published.
List versions of a journey-scoped notification templateReplace the content of a journey-scoped notification template
⌘I