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 profile = await client.profiles.retrieve('user_id');
console.log(profile.profile);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
profile = client.profiles.retrieve(
"user_id",
)
print(profile.profile)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"),
)
profile, err := client.Profiles.Get(context.TODO(), "user_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", profile.Profile)
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.profiles.ProfileRetrieveParams;
import com.courier.models.profiles.ProfileRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
ProfileRetrieveResponse profile = client.profiles().retrieve("user_id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
profile = courier.profiles.retrieve("user_id")
puts(profile)<?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 {
$profile = $client->profiles->retrieve('user_id');
var_dump($profile);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Profiles;
CourierClient client = new();
ProfileRetrieveParams parameters = new() { UserID = "user_id" };
var profile = await client.Profiles.Retrieve(parameters);
Console.WriteLine(profile);courier profiles retrieve \
--api-key 'My API Key' \
--user-id user_idcurl --request GET \
--url https://api.courier.com/profiles/{user_id} \
--header 'Authorization: Bearer <token>'{
"profile": {},
"preferences": {
"categories": {
"categories_key": {
"status": "OPTED_IN",
"rules": [
{
"start": "string",
"until": "string"
}
],
"channel_preferences": [
{
"channel": "direct_message"
}
]
}
},
"notifications": {
"notifications_key": {
"status": "OPTED_IN",
"rules": [
{
"start": "string",
"until": "string"
}
],
"channel_preferences": [
{
"channel": "direct_message"
}
]
}
}
}
}{
"message": "Example message text",
"type": "invalid_request_error"
}User Profiles
Get a profile
Returns the specified user profile.
GET
/
profiles
/
{user_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 profile = await client.profiles.retrieve('user_id');
console.log(profile.profile);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
profile = client.profiles.retrieve(
"user_id",
)
print(profile.profile)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"),
)
profile, err := client.Profiles.Get(context.TODO(), "user_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", profile.Profile)
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.profiles.ProfileRetrieveParams;
import com.courier.models.profiles.ProfileRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
ProfileRetrieveResponse profile = client.profiles().retrieve("user_id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
profile = courier.profiles.retrieve("user_id")
puts(profile)<?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 {
$profile = $client->profiles->retrieve('user_id');
var_dump($profile);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Profiles;
CourierClient client = new();
ProfileRetrieveParams parameters = new() { UserID = "user_id" };
var profile = await client.Profiles.Retrieve(parameters);
Console.WriteLine(profile);courier profiles retrieve \
--api-key 'My API Key' \
--user-id user_idcurl --request GET \
--url https://api.courier.com/profiles/{user_id} \
--header 'Authorization: Bearer <token>'{
"profile": {},
"preferences": {
"categories": {
"categories_key": {
"status": "OPTED_IN",
"rules": [
{
"start": "string",
"until": "string"
}
],
"channel_preferences": [
{
"channel": "direct_message"
}
]
}
},
"notifications": {
"notifications_key": {
"status": "OPTED_IN",
"rules": [
{
"start": "string",
"until": "string"
}
],
"channel_preferences": [
{
"channel": "direct_message"
}
]
}
}
}
}{
"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
A unique identifier representing the user associated with the requested profile.
⌘I