This page will walk you through creating a campaign from the API.

Creating a Campaign

Send a POST request to /api/campaigns. You must pass 1 body parameter, name, which corresponds to the name of the campaign you wish to create. If successful, you will receive a a 200 OK with the campaign ID as part of the response.

Campaign Settings

You can get the ID for a campaign using the UI by navigating to the campaign, clicking on the Actions dropdown, and then clicking Copy ID for API.Alternatively, campaign IDs can be acquired with a GET request to /api/campaigns.
Each campaign has individual settings that can be changed. You can view the settings with a GET request to /api/campaigns/{id} where {id} is the campaign ID. If you need to change the settings, send a POST request to /api/campaigns/{id}/update where {id} is the campaign ID.
max_emails_per_day
integer|null
default:"1000"
The maxiumum number of emails that can be sent per day
max_new_leads_per_day
integer|null
default:"1000"
The maximum number of new leads that can be added per day.
plain_text
boolean|null
default:"false"
Whether the email content should be plain text. If nothing sent, false is assumed
open_tracking
boolean|null
default:"false"
Whether open tracking should be enabled for the campaign. If nothing sent, false is assumed.
reputation_building
boolean|null
default:"false"
Spam protection. If nothing sent, false is assumed.
can_unsubscribe
boolean|null
default:"false"
Whether recipients can unsubscribe from the campaign using a one-click link. If nothing sent, false is assumed.
unsubscribe_text
string|null
The text that will be shown in the unsubscribe link.
curl 'https://dedi.emailbison.com/api/campaigns/{id}/update' \
  --request PATCH \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --data '{
  "max_emails_per_day": 500,
  "max_new_leads_per_day": 100,
  "plain_text": true,
  "open_tracking": true,
  "reputation_building": true,
  "can_unsubscribe": true,
  "unsubscribe_text": "Click here to unsubscribe"
}'

Campaign Schedule

If you have created a schedule for a campaign in the past, you can re-use it provided you’ve saved it as a template. If you have a schedule template you wish to use: Get the schedule ID by sending a GET request to /api/campaigns/schedule/templates. Once you’ve acquired the ID, send a POST to /api/campaigns/{campaign_id}/create-schedule-from-template. The request requires 1 body field, schedule_id, which is the ID of the schedule you want to use. If you don’t have a schedule template you wish to use: If you don’t have any templates, or wish to create a new one, send a POST request to /api/campaigns/{campaign_id}/schedule.
monday
boolean
required
Whether the schedule includes Monday.
tuesday
boolean
required
Whether the schedule includes Tuesday.
wednesday
boolean
required
Whether the schedule includes Wednesday.
thursday
boolean
required
Whether the schedule includes Thursday.
friday
boolean
required
Whether the schedule includes Friday.
saturday
boolean
required
Whether the schedule includes Saturday.
sunday
boolean
required
Whether the schedule includes Sunday.
start_time
string
required
The start time in HH:MM format.Example: 09:00
end_time
string
required
The end time in HH:MM format.Example: 17:00
timezone
string
required
The timezone of the schedule.
You need to use the formatted string after the => symbol.e.g. “America/Los_Angeles”
(GMT-12:00) International Date Line West => Pacific/Kwajalein(GMT-11:00) Midway Island => Pacific/Midway(GMT-11:00) Samoa => Pacific/Apia(GMT-10:00) Hawaii => Pacific/Honolulu(GMT-09:00) Alaska => America/Anchorage(GMT-08:00) Pacific Time (US & Canada) => America/Los_Angeles(GMT-08:00) Tijuana => America/Tijuana(GMT-07:00) Arizona => America/Phoenix(GMT-07:00) Mountain Time (US & Canada) => America/Denver(GMT-07:00) Chihuahua => America/Chihuahua(GMT-07:00) La Paz => America/Chihuahua(GMT-07:00) Mazatlan => America/Mazatlan(GMT-06:00) Central Time (US & Canada) => America/Chicago(GMT-06:00) Central America => America/Managua(GMT-06:00) Guadalajara => America/Mexico_City(GMT-06:00) Mexico City => America/Mexico_City(GMT-06:00) Monterrey => America/Monterrey(GMT-06:00) Saskatchewan => America/Regina
save_as_template
boolean
required
Whether the created schedule should be saved as template.
curl 'https://dedi.emailbison.com/api/campaigns/{campaign_id}/schedule' \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --data '{
  "monday": true,
  "tuesday": true,
  "wednesday": true,
  "thursday": true,
  "friday": true,
  "saturday": false,
  "sunday": false,
  "start_time": "09:00",
  "end_time": "17:00",
  "timezone": "America/New_York",
  "save_as_template": false
}'

Campaign Sequence

The sequence of the campaign is the emails that will be sent out. To create your sequence, send a POST request to /api/campaigns/{campaign_id}/sequence-steps. The request can take only 2 fields in the body JSON. title and sequence_steps. title is a string, and sequence_steps is an array that contains the following fields:
title
string
required
The title of the sequence
email_subject
string
required
The subject of the email. To include variables, type in them in uppercase and wrap them with curly braces.Note that these variables must exist as custom variables in your workspace.Example: "This is an email subject with a {VARIABLE}."
email_body
string
required
The body of the email. To include variables, type in them in uppercase and wrap them with curly braces.Note that these variables must exist as custom variables in your workspace.Example: "This is an email body with a {VARIABLE}."
wait_in_days
integer
required
How many days before the sequence moves to the next step.
variant
boolean|null
Whether the step is a variant
variant_from_step
integer|null
Required if variant is true.The ID of the step this step is a variant of. You can get the step IDs with a GET request to `/api/campaigns//sequence-steps.
thread_reply
boolean
required
Whether the step should be a reply from the previous step.
The request will look like the following example:
curl 'https://dedi.emailbison.com/api/campaigns/{campaign_id}/sequence-steps' \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --data '{
    "title": "test sequence",
    "sequence_steps": [
        {
            "email_subject": "Hey {FIRST_NAME}",
            "order": 1,
            "email_body": "You should check this {PRODUCT] out!",
            "wait_in_days": 1,
            "variant": true,
            "variant_from_step": 223
        },
        {
            "email_subject": "EmailBison is awesome!",
            "order": 2,
            "email_body": "Try it now!",
            "wait_in_days": 1,
            "variant": true,
            "variant_from_step": 1,
            "thread_reply": true
        }
    ]
}'

Launching Campaign

After creating a campaign, updating its settings, creating or choosing a schedule, and creating a sequence, you have completed all the necessary steps in creating a campaign. You can send these requests to check the details of a campaign:
  • GET /api/campaigns/{campaign_id}: retrieves the campaign you created and its settings.
  • GET /api/campaigns/{campaign_id}/schedule: retreives the campaign schedule.
  • GET /api/campaigns/{campaign_id}/sequence-steps: retrieves the campaign sequences steps.
Once you’re ready to launch your campaign, send a PATCH request to /api/campaigns/{campaign_id}/resume. You can pause the campaign by sending a PATCH request to /api/campaigns/{campaign_id}/pause.