DeprecatedCampaign Creation API

Campaign Creation API

Create a campaign programmatically, setting its name, status, active window, type and template.

The Creating Campaigns API is no longer supported for new integrations.

Creating Campaigns

Creates a campaign.

Endpoints

This method offers the following endpoints:

REST Endpoints

POST /priv/v1/apps/:api_key/management/campaigns

For more information on how to specify an endpoint as part of an actual URL, see Before You Begin. The procedure in this section includes a sample URL for a customer transaction.

Endpoint Parameters

The following parameters are available when specifying the endpoint for this method:

Endpoint ParameterDescription
api_keySupplied by the SessionM Platform, the API key is necessary to authenticate any HTTP request to a SessionM API. This key is associated to an API secret, which ties the authentication to a specific application or web site within the organization. The platform maintains each application or site as a digital property, something that can be configured using the SessionM UI.

Request Object

When this method runs, it passes in a campaign object, as shown below:

JSON Request

{
  "campaign": {
    "name":"Campaign Example",
    "status":"live",
    "starts_at":"2021-12-31T05:00:00Z",
    "ends_at":"2022-01-04T05:00:00Z,
    "campaign_type": "promotion",
    "template": "promotion"
  }
}

This object is detailed in the following table:

Request Attributes for Campaign

AttributeType

Required/Optional
Description
namestring

required
Name of campaign. Must be unique.
statusstring

required
Defines whether the campaign is "live," "paused," "draft," "inreview," or "completed." Should be "live" for this endpoint. Users can engage with only a live campaign via actions such as triggering behaviors and receiving outcomes.
starts_atdatetime

required
Timestamp when campaign becomes active.
ends_atdatetime

required
Timestamp when campaign becomes inactive.
external_idstring

optional
Client's own ID for campaign. If external_id parameter is not provided in request, platform generates GUID for campaign and returns it in response. This attribute serves as an alias in this API for permalink, which is the actual database field that contains the value for external_id. See more on permalink in the response object discussion below.
campaign_typestring

optional
Allowed values are "promotion" and "messaging".
templatestring

optional
Same value as campaign_type.

Response Object

In addition to a status key-value pair, the response object returned by the method contains a campaign object, as shown below:

JSON Response

{
  "campaign": {
    "ends_at": "2020-08-19T15:02:54Z",
    "external_id": "d4f5fc94-dcad-11ea-845e-7001986d963d",
    "id": 721,
    "metadata": {},
    "name": "Campaign Example",
    "starts_at": "2020-08-12T15:02:54Z",
    "status": "live",
    "total_budget": 0,
    "weight": 5,
    "campaign_type": "promotion",
    "template": "promotion"
  },
  "status": "ok"
}

This object is detailed in the following table.

Response Attributes for Campaign

AttributeTypeDescription
namestringName of campaign.
statusstringDefines whether campaign is "live," "paused," "draft," "inreview," or "completed." Should be "live" for this endpoint. Users can engage with only live campaign via actions such as triggering behaviors and receiving outcomes.
starts_atdatetimeTimestamp when campaign becomes active.
ends_atdatetimeTimestamp when campaign becomes inactive.
external_idstringClient's own ID for campaign. If external_id parameter is not provided in request, platform generates GUID for campaign and returns it in response. This attribute serves as an alias in this API for permalink, which is the actual database field that contains the value for external_id. See more on permalink in the response object discussion below.
campaign_typestringAllowed values are "promotion" and "messaging".
templatestringSame value as campaign_type.
idintegerDatabase identifier.
metadataobjectJSON object containing any data that the user might want to attach to the campaign.
total_budgetintegerLegacy field.
weightintegerLegacy field.
division_idstringID of the division that the campaign is assigned to. Will not be returned when multi-org is disabled.

The table below documents a set of additional optional attributes that can be part of a request and appear in the response.

Additional Response Attributes for Campaign

AttributeTypeDescription
campaign_idintegerCampaign identifier internal to SessionM.
campaign_permalinkstringPermanent, static hyperlink for campaign.
start_datestringCampaign starting date.
end_datestringCampaign end date.
permalinkstringGUID that can be passed to the API instead of the campaign_id (integer ID) for a campaign. Returned as an external_id in the response. This attribute is the actual database field that contains the value for external_id.
optin_requiredbooleanIndicates whether or not opt-in is required for customers wanting to participate in campaign. true if an opt-in is required; false if it is not.
opt_in_starts_atdatetimeOpt-in starting date.
opt_in_ends_atdatetimeOpt-in ending date.
reporting_ends_atdatetimeTimestamp when reporting data will no longer be generated for a campaign.
targetingobjectSerialized JSON query that is used to create ad targets.
qualify_tagstringTag used in targeting to indicate that the user is qualified. Must be included in targeting setup to function.
disqualify_tagstringTag used in targeting to indicate the user is disqualified. Must be included in targeting setup to function.
qualifiedbooleanCurrent customer qualification for campaign - after domain call. For example, false can result from targeting that tags the customer and targeted away from the campaign.
group_idintegerInternal ad group identifier.
creative_idintegerPlatform-generated ID of the ad unit content, which is also called creative content.
versionstringCampaign version.

Statuses and Errors

When this method makes a successful call to the platform, it returns a 200-level status code. When the string returned with a 200-level status code is ok, the transaction did process. But, if the string returned is error, you need to discover what type of error occurred.

Returned errors can be either method-specific or generic. The platform returns the following error messages for this method:

CodeReason
argument_errorUnknown campaign attributes test.
missing_dataMissing campaign data.
not_foundParent model not found.
not_foundParent model not in same organization.
validationValidation error.

For information on the generic statuses and errors returned for any object, see the associated section in Generic Statuses and Errors.