Close

Message API

The Message API is useful when there is an existing message management system in-house that can be integrated with Omniata Engagement tools. This approach is most effective when the campaigns have a significant amount of different types of segments.

You will need an authorization token from your account settings page found at Profile -> Profile Info to use the Content API. The token is a 20 digits hash, you can generate your token at any time.

Messages: get

This command can be used to obtain the Channel Message ID that uniquely identifies each message.

Request Definition

The API URL is assigned per organization. We use “{orgname}” as an example, when testing use your organization’s assigned subdomain name defined in the Omniata panel.

GET https://{orgname}.panel.omniata.com/data_models/{applicationId}/channels/{channelId}/channel_messages.json

Parameters

Use the following parameters to list messages in a channel:

Name Example Description
applicationId 123 Identifies the application within the organization. The Application Id can be found in the Omniata URL preceding the Application’s name.
channelId 3 Unique identifier of a channel within an application.

Response

If successful the returned answer is a JSON structure with all published messages in the Channel. Scheduling is in UTC. The qualifier “includes_target_ids” are given by the segment identifiers found in Engage -> Segments. To know more about segments creation check the Segments guide.

Example request:

$ curl -H 'Authorization: Token token="987AbcAbc987Abc123Ab"' "http://{orgname}.panel.omniata.com/data_models/4/channels/3/channel_messages.json"

Example response:

[
  {
    "channel_id": 3,
    "content_id": 1,
    "data_model_id": 4,
    "enable_scheduling": true,
    "enabled": false,
    "excludes_target_ids": [],
    "experiment_experience_id": 57,
    "from": "2015-10-17T21:00:00.000Z",
    "id": 46,
    "includes_target_ids": [
      1
    ],
    "to": "2015-10-22T05:00:00.000Z"
  },
  {
    "channel_id": 3,
    "content_id": 1,
    "data_model_id": 4,
    "enable_scheduling": false,
    "enabled": false,
    "excludes_target_ids": [],
    "experiment_experience_id": 55,
    "from": null,
    "id": 44,
    "includes_target_ids": [],
    "to": null
  }
]

Messages: post

Allows the publishing (save and enable) of a message in the specified channel.

Request Definition

The API URL is assigned per organization. We use “{orgname}” as an example, when testing use your organization’s assigned subdomain name defined in the Omniata panel.

POST https://{orgname}.panel.omniata.com/data_models/{applicationId}/channels/{channelId}/channel_messages.json

Parameters

Use the following parameters to publish messages:

Name Example Description
applicationId 123 Identifies the application within the organization. The Application Id can be found in the Omniata URL preceding the Application’s name.
channelId 3 Unique identifier of a channel within an application.
channel_message[content_ids] 37 Unique identifier of the content to include in the message. Can be defined multiple times to add more content.
channel_message[enabled] 1 Enables the message upon publishing. If publish with value 0, the message is published as draft.
channel_message[includes_target_ids] 14 Unique identifiers of the segments applied to the message. Can be defined multiple times to add more segments.
channel_message[enable_scheduling] 1 Enables scheduling for the message.
channel_message[from] 2017-01-01 Scheduling start date for the message.
channel_message[to] 2017-03-31 Scheduling end date for the message.

Response

If successful, the response is a JSON structure with the details of the published message.

Example request:

$ curl -H 'Authorization: Token token="987AbcAbc987Abc123Ab"' -X POST -d "channel_message[content_ids]=37" -d "channel_message[enabled]=1" -d "channel_message[includes_target_ids]=14" -d "channel_message[enable_scheduling]=1" -d "channel_message[from]=2017-04-01" -d "channel_message[to]=2017-06-01" "http://{orgname}.panel.omniata.com/data_models/4/channels/3/channel_messages.json"

Example response:

{
  "channel_id": 3,
  "content_id": 37,
  "data_model_id": 4,
  "enable_scheduling": true,
  "enabled": true,
  "excludes_target_ids": [],
  "experiment_experience_id": null,
  "from": "2017-04-01T00:00:00.000Z",
  "id": 96,
  "includes_target_ids": [
    14
  ],
  "to": "2017-06-01T00:00:00.000Z"
}

Messages: post (bulk operation)

Allows bulk operations of messages in the specified channel. The operation is defined by the parameters in the request.

Request Definition

The API URL is assigned per organization. We use “{orgname}” as an example, when testing use your organization’s assigned subdomain name defined in the Omniata panel.

POST https://{orgname}.panel.omniata.com/data_models/{applicationId}/channels/{channelId}/channel_messages/bulk_operation_confirmed.json

Parameters

Use the following parameters to publish messages:

Name Example Description
applicationId 123 Identifies the application within the organization. The Application Id can be found in the Omniata URL preceding the Application’s name.
channelId 3 Unique identifier of a channel within an application.
bulk_operation[channel_message_ids] 96 Unique identifier of the message for which the operation is executed. Can be defined multiple times to add more content.
bulk_operation[operation] disable Bulk operation qualifier. Allowed operations are: enable, disable, delete.

Response

If successful, the response is a HTTP 204 code.

Example request:

$ curl -H 'Authorization: Token token="987AbcAbc987Abc123Ab"' -X POST -d "bulk_operation[channel_message_ids]=96" -d "bulk_operation[operation]=disable" -d "http://{orgname}.panel.omniata.com/data_models/4/channels/3/channel_messages/bulk_operation_confirmed.json"

Example response:

Status: 204 No Content

This article was last updated on March 30, 2017 16:03. If you didn't find your answer here, search for another article or contact our support to get in touch.