Automations
Create Automation
Create an email sequence started by a new contact or by your app's events.
POST
/automationsBody Parameters
namestringrequiredName.
triggerobjectrequired{ type: 'contact.created', audience_id? } or { type: 'event', event: 'user.signed_up' }.stepsobject[]{ type: 'email', from, subject, html } or { type: 'email', from, template_id } or { type: 'delay', minutes | hours | days }.status'active' | 'paused'Default paused.
const res = await fetch('https://post-waves.com/automations', {
method: 'POST',
headers: {
Authorization: 'Bearer pw_xxxxxxxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "Onboarding",
"status": "active",
"trigger": {
"type": "event",
"event": "user.signed_up"
},
"steps": [
{
"type": "email",
"from": "hello@yourdomain.com",
"subject": "Welcome {{{FIRST_NAME}}}",
"html": "<p>Glad you're here</p>"
},
{
"type": "delay",
"days": 2
},
{
"type": "email",
"from": "hello@yourdomain.com",
"subject": "Tips to get started",
"html": "<p>…</p>"
}
]
}),
});
const data = await res.json();import requests
res = requests.post(
"https://post-waves.com/automations",
headers={"Authorization": "Bearer pw_xxxxxxxxx"},
json={
"name": "Onboarding",
"status": "active",
"trigger": {
"type": "event",
"event": "user.signed_up"
},
"steps": [
{
"type": "email",
"from": "hello@yourdomain.com",
"subject": "Welcome {{{FIRST_NAME}}}",
"html": "<p>Glad you're here</p>"
},
{
"type": "delay",
"days": 2
},
{
"type": "email",
"from": "hello@yourdomain.com",
"subject": "Tips to get started",
"html": "<p>…</p>"
}
]
},
)
print(res.json())<?php
$ch = curl_init('https://post-waves.com/automations');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer pw_xxxxxxxxx',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Onboarding',
'status' => 'active',
'trigger' => [
'type' => 'event',
'event' => 'user.signed_up',
],
'steps' => [
[
'type' => 'email',
'from' => 'hello@yourdomain.com',
'subject' => 'Welcome {{{FIRST_NAME}}}',
'html' => '<p>Glad you\'re here</p>',
],
[
'type' => 'delay',
'days' => 2,
],
[
'type' => 'email',
'from' => 'hello@yourdomain.com',
'subject' => 'Tips to get started',
'html' => '<p>…</p>',
],
],
]),
]);
$response = json_decode(curl_exec($ch), true);require "net/http"
require "json"
uri = URI("https://post-waves.com/automations")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer pw_xxxxxxxxx"
req["Content-Type"] = "application/json"
req.body = {
name: "Onboarding",
status: "active",
trigger: {
type: "event",
event: "user.signed_up"
},
steps: [
{
type: "email",
from: "hello@yourdomain.com",
subject: "Welcome {{{FIRST_NAME}}}",
html: "<p>Glad you're here</p>"
},
{
type: "delay",
days: 2
},
{
type: "email",
from: "hello@yourdomain.com",
subject: "Tips to get started",
html: "<p>…</p>"
}
]
}.to_json
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(req) }
puts JSON.parse(res.body)package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{"name":"Onboarding","status":"active","trigger":{"type":"event","event":"user.signed_up"},"steps":[{"type":"email","from":"hello@yourdomain.com","subject":"Welcome {{{FIRST_NAME}}}","html":"<p>Glad you're here</p>"},{"type":"delay","days":2},{"type":"email","from":"hello@yourdomain.com","subject":"Tips to get started","html":"<p>…</p>"}]}`)
req, _ := http.NewRequest("POST", "https://post-waves.com/automations", body)
req.Header.Set("Authorization", "Bearer pw_xxxxxxxxx")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}curl -X POST 'https://post-waves.com/automations' \
-H 'Authorization: Bearer pw_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{"name":"Onboarding","status":"active","trigger":{"type":"event","event":"user.signed_up"},"steps":[{"type":"email","from":"hello@yourdomain.com","subject":"Welcome {{{FIRST_NAME}}}","html":"<p>Glad you'\''re here</p>"},{"type":"delay","days":2},{"type":"email","from":"hello@yourdomain.com","subject":"Tips to get started","html":"<p>…</p>"}]}'Try itPOST
/automationsNo key yet? Create one in the dashboard.