• No results found

"error": {

"type": string,

"code": integer,

"message": string, },

"response": array }

The name/value pairs used in the response object are described in the table below.

Adding customers to a message

A message is a type of offer that lets you distribute information, or highlight a specific link that you want Alert users to click. When you create a message, you can type a communication, link to a specific screen in the Alert mobile

Name Data type Description

error object Contains details of global errors, such as application errors or database errors, that prevented the operation from proceeding.

type string The type of error. If no errors were encountered, the value is none.

code integer The error code. If no errors were encountered, the value is 0.

message string The error message.

If the operation is successful, the message name/value pair is not sent.

response array An array of the Alert user IDs. For example:

"response": [ 492, 419, 551 ]

© 2014 MicroStrategy, Inc. Sending offers to customers: Offers API 129 app or an external website, schedule and distribute to specific Alert users, send a notification, and so on.

You can add customers to a message’s recipient list using the HTTP POST request described below.

Prerequisites

You must obtain the Alert user IDs, customer IDs, or loyalty membership IDs for the customers you want to send a message to. To obtain these IDs, you can use one of the following methods:

Obtain the Alert user IDs for customers who have installed your Alert-based app within a certain time frame, as described in Obtaining Alert user IDs for targeted offers, page 126.

Integrate your customer database with the Alert user database by implementing the Alert Partner API, described in Chapter 4, The Alert Partner API.

You must have created the message in Alert CMS. The message must be configured to send to a list of customers.

For steps to create an offer, refer to the Alert CMS Help, located at http:/

/www2.microstrategy.com/producthelp/AlertCMS/Help/index.html.

Obtain the message ID from the Offers page in Alert CMS. To see the message ID, click the message. The message info pane displays on the right. The ID is listed under Offer ID.

Your application must use an existing Alert administration session token, or create a new one. For the request format to obtain a session token, see Obtaining an Alert administration session token, page 105.

Request format for adding customers to a message’s recipient list

To update a message’s recipient list, use the following URL format.

Request type: POST

https://api.alert.com/admin/message/message_id/

recipients/update?token=admin_session_token where the variables in italics are as follows:

message_id: The message whose recipient list you want to change

admin_session_token: The Alert administration session token The request body contains the IDs of customers you want to add to the message’s recipient list. Depending on the IDs available to you, the request body is a JSON array in one of the following formats:

An array containing Alert user IDs. The array format is shown below:

[ //array of user IDs {

auid: integer //user ID 1 },

...

{

© 2014 MicroStrategy, Inc. Sending offers to customers: Offers API 131 }

]

An array containing customers’ authentication account IDs. The array format is shown below:

[ //array of user IDs {

customer_id: integer //user ID 1 },

...

{

customer_id: integer //user ID n }

]

An array containing customers’ loyalty membership IDs. The array format is shown below:

[ //array of user IDs {

member_id: integer //user ID 1 },

...

{

member_id: integer //user ID n }

]

The name/value pairs used in the request body are described in the following table:

Name Data type Required / Optional Description auid integer Required, if using

Alert user IDs

The customer’s Alert user ID.

customer_id integer Required, if using authentication account IDs

If the customer has an authentication account with you that is linked to their Alert account, the cus-tomer’s account ID.

For information on linking customers’ authentica-tion accounts with their Alert accounts, refer to Managing customers’ authentication accounts using the Partner API, page 209.

member_id integer Required, if using loyalty membership IDs

If the customer has a loyalty membership with you that is linked to their Alert account, the customer’s membership ID.

For information on linking customers’ loyalty memberships with their Alert accounts, refer to Managing customers’ loyalty information using the Partner API, page 264.

Response format for adding customers to a message’s recipient list

The response is a JSON object indicating whether the operation was successful. The structure of the object is shown below.

{

"failed": [ //array of failed operations {

The name/value pairs used in the response object are described in the table below.

Name Data type Description

error object Contains details of global errors, such as application errors or data-base errors, that prevented the operation from proceeding.

code integer The error code. The possible values are as follows:

• 0: No errors were encountered.

• 200: One of the required parameters is missing or incorrect.

Possible causes are:

- The request body is not formatted as a JSON object.

- The message does not exist.

- The message has been stopped or deleted in Alert CMS.

• 668: The message is being sent to a fan segment created in Alert CMS. You must send the message to individual customers.

type string The type of error. If no errors were encountered, the value is none.

response object Contains the status of the operation.

© 2014 MicroStrategy, Inc. Sending offers to customers: Offers API 133