Skip to main content
POST
/
notifications
/
policies
Create Notification policy
curl --request POST \
  --url https://eu.sequencehq.com/api/notifications/policies \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Dev team integration webhooks",
  "notificationTypes": [
    "CUSTOMER_CREATED"
  ],
  "recipients": [
    "https://api.company.com/webhooks"
  ],
  "channel": "WEBHOOK",
  "webhookSecret": "whsec_UserSubmittedSecret1234567890abc"
}
'
import requests

url = "https://eu.sequencehq.com/api/notifications/policies"

payload = {
"name": "Dev team integration webhooks",
"notificationTypes": ["CUSTOMER_CREATED"],
"recipients": ["https://api.company.com/webhooks"],
"channel": "WEBHOOK",
"webhookSecret": "whsec_UserSubmittedSecret1234567890abc"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Dev team integration webhooks',
notificationTypes: ['CUSTOMER_CREATED'],
recipients: ['https://api.company.com/webhooks'],
channel: 'WEBHOOK',
webhookSecret: 'whsec_UserSubmittedSecret1234567890abc'
})
};

fetch('https://eu.sequencehq.com/api/notifications/policies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://eu.sequencehq.com/api/notifications/policies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Dev team integration webhooks',
'notificationTypes' => [
'CUSTOMER_CREATED'
],
'recipients' => [
'https://api.company.com/webhooks'
],
'channel' => 'WEBHOOK',
'webhookSecret' => 'whsec_UserSubmittedSecret1234567890abc'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://eu.sequencehq.com/api/notifications/policies"

payload := strings.NewReader("{\n \"name\": \"Dev team integration webhooks\",\n \"notificationTypes\": [\n \"CUSTOMER_CREATED\"\n ],\n \"recipients\": [\n \"https://api.company.com/webhooks\"\n ],\n \"channel\": \"WEBHOOK\",\n \"webhookSecret\": \"whsec_UserSubmittedSecret1234567890abc\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://eu.sequencehq.com/api/notifications/policies")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Dev team integration webhooks\",\n \"notificationTypes\": [\n \"CUSTOMER_CREATED\"\n ],\n \"recipients\": [\n \"https://api.company.com/webhooks\"\n ],\n \"channel\": \"WEBHOOK\",\n \"webhookSecret\": \"whsec_UserSubmittedSecret1234567890abc\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://eu.sequencehq.com/api/notifications/policies")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Dev team integration webhooks\",\n \"notificationTypes\": [\n \"CUSTOMER_CREATED\"\n ],\n \"recipients\": [\n \"https://api.company.com/webhooks\"\n ],\n \"channel\": \"WEBHOOK\",\n \"webhookSecret\": \"whsec_UserSubmittedSecret1234567890abc\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "75da306e-8e25-47ac-8079-b695c369e2ef",
  "createdAt": "2022-06-28T16:47:00Z",
  "sequenceAccountId": "c4602d51-0fb4-4b48-b689-6ba28f540d1e",
  "name": "Dev team integration webhooks",
  "notificationTypes": [
    "CUSTOMER_CREATED"
  ],
  "recipients": [
    "https://api.company.com/webhooks"
  ],
  "channel": "WEBHOOK",
  "webhookSecret": "whsec_AutoGeneratedSecret01234567890ab"
}
{
"errors": []
}
This response has no body data.
This response has no body data.
This response has no body data.

Headers

Authorization
string
required

Your API credentials. Eg. Basic {credentials}.

Sequence-Version
enum<string>

Use this header to select an API version

Available options:
2024-07-30

Body

application/json
name
string
required

Human-readable name

Example:

"Dev team integration webhooks"

recipients
string[]
required

The webhook URLs or email addresses which will receive notifications, depending on the channel

Example:
["https://api.company.com/webhooks"]
channel
enum<string>
required

Notification channel

Available options:
WEBHOOK,
EMAIL
Example:

"WEBHOOK"

notificationTypes
enum<string>[]

Set of notification types that this policy matches. If not provided, then this policy will apply to all notification types.

Available options:
CUSTOMER_CREATED,
CUSTOMER_UPDATED,
CUSTOMER_ARCHIVED,
INVOICE_CREATED,
INVOICE_ISSUED,
INVOICE_UPDATED,
INTEGRATION_SYNC_COMPLETED,
INTEGRATION_WEBHOOK_HANDLED,
MERCHANT_UPDATED,
BILLING_SCHEDULE_CREATED,
BILLING_SCHEDULE_UPDATED,
BILLING_SCHEDULE_ARCHIVED,
CREDIT_NOTE_CREATED,
CREDIT_NOTE_UPDATED,
CREDIT_NOTE_ISSUED,
QUOTE_PUBLISHED,
QUOTE_ACCEPTED,
QUOTE_SIGNED,
INVOICE_REMINDER_SENT,
WATCHTOWER_TASK_ASSIGNED
Example:
["CUSTOMER_CREATED"]
webhookSecret
string

Webhook secret used to generate a signature header that's sent with an outbound webhook.It can be used to verify the authenticity of received Sequence webhooks. Only available for webhook channel policies.

Example:

"whsec_UserSubmittedSecret1234567890abc"

Response

Created

id
string
required

Unique ID

Example:

"75da306e-8e25-47ac-8079-b695c369e2ef"

createdAt
string
required

Created at

Example:

"2022-06-28T16:47:00Z"

sequenceAccountId
string
required

Sequence Account which this policy matches

Example:

"c4602d51-0fb4-4b48-b689-6ba28f540d1e"

name
string
required

Human-readable name

Example:

"Dev team integration webhooks"

recipients
string[]
required

The webhook URLs or email addresses which will receive notifications, depending on the channel

Example:
["https://api.company.com/webhooks"]
channel
enum<string>
required

Notification channel

Available options:
WEBHOOK,
EMAIL
Example:

"WEBHOOK"

notificationTypes
enum<string>[]

Set of notification types that this policy matches. If not present this policy will cover all notification types.

Available options:
CUSTOMER_CREATED,
CUSTOMER_UPDATED,
CUSTOMER_ARCHIVED,
INVOICE_CREATED,
INVOICE_ISSUED,
INVOICE_UPDATED,
INTEGRATION_SYNC_COMPLETED,
INTEGRATION_WEBHOOK_HANDLED,
MERCHANT_UPDATED,
BILLING_SCHEDULE_CREATED,
BILLING_SCHEDULE_UPDATED,
BILLING_SCHEDULE_ARCHIVED,
CREDIT_NOTE_CREATED,
CREDIT_NOTE_UPDATED,
CREDIT_NOTE_ISSUED,
QUOTE_PUBLISHED,
QUOTE_ACCEPTED,
QUOTE_SIGNED,
INVOICE_REMINDER_SENT,
WATCHTOWER_TASK_ASSIGNED
Example:
["CUSTOMER_CREATED"]
webhookSecret
string

Webhook secret used to generate a signature header that's sent with an outbound webhook.It can be used to verify the authenticity of received Sequence webhooks. Only available for webhook channel policies.

Example:

"whsec_AutoGeneratedSecret01234567890ab"