We tried our best, but there was an error processing your request. If this keeps happening, please refresh your browser or contact support.
Campaign Events Endpoint

This endpoint allows you to list campaign events in your account.

Listing Campaign Events

A GET returns the campaign events, listing the most recently created events first.

  • uuid - the UUID of the campaign (string), filterable as uuid.
  • campaign - the UUID and name of the campaign (object), filterable as campaign with UUID.
  • relative_to - the key and label of the date field this event is based on (object).
  • offset - the offset from our contact field (positive or negative integer).
  • unit - the unit for our offset, one of minutes, hours, days or weeks.
  • delivery_hour - the hour of the day to deliver the message (integer 0-24, -1 indicates send at the same hour as the contact field).
  • message - the message to send to the contact by language (object).
  • flow - the UUID and name of the flow if this is a flow event (object).
  • created_on - when the event was created (datetime).

Example:

GET /api/v2/campaign_events.json

Response is a list of the campaign events on your account

{
    "next": null,
    "previous": null,
    "results": [
    {
        "uuid": "f14e4ff0-724d-43fe-a953-1d16aefd1c00",
        "campaign": {"uuid": "f14e4ff0-724d-43fe-a953-1d16aefd1c00", "name": "Reminders"},
        "relative_to": {"key": "registration", "name": "Registration Date"},
        "offset": 7,
        "unit": "days",
        "delivery_hour": 9,
        "flow": {"uuid": "09d23a05-47fe-11e4-bfe9-b8f6b119e9ab", "name": "Survey"},
        "message": null,
        "created_on": "2013-08-19T19:11:21.088Z"
    },
    ...
}

Adding Campaign Events

A POST can be used to create a new campaign event, by sending the following data. Don't specify a UUID as this will be generated for you.

  • campaign - the UUID of the campaign this event should be part of (string, can't be changed for existing events)
  • relative_to - the field key that this event will be relative to (string)
  • offset - the offset from our contact field (positive or negative integer)
  • unit - the unit for our offset (minutes, hours, days or weeks)
  • delivery_hour - the hour of the day to deliver the message (integer 0-24, -1 indicates send at the same hour as the field)
  • message - the message to send to the contact (string, required if flow is not specified)
  • flow - the UUID of the flow to start the contact down (string, required if message is not specified)

Example:

POST /api/v2/campaign_events.json
{
    "campaign": "f14e4ff0-724d-43fe-a953-1d16aefd1c00",
    "relative_to": "last_hit",
    "offset": 160,
    "unit": "weeks",
    "delivery_hour": -1,
    "message": "Feeling sick and helpless, lost the compass where self is."
}

You will receive an event object as a response if successful:

{
    "uuid": "6a6d7531-6b44-4c45-8c33-957ddd8dfabc",
    "campaign": {"uuid": "f14e4ff0-724d-43fe-a953-1d16aefd1c00", "name": "Hits"},
    "relative_to": {"key": "last_hit", "name": "Last Hit"},
    "offset": 160,
    "unit": "W",
    "delivery_hour": -1,
    "message": {"eng": "Feeling sick and helpless, lost the compass where self is."},
    "flow": null,
    "created_on": "2013-08-19T19:11:21.088453Z"
}

Updating Campaign Events

A POST can also be used to update an existing campaign event if you specify its UUID in the URL.

Example:

POST /api/v2/campaign_events.json?uuid=6a6d7531-6b44-4c45-8c33-957ddd8dfabc
{
    "relative_to": "last_hit",
    "offset": 100,
    "unit": "weeks",
    "delivery_hour": -1,
    "message": "Feeling sick and helpless, lost the compass where self is."
}

Deleting Campaign Events

A DELETE can be used to delete a campaign event if you specify its UUID in the URL.

Example:

DELETE /api/v2/campaign_events.json?uuid=6a6d7531-6b44-4c45-8c33-957ddd8dfabc

You will receive either a 204 response if an event was deleted, or a 404 response if no matching event was found.