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 workspacePreferenceTopicListResponse = await client.workspacePreferences.topics.list(
'section_id',
);
console.log(workspacePreferenceTopicListResponse.results);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
workspace_preference_topic_list_response = client.workspace_preferences.topics.list(
"section_id",
)
print(workspace_preference_topic_list_response.results)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"),
)
workspacePreferenceTopicListResponse, err := client.WorkspacePreferences.Topics.List(context.TODO(), "section_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", workspacePreferenceTopicListResponse.Results)
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.workspacepreferences.WorkspacePreferenceTopicListResponse;
import com.courier.models.workspacepreferences.topics.TopicListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
WorkspacePreferenceTopicListResponse workspacePreferenceTopicListResponse = client.workspacePreferences().topics().list("section_id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
workspace_preference_topic_list_response = courier.workspace_preferences.topics.list("section_id")
puts(workspace_preference_topic_list_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 {
$workspacePreferenceTopicListResponse = $client
->workspacePreferences
->topics
->list('section_id');
var_dump($workspacePreferenceTopicListResponse);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.WorkspacePreferences.Topics;
CourierClient client = new();
TopicListParams parameters = new() { SectionID = "section_id" };
var workspacePreferenceTopicListResponse = await client.WorkspacePreferences.Topics.List(parameters);
Console.WriteLine(workspacePreferenceTopicListResponse);courier workspace-preferences:topics list \
--api-key 'My API Key' \
--section-id section_idcurl --request GET \
--url https://api.courier.com/preferences/sections/{section_id}/topics \
--header 'Authorization: Bearer <token>'{
"results": [
{
"id": "pt_01kx4h2jdafq8bk99mj9q2gsa2",
"name": "Product Updates",
"default_status": "OPTED_OUT",
"routing_options": [
"direct_message"
],
"allowed_preferences": [
"snooze"
],
"include_unsubscribe_header": true,
"topic_data": {},
"created": "2024-01-15T10:30:00.000Z",
"creator": "user_123",
"updated": "2024-01-15T10:30:00.000Z",
"updater": "user_123"
}
]
}{
"message": "Example message text",
"type": "invalid_request_error"
}Workspace Preferences
List Topics in Section
List the topics in a workspace preference.
GET
/
preferences
/
sections
/
{section_id}
/
topics
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 workspacePreferenceTopicListResponse = await client.workspacePreferences.topics.list(
'section_id',
);
console.log(workspacePreferenceTopicListResponse.results);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
workspace_preference_topic_list_response = client.workspace_preferences.topics.list(
"section_id",
)
print(workspace_preference_topic_list_response.results)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"),
)
workspacePreferenceTopicListResponse, err := client.WorkspacePreferences.Topics.List(context.TODO(), "section_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", workspacePreferenceTopicListResponse.Results)
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.workspacepreferences.WorkspacePreferenceTopicListResponse;
import com.courier.models.workspacepreferences.topics.TopicListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
WorkspacePreferenceTopicListResponse workspacePreferenceTopicListResponse = client.workspacePreferences().topics().list("section_id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
workspace_preference_topic_list_response = courier.workspace_preferences.topics.list("section_id")
puts(workspace_preference_topic_list_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 {
$workspacePreferenceTopicListResponse = $client
->workspacePreferences
->topics
->list('section_id');
var_dump($workspacePreferenceTopicListResponse);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.WorkspacePreferences.Topics;
CourierClient client = new();
TopicListParams parameters = new() { SectionID = "section_id" };
var workspacePreferenceTopicListResponse = await client.WorkspacePreferences.Topics.List(parameters);
Console.WriteLine(workspacePreferenceTopicListResponse);courier workspace-preferences:topics list \
--api-key 'My API Key' \
--section-id section_idcurl --request GET \
--url https://api.courier.com/preferences/sections/{section_id}/topics \
--header 'Authorization: Bearer <token>'{
"results": [
{
"id": "pt_01kx4h2jdafq8bk99mj9q2gsa2",
"name": "Product Updates",
"default_status": "OPTED_OUT",
"routing_options": [
"direct_message"
],
"allowed_preferences": [
"snooze"
],
"include_unsubscribe_header": true,
"topic_data": {},
"created": "2024-01-15T10:30:00.000Z",
"creator": "user_123",
"updated": "2024-01-15T10:30:00.000Z",
"updater": "user_123"
}
]
}{
"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 workspace preference.
Response
Topics contained in a workspace preference.
Show child attributes
Show child attributes
⌘I