This endpoint is called when the mobile device opens the application directly from a push message notification. This route will provide Emarsys with contact-level message open rate statistics.

Endpoint

POST https://push.eservice.emarsys.net/api/mobileengage/v2/events/message_open

Description

The developer should call this endpoint where an incoming push message is handled. The developer should retrieve custom data from the payload. It should be included in the call to Mobile Engage.

The parameters in this call are the following:

Name Type Description Comments
application_id string The ID of the application.
hardware_id string The ID of the hardware.
sid string The string ID of the push message.

Example

{
  "application_id" : "F661E-162A6",
  "hardware_id": "61C53F6F-4E93-46C0-9E67-83768B371CEB",
  "sid" : "+43c_lODSmXqCvdOz"
}

Responses

Status code Meaning
201 Created.
500 Database error (Everything else).

Calling this from iOS

var parameters: [String:AnyObject] = [String:AnyObject]()
parameters["application_id"] = APPLICATION_ID
parameters["hardware_id"] = HWID
parameters["sid"] = "(sid)"  // SID is extracted as a custom data field. See ‘When to use this?’ section

Calling this from Android

public int message_open(String msg_id){

// msg_id is the SID extracted as a custom data field. See ‘Description’ section
try {
  endpoint = new URL("https://push.eservice.emarsys.net/api/mobileengage/v2/events/message_open");
} catch (MalformedURLException e) {
  e.printStackTrace();
}

postdata = new JSONObject();

try {
  postdata.put("application_id", app_id);
  postdata.put("hardware_id", android_id);

  if (msg_id.contentEquals("null"))  {
    postdata.put("sid", "null");
  } else {
    postdata.put("sid", msg_id);
  }

} catch (JSONException e) {
  e.printStackTrace();
}

//  Send HTTP Request with payload
// return status
...
  }