POST
/
businesses
/
{id}
/
triggers
Create a trigger
curl --request POST \
  --url https://api.pocketflows.com/businesses/{id}/triggers \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '{
  "project_defined_event": "<string>",
  "name": "<string>",
  "filter": "<string>",
  "metadata": {},
  "attributed_revenue": 123,
  "steps": [
    {
      "type": "email",
      "custom_step_id": "<string>",
      "email_template_id": "<string>"
    }
  ],
  "email_address": "<string>",
  "phone_number": "<string>",
  "excluded_customers": [
    "<string>"
  ]
}'
{
  "id": "<string>",
  "created_at": "<string>",
  "updated_at": "<string>",
  "name": "<string>",
  "project_defined_event": "<string>",
  "internal_event_definition": {
    "type": "customer_created",
    "segment": "<string>"
  },
  "trigger": "<string>",
  "steps": [
    {
      "type": "email",
      "custom_step_id": "<string>",
      "email_template_id": "<string>"
    }
  ],
  "status": "draft",
  "filter": "<string>",
  "email_address": "<string>",
  "phone_number": "<string>",
  "attributed_revenue": 123,
  "statistics": {
    "total_customers_enrolled": 123,
    "total_customers_started": 123,
    "total_customers_finished": 123,
    "emails": {
      "sent": 123,
      "delivered": 123,
      "opened": 123,
      "soft_bounced": 123,
      "hard_bounced": 123,
      "clicked": 123
    },
    "custom_steps": [
      {
        "custom_step": "<string>",
        "sent": 123
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Path Parameters

id
string
required

The ID of the business

Body

application/json
project_defined_event
string
required

The ID of a project defined event that triggers the trigger

name
string
required

The name of the trigger

steps
object[]
required

The steps of the trigger

filter
string | null

A further filter on the trigger

metadata
object | null

Metadata for the trigger

attributed_revenue
number | null

The revenue attributed to the trigger

email_address
string | null

The ID of an email address or project email address. Will be used to send emails as part of this trigger

phone_number
string | null

The ID of a phone number or project phone number. Will be used to send SMS messages as part of this trigger

excluded_customers
string[]

The IDs of the customers excluded by the trigger

Response

200 - application/json

The created Trigger object

id
string
required

The ID of the trigger

created_at
string
required

The time when the trigger was created in ISO 8601 format

updated_at
string
required

The time when the trigger was last updated in ISO 8601 format

name
string
required

The name of the trigger

project_defined_event
string | null
required

The ID of the project-defined event that triggers the trigger

internal_event_definition
object
required

The internal event definition that triggers the trigger

steps
object[]
required

The steps of the trigger

status
enum<string>
required

The status of the trigger. One of "draft", "active", or "inactive"

Available options:
draft,
active,
inactive
filter
string | null
required

An additional filter that determines if the trigger should be run

email_address
string | null
required

The ID of the email address or project email address associated with the trigger. Will be used to send emails as part of this trigger

phone_number
string | null
required

The ID of the phone number or project phone number associated with the trigger. Will be used to send SMS messages as part of this trigger

attributed_revenue
number | null
required

The revenue attributed to the trigger

statistics
object
required

The statistics of the trigger. Includes information about customers enrolled, email statistics, and custom step statistics

trigger
string | null

Deprecated. Will always be null