POST
/
businesses
/
{id}
/
campaigns
Create a campaign
curl --request POST \
  --url https://api.pocketflows.com/businesses/{id}/campaigns \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "<string>",
  "enrolled_customers": [
    "<string>"
  ],
  "excluded_customers": [
    "<string>"
  ],
  "steps": [
    {
      "type": "email",
      "custom_step_id": "<string>",
      "email_template_id": "<string>"
    }
  ],
  "email_address": "<string>",
  "phone_number": "<string>",
  "scheduled_at": "<string>",
  "segment": "<string>",
  "metadata": {},
  "attributed_revenue": 123
}'
{
  "id": "<string>",
  "created_at": "<string>",
  "updated_at": "<string>",
  "name": "<string>",
  "enrolled_customers": [
    "<string>"
  ],
  "segment": "<string>",
  "steps": [
    {
      "type": "email",
      "custom_step_id": "<string>",
      "email_template_id": "<string>"
    }
  ],
  "email_address": "<string>",
  "phone_number": "<string>",
  "status": "draft",
  "scheduled_at": "<string>",
  "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
      }
    ]
  },
  "consumed_message_segments": {
    "sms": 123,
    "mms": 123,
    "email": 123
  },
  "estimated_message_segments": {
    "sms": 123,
    "mms": 123,
    "email": 123
  },
  "attributed_revenue": 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
name
string
required

The name of the campaign

enrolled_customers
string[]
required

The IDs of the customers enrolled in the campaign

steps
object[]
required

The steps of the campaign

excluded_customers
string[]

The IDs of the customers excluded by the campaign

email_address
string | null

The email address used to send emails in the campaign. Will be the ID of an email-like object

phone_number
string | null

The phone number used to send SMS messages in the campaign. Will be the ID of a phone number-like object

scheduled_at
string | null

The scheduled time of the campaign in ISO 8601 format

segment
string | null

The ID of the segment to attach to the campaign

metadata
object | null

The metadata of the campaign

attributed_revenue
number | null

The revenue attributed to the campaign

Response

200 - application/json

The created Campaign object

id
string
required

The ID of the campaign

created_at
string
required

The time when the campaign was created in ISO 8601 format

updated_at
string
required

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

name
string
required

The name of the campaign

enrolled_customers
required

The customers enrolled in the campaign

segment
string | null
required

The segment attached to the campaign

steps
object[]
required

The steps of the campaign

email_address
string | null
required

The email address used to send emails in the campaign. Will be the ID of an email-like object

phone_number
string | null
required

The phone number used to send SMS messages in the campaign. Will be the ID of a phone number-like object

status
enum<string>
required

The status of the campaign.

Available options:
draft,
scheduled,
started,
stopped,
finished
scheduled_at
string | null
required

The time when the campaign is scheduled to start in ISO 8601 format

statistics
object
required

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

consumed_message_segments
object
required

The number of message segments actually used by the campaign

estimated_message_segments
object
required

The number of message segments estimated to be used by the campaign

attributed_revenue
number | null
required

The revenue attributed to the campaign