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 automationInvokeResponse = await client.automations.invoke.invokeByTemplate('templateId', {
recipient: 'recipient',
});
console.log(automationInvokeResponse.runId);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
automation_invoke_response = client.automations.invoke.invoke_by_template(
template_id="templateId",
recipient="recipient",
)
print(automation_invoke_response.run_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"),
)
automationInvokeResponse, err := client.Automations.Invoke.InvokeByTemplate(
context.TODO(),
"templateId",
courier.AutomationInvokeInvokeByTemplateParams{
Recipient: courier.String("recipient"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", automationInvokeResponse.RunID)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.automations.AutomationInvokeResponse;
import com.courier.models.automations.invoke.InvokeInvokeByTemplateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
InvokeInvokeByTemplateParams params = InvokeInvokeByTemplateParams.builder()
.templateId("templateId")
.recipient("recipient")
.build();
AutomationInvokeResponse automationInvokeResponse = client.automations().invoke().invokeByTemplate(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
automation_invoke_response = courier.automations.invoke.invoke_by_template("templateId", recipient: "recipient")
puts(automation_invoke_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 {
$automationInvokeResponse = $client->automations->invoke->invokeByTemplate(
'templateId',
recipient: 'recipient',
brand: 'brand',
data: ['foo' => 'bar'],
profile: ['foo' => 'bar'],
template: 'template',
);
var_dump($automationInvokeResponse);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Automations.Invoke;
CourierClient client = new();
InvokeInvokeByTemplateParams parameters = new()
{
TemplateID = "templateId",
Recipient = "recipient",
};
var automationInvokeResponse = await client.Automations.Invoke.InvokeByTemplate(parameters);
Console.WriteLine(automationInvokeResponse);courier automations:invoke invoke-by-template \
--api-key 'My API Key' \
--template-id templateId \
--recipient recipientcurl --request POST \
--url https://api.courier.com/automations/{templateId}/invoke \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"recipient": "<string>",
"brand": "<string>",
"data": {},
"profile": {},
"template": "<string>"
}
'{
"runId": "abc-123"
}Automations
Invoke an Automation
Invoke an automation run from an automation template.
POST
/
automations
/
{templateId}
/
invoke
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 automationInvokeResponse = await client.automations.invoke.invokeByTemplate('templateId', {
recipient: 'recipient',
});
console.log(automationInvokeResponse.runId);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
automation_invoke_response = client.automations.invoke.invoke_by_template(
template_id="templateId",
recipient="recipient",
)
print(automation_invoke_response.run_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"),
)
automationInvokeResponse, err := client.Automations.Invoke.InvokeByTemplate(
context.TODO(),
"templateId",
courier.AutomationInvokeInvokeByTemplateParams{
Recipient: courier.String("recipient"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", automationInvokeResponse.RunID)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.automations.AutomationInvokeResponse;
import com.courier.models.automations.invoke.InvokeInvokeByTemplateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
InvokeInvokeByTemplateParams params = InvokeInvokeByTemplateParams.builder()
.templateId("templateId")
.recipient("recipient")
.build();
AutomationInvokeResponse automationInvokeResponse = client.automations().invoke().invokeByTemplate(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
automation_invoke_response = courier.automations.invoke.invoke_by_template("templateId", recipient: "recipient")
puts(automation_invoke_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 {
$automationInvokeResponse = $client->automations->invoke->invokeByTemplate(
'templateId',
recipient: 'recipient',
brand: 'brand',
data: ['foo' => 'bar'],
profile: ['foo' => 'bar'],
template: 'template',
);
var_dump($automationInvokeResponse);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Automations.Invoke;
CourierClient client = new();
InvokeInvokeByTemplateParams parameters = new()
{
TemplateID = "templateId",
Recipient = "recipient",
};
var automationInvokeResponse = await client.Automations.Invoke.InvokeByTemplate(parameters);
Console.WriteLine(automationInvokeResponse);courier automations:invoke invoke-by-template \
--api-key 'My API Key' \
--template-id templateId \
--recipient recipientcurl --request POST \
--url https://api.courier.com/automations/{templateId}/invoke \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"recipient": "<string>",
"brand": "<string>",
"data": {},
"profile": {},
"template": "<string>"
}
'{
"runId": "abc-123"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
A unique identifier representing the automation template to be invoked. This could be the Automation Template ID or the Automation Template Alias.
Body
application/json
Response
200 - application/json
โI