Campaign Actions

Campaign Actions are instructions for creating and scheduling any contact communications and/or agent task reminders that should be sent when a campaign is initiated for a contact.
These instructions are used by the Campaign Contacts endpoint to create the contact communications and tasks after a contact has been added to a campaing.

Notes on Campaign Action Types

There are two categories of campaign action types: Contact Communications and Agent Tasks:

  • Contact Communications - Campaign-related emails/texts/calls sent to a contact
    • Email Contact
    • Call Contact
    • Text Contact
  • Agent Tasks - campaign-related agent reminders
    • Agent Task - Email Reminder
    • Agent Task - Call Reminder
    • Agent Task - Text Reminder
    • Agent Task - No Reminder

Notes on Submitting/Updated Campaign Actions

Depending on the chosen timing_type, different fields are required:

  • Delay by Day and Time
    • dispatch_time
    • delay_by_days
  • Delay by Minutes
    • delay_by_seconds
  • Exact Date and Time
    • dispatch_datetime
  • The following fields relate to the Campaign Actions endpoint.

    Agent Task - Email ReminderAgent Task - Call ReminderAgent Task - Text ReminderAgent Task - No ReminderEmail ContactCall ContactText ContactDelay by Day and TimeDelay by MinutesExact Date and TimeRecurring (Available only on Task Campaign Action)1 - This action will be scheduled to be executed when the campaign starts2 - This action will be scheduled to be executed when it's the contact's birthdays
    FieldLimitsRequired?Writeable?
    type
    YesYes

    The category that a campaign action belongs to. Types prefixed with "Agent Task" are reminders sent to an agent, the remaining action types are contact communications

    Possible values:
    assigned_user_id
    NoYes

    When the campaign action is a contact communication, those communications will be sent from the assigned user. When the campaign action is a task, the task will be assigned to this user.

    template_id
    NoYes

    The ID of the email or text template being used. Is allowed only if campaign action is a type of contact communication (Email Contact, Text Contact, Call Contact).

    timing_type
    YesYes

    Specify when the campaign action should be dispatched after a campaign has been initiated

    Possible values:
    recurrence
    This Recurrence rule must respect the definitions on rfc5545.
    NoYes

    Recurrence rule applied to the action if timing_type = Recurring

    event_trigger_type
    NoYes

    Event that will trigger this action to be applyed

    Possible values:
    delay_by_seconds
    NoYes

    Defer dispatch of a campaign action by the specified number of seconds. Only relevant if timing_type = Delay by Minutes

    delay_by_days
    NoYes

    Defer dispatch of a campaign action by the specified number of days. Is a required field along with dispatch_time if timing_type = Delay by Day and Time and Recurring

    dispatch_time
    NoYes

    Dispatch the campaign action at the specified time. Is a required field along with delay_by_days if timing_type = Delay by Day and Time and Recurring

    dispatch_datetime
    NoYes

    Dispatch the campaign action at the specified date and time. Only relevant if timing_type = Exact Date and Time

    notes
    NoYes

    Instructions for the agent. Only relevant if campaign action type is an agent task

    is_stopped_on_text_reply
    NoYes

    Stop contact communication if the contact responds to the outgoing text message. Only relevant if campaign action type is "Text Contact"

    template
    NoNo

    Submit one Campaign Action

    To submit one campaign action:

    POST https://api-v2.liondesk.com//campaigns/7/actions headers: { Authorization: "Bearer [access token]", Content-Type: "application/json" }

    The request object should have this form:{ "type": "Email Contact", "assigned_user_id": 10, "template_id": 2, "timing_type": "Delay by Day and Time", "recurrence": "FREQ=DAILY;INTERVAL=1;COUNT=5", "event_trigger_type": "1", "delay_by_seconds": null, "delay_by_days": 1, "dispatch_time": "20:30:00", "dispatch_datetime": null, "notes": "", "is_stopped_on_text_reply": false }

    Update one Campaign Action

    To update some attributes on one campaign action:

    PATCH https://api-v2.liondesk.com//campaigns/7/actions/10 headers: { Authorization: "Bearer [access token]", Content-Type: "application/json" }

    data: {
    type: "Email Contact",
    assigned_user_id: "10"
    }

    Get One Campaign Action

    To get one campaign action:

    GET https://api-v2.liondesk.com//campaigns/7/actions/1 headers: { Authorization: "Bearer [access token]", Content-Type: "application/json" }

    The response object will have this form:{ "type": "Email Contact", "assigned_user_id": 10, "template_id": 2, "timing_type": "Delay by Day and Time", "recurrence": "FREQ=DAILY;INTERVAL=1;COUNT=5", "event_trigger_type": "1", "delay_by_seconds": null, "delay_by_days": 1, "dispatch_time": "20:30:00", "dispatch_datetime": null, "notes": "", "is_stopped_on_text_reply": false, "template": { "template_id": 2, "description": "an email template", "subject": "Hello" } }

    Find All Campaign Actions

    You find/search campaign actions by issuing a GET request to the base endpoint:

    GET https://api-v2.liondesk.com//campaigns/7/actions headers: { Authorization: "Bearer [access token]", Content-Type: "application/json" }

    The response will contain an array of campaign action objects, like so:

    { "total": 2, "limit": 10, "skip": 0, "data": [ { "type": "Email Contact", "assigned_user_id": 10, "template_id": 2, "timing_type": "Delay by Day and Time", "recurrence": "FREQ=DAILY;INTERVAL=1;COUNT=5", "event_trigger_type": "1", "delay_by_seconds": null, "delay_by_days": 1, "dispatch_time": "20:30:00", "dispatch_datetime": null, "notes": "", "is_stopped_on_text_reply": false, "template": { "template_id": 2, "description": "an email template", "subject": "Hello" } }, { "type": "Agent Task - Text Reminder", "assigned_user_id": 12, "template_id": null, "timing_type": "Exact Date and Time", "recurrence": "FREQ=YEARLY;INTERVAL=1;COUNT=5", "event_trigger_type": "2", "delay_by_seconds": null, "delay_by_days": null, "dispatch_time": null, "dispatch_datetime": "2019-08-22T07:06:00.000Z", "notes": "Remember to text the client at 18:30", "is_stopped_on_text_reply": false, "template": null } ] }

    Loading additional information

    Information associated with assigned_user_id can be returned by appending the $load parameter to any GET request:

    GET https://api-v2.liondesk.com//campaigns/7/actions?$load=assigned_user headers: { Authorization: "Bearer [access token]", Content-Type: "application/json" }
    { "total": 2, "limit": 10, "skip": 0, "data": [ { "assigned_user": { "id": 6, "first_name": "Gabriel", "last_name": "Reyes", "email": "gabriel@yahoo.com" }, "template": { "template_id": 2, "description": "an email template", "subject": "Hello" }, "type": "Email Contact", "assigned_user_id": 10, "template_id": 2, "timing_type": "Delay by Day and Time", "recurrence": "FREQ=DAILY;INTERVAL=1;COUNT=5", "event_trigger_type": "1", "delay_by_seconds": null, "delay_by_days": 1, "dispatch_time": "20:30:00", "dispatch_datetime": null, "notes": "", "is_stopped_on_text_reply": false }, { "assigned_user": { "id": 8, "first_name": "Angela", "last_name": "Ziegler", "email": "angela@gmail.com" }, "template": null, "type": "Agent Task - Text Reminder", "assigned_user_id": 12, "template_id": null, "timing_type": "Exact Date and Time", "recurrence": "FREQ=YEARLY;INTERVAL=1;COUNT=5", "event_trigger_type": "2", "delay_by_seconds": null, "delay_by_days": null, "dispatch_time": null, "dispatch_datetime": "2019-08-22T07:06:00.000Z", "notes": "Remember to text the client at 18:30", "is_stopped_on_text_reply": false } ] }

    Filtering Campaign Actions

    The following filtering operators may be mixed and matched as desired.

    Equality

    You may query campaign action fields directly by specifying equality parameters in the request URI:GET /campaigns/7/actions?type=Email Contact

    You may wish to exclude results having some value with $ne:GET /campaigns/7/actions?is_stopped_on_text_reply[$ne]=true

    Dates & Times

    Unless otherwise stated all dates and times should be in ISO8601 format. Examples: 2012-09-27, 2012-09-27T09:15:00Z (UTC), 2012-09-27T09:15:00-07:00 (PDT)

    Limiting and Pagination

    $limit will return only the number of results you specify: GET /campaigns/7/actions?$limit=2

    $skip will skip the specified number of results, useful for paginating:GET /campaigns/7/actions?is_stopped_on_text_reply=true&$limit=2&$skip=2

    Sorting

    $sort will order results based on the field given.

    Use 1 for ascending order, and -1 for descending order:GET /campaigns/7/actions?$limit=10&$sort[delay_by_days]=-1

    Inclusion / Exclusion

    Find all records where the property values are ($in) some set:GET /campaigns/7/actions?timing_type[$in]=TimeIf the column matches any of the given values, the resource shall be returned.

    Similarly, you may exclude certain values with ($nin):GET /campaigns/7/actions?timing_type[$nin]=Time

    Comparisons

    You may use the less-than $lt and less-than-or-equal $lte operators to filter your queries: GET /campaigns/7/actions?delay_by_days[$lt]=7

    Similarly, you may use greater-than $gt and greater-than-or-equal $gte operators to filter your queries: GET /campaigns/7/actions?delay_by_days[$gte]=2

    You may also combine these operators to query for a range of values: GET /campaigns/7/actions?delay_by_days[$gte]=10&delay_by_days[$lte]=3

    Remove

    Campaign Actions can be removed with a delete request.

    DELETE https://api-v2.liondesk.com//campaigns/7/actions/161 headers: { Authorization: "Bearer [access token]", Content-Type: "application/json" }