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.messages.history('message_id');
console.log(response.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
)
response = client.messages.history(
message_id="message_id",
)
print(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"),
)
response, err := client.Messages.History(
context.TODO(),
"message_id",
courier.MessageHistoryParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Results)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.messages.MessageHistoryParams;
import com.courier.models.messages.MessageHistoryResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
MessageHistoryResponse response = client.messages().history("message_id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
response = courier.messages.history("message_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->messages->history('message_id', type: 'type');
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Messages;
CourierClient client = new();
MessageHistoryParams parameters = new() { MessageID = "message_id" };
var response = await client.Messages.History(parameters);
Console.WriteLine(response);courier messages history \
--api-key 'My API Key' \
--message-id message_idcurl --request GET \
--url https://api.courier.com/messages/{message_id}/history \
--header 'Authorization: Bearer <token>'{
"results": [
{}
]
}{
"message": "Example message text",
"type": "invalid_request_error"
}{
"message": "Example message text",
"type": "invalid_request_error"
}Sent Messages
Get message history
Fetch the array of events of a message you’ve previously sent.
GET
/
messages
/
{message_id}
/
history
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.messages.history('message_id');
console.log(response.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
)
response = client.messages.history(
message_id="message_id",
)
print(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"),
)
response, err := client.Messages.History(
context.TODO(),
"message_id",
courier.MessageHistoryParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Results)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.messages.MessageHistoryParams;
import com.courier.models.messages.MessageHistoryResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
MessageHistoryResponse response = client.messages().history("message_id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
response = courier.messages.history("message_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->messages->history('message_id', type: 'type');
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Messages;
CourierClient client = new();
MessageHistoryParams parameters = new() { MessageID = "message_id" };
var response = await client.Messages.History(parameters);
Console.WriteLine(response);courier messages history \
--api-key 'My API Key' \
--message-id message_idcurl --request GET \
--url https://api.courier.com/messages/{message_id}/history \
--header 'Authorization: Bearer <token>'{
"results": [
{}
]
}{
"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
A unique identifier representing the message ID
Query Parameters
A supported Message History type that will filter the events returned.
Response
⌘I