Messaging API: Is there a message element that remains constant and does not depend on the direction of the text message?

Last Updated: Jan 17, 2017 02:35PM PST
Yes, you can use the deviceID because it remains constant regardless of whether the message is inbound (MO or mobile originated) or outbound (ZO or Zipwhip originated). The deviceID is established when the consumer logs-in and gets a session key.

The deviceID is always the number to the right of the colon in the session login response. For example, in the session login below, the deviceID is highlighted.

  “success”: true,
  “response”: “cd171f7c-560d-4a62-8d65-16b87419a58c:1234567

In the inbound message sample below, you can see the highlighted deviceID that you can use to track inbound and outbound messages.
    "body": "Auto Magic Testing: 0",
    "bodySize": 21,
    "visible": true,
    "hasAttachment": false,
    "dateRead": "2016-07-27T11:02:52-07:00",
    "bcc": null,
    "finalDestination": "2069306209",
    "messageType": "ZO", Directionality of the message
    "deleted": false,
    "statusCode": 1,
    "id": 758362030085648384,
    "scheduledDate": null,
    "fingerprint": "1668546672",
    "messageTransport": 5,
    "contactId": 4020550802,
    "address": "ptn:/2069306209",
    "read": true,
    "dateCreated": "2016-07-27T11:02:52-07:00",
    "dateDeleted": null,
    "dateDelivered": null,
    "cc": null,
    "finalSource": "2065823773", // Text enabled number
    "deviceId": 1234567 // Constant way to determine text-enabled number to which the message belongs

Customer Care
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found