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 baseTemplateTenantAssociation = await client.tenants.templates.retrieve('template_id', {
tenant_id: 'tenant_id',
});
console.log(baseTemplateTenantAssociation.id);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
base_template_tenant_association = client.tenants.templates.retrieve(
template_id="template_id",
tenant_id="tenant_id",
)
print(base_template_tenant_association.id)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"),
)
baseTemplateTenantAssociation, err := client.Tenants.Templates.Get(
context.TODO(),
"template_id",
courier.TenantTemplateGetParams{
TenantID: "tenant_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", baseTemplateTenantAssociation.ID)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.tenants.BaseTemplateTenantAssociation;
import com.courier.models.tenants.templates.TemplateRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
TemplateRetrieveParams params = TemplateRetrieveParams.builder()
.tenantId("tenant_id")
.templateId("template_id")
.build();
BaseTemplateTenantAssociation baseTemplateTenantAssociation = client.tenants().templates().retrieve(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
base_template_tenant_association = courier.tenants.templates.retrieve("template_id", tenant_id: "tenant_id")
puts(base_template_tenant_association)<?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 {
$baseTemplateTenantAssociation = $client->tenants->templates->retrieve(
'template_id', tenantID: 'tenant_id'
);
var_dump($baseTemplateTenantAssociation);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Tenants.Templates;
CourierClient client = new();
TemplateRetrieveParams parameters = new()
{
TenantID = "tenant_id",
TemplateID = "template_id",
};
var baseTemplateTenantAssociation = await client.Tenants.Templates.Retrieve(parameters);
Console.WriteLine(baseTemplateTenantAssociation);courier tenants:templates retrieve \
--api-key 'My API Key' \
--tenant-id tenant_id \
--template-id template_idcurl --request GET \
--url https://api.courier.com/tenants/{tenant_id}/templates/{template_id} \
--header 'Authorization: Bearer <token>'{
"id": "tenant_abc",
"created_at": "2024-01-15T10:30:00.000Z",
"updated_at": "2024-01-15T10:30:00.000Z",
"published_at": "2024-01-15T10:30:00.000Z",
"version": "string",
"data": {
"routing": {
"method": "all",
"channels": [
"string"
]
},
"content": {
"version": "string",
"elements": [
{
"type": "text",
"channels": [
"string"
],
"ref": "string",
"if": "string",
"loop": "string",
"content": "string",
"align": "left",
"text_style": "text",
"color": "string",
"bold": "string",
"italic": "string",
"strikethrough": "string",
"underline": "string",
"locales": {
"locales_key": {
"content": "string"
}
},
"format": "markdown"
}
]
}
}
}{
"message": "Example message text",
"type": "invalid_request_error"
}Tenant Templates
Get a Template in Tenant
Returns a tenant’s notification template with its content, version, and created, updated, and published timestamps.
GET
/
tenants
/
{tenant_id}
/
templates
/
{template_id}
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 baseTemplateTenantAssociation = await client.tenants.templates.retrieve('template_id', {
tenant_id: 'tenant_id',
});
console.log(baseTemplateTenantAssociation.id);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
base_template_tenant_association = client.tenants.templates.retrieve(
template_id="template_id",
tenant_id="tenant_id",
)
print(base_template_tenant_association.id)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"),
)
baseTemplateTenantAssociation, err := client.Tenants.Templates.Get(
context.TODO(),
"template_id",
courier.TenantTemplateGetParams{
TenantID: "tenant_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", baseTemplateTenantAssociation.ID)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.tenants.BaseTemplateTenantAssociation;
import com.courier.models.tenants.templates.TemplateRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
TemplateRetrieveParams params = TemplateRetrieveParams.builder()
.tenantId("tenant_id")
.templateId("template_id")
.build();
BaseTemplateTenantAssociation baseTemplateTenantAssociation = client.tenants().templates().retrieve(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
base_template_tenant_association = courier.tenants.templates.retrieve("template_id", tenant_id: "tenant_id")
puts(base_template_tenant_association)<?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 {
$baseTemplateTenantAssociation = $client->tenants->templates->retrieve(
'template_id', tenantID: 'tenant_id'
);
var_dump($baseTemplateTenantAssociation);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Tenants.Templates;
CourierClient client = new();
TemplateRetrieveParams parameters = new()
{
TenantID = "tenant_id",
TemplateID = "template_id",
};
var baseTemplateTenantAssociation = await client.Tenants.Templates.Retrieve(parameters);
Console.WriteLine(baseTemplateTenantAssociation);courier tenants:templates retrieve \
--api-key 'My API Key' \
--tenant-id tenant_id \
--template-id template_idcurl --request GET \
--url https://api.courier.com/tenants/{tenant_id}/templates/{template_id} \
--header 'Authorization: Bearer <token>'{
"id": "tenant_abc",
"created_at": "2024-01-15T10:30:00.000Z",
"updated_at": "2024-01-15T10:30:00.000Z",
"published_at": "2024-01-15T10:30:00.000Z",
"version": "string",
"data": {
"routing": {
"method": "all",
"channels": [
"string"
]
},
"content": {
"version": "string",
"elements": [
{
"type": "text",
"channels": [
"string"
],
"ref": "string",
"if": "string",
"loop": "string",
"content": "string",
"align": "left",
"text_style": "text",
"color": "string",
"bold": "string",
"italic": "string",
"strikethrough": "string",
"underline": "string",
"locales": {
"locales_key": {
"content": "string"
}
},
"format": "markdown"
}
]
}
}
}{
"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
Id of the tenant for which to retrieve the template.
Id of the template to be retrieved.
Response
The template's id
The timestamp at which the template was created
The timestamp at which the template was last updated
The timestamp at which the template was published
The version of the template
The template's data containing it's routing configs and Elemental content
Show child attributes
Show child attributes
⌘I