Client

Endpoints used by clients that need to retrieve or delete messages.

NOTE: All requests to this service must be sent over HTTPS

GET /messages{?token,client}

Returns a list of messages for the given user.

The token parameter can be sent as an Authorization: Bearer JWT header.

  • Parameters
  • Name Description Required Type Example
    token

    JSON Web Token issued by an auth service

    Required string eyJhbGciOiJIUzI…
    client

    The client type to get messages for (default: web, valid: web, ios, android, atv, stv)

    Required string ios
    limit

    Max number of messages to return (default: 5)

    integer 3
  • Response 200 SHOW
  • < Content-Type: application/json; charset=utf-8
    {
      "meta": {
        "endpoint": "/messages/1",
        "forwarded_for": "",
        "request_id": "17bb92e1-bb7d-497c-a696-1735d6983a25",
        "timestamp": "2017-07-25T09:24:08.666752858Z"
      },
      "data": {
        "message": {
          "id": "1",
          "uid": "-1234",
          "body": "test body 2",
          "state": "imported",
          "type": "test",
          "created": "2017-01-01T01:01:01+01:00",
          "expires": "2032-01-01T01:01:01+01:00",
          "clients": [
            "ios",
            "android",
            "web"
          ],
          "prio": 0
        }
      }
    }
    
    
  • Response 401 SHOW
  • Returned if unauthorized
    
    
  • Response 500 SHOW
  • Returned if unable to retrieve messages from the database
    
    
DELETE /messages/{message_id}{?token}

Update the status of a message to deleted

All messages marked as deleted is synced back to the Adobe Campaign system by scheduled calls to the /messages/sync endpoint.

The token parameter can be sent as an Authorization: Bearer JWT header.

It is also possible to delete messages using a X-Api-Key.

  • Parameters
  • Name Description Required Type Example
    message_id

    Message identifier

    Required string 123
    token

    JSON Web Token issued by an auth service

    Required string eyJhbGciOiJIUzI…
  • Response 204 SHOW
  • Returned if message was deleted
    
    
  • Response 400 SHOW
  • Returned if passed invalid message_id
    
    
  • Response 401 SHOW
  • Returned if unauthorized
    
    
  • Response 404 SHOW
  • Returned if unable to delete message
    
    

Backend

Endpoints used primarily by the Adobe Campaign backend.

NOTE: All requests to this service must be sent over HTTPS

POST /messages/import

You need to provide the X-Api-Key header and send the request over HTTPS.

The request body MUST be a stream of valid JSON documents with \r\n line separators.

Each document needs to be a valid message with the following fields:

Field Description Example
id (required) Message ID, must be unique "123"
uid (required) User ID "1616416"
vid Vman ID "3003060"
created (required) Created date "2014-11-06T13:34:59+01:00"
expires (required) Expires date "2014-11-10T13:34:59+01:00"
title Title of the message "Kolla på Hellenius hörna"
lead Short lead of the message "Svensk talkshow…"
body (required) Body of the message "Svensk talkshow med David Hellenius…"
url URL "https://www.cmore.se/konto/mitt-konto"
img Image URL "http://aman.production.s3.amazon…"
clients (required) List of target clients ["web","ios","android","atv","stv"]
type (required) Type "campaign"
prio (required) Priority of the message 35
  • Requests SHOW
  • > Content-Type: application/json; boundary=NL
    > X-Api-Key: f00bar01234
    {"id":"123","uid":"456","vid":"3003060","created":"2014-11-06T13:34:59+01:00","expires":"2014-11-10T13:34:59+01:00","title":"Kolla på Hellenius hörna","lead":"Svensk talkshow med David Hellenius.","body":"Svensk talkshow med David Hellenius som träffar kända och aktuella gäster.","img":"http://aman.production.s3.amazonaws.com/506d51dd2c4b61095800014d/fb1024_helleniushorna_2013.jpg","clients":["web","ios","android"],"type":"campaign","prio":35}
    {"id":"124","uid":"789","vid":"3003060","created":"2014-11-06T13:34:59+01:00","expires":"2014-11-10T13:34:59+01:00","title":"Kolla på Hellenius hörna","lead":"Svensk talkshow med David Hellenius.","body":"Svensk talkshow med David Hellenius som träffar kända och aktuella gäster.","img":"http://aman.production.s3.amazonaws.com/506d51dd2c4b61095800014d/fb1024_helleniushorna_2013.jpg","clients":["web","ios","android"],"type":"campaign","prio":35}
    
  • Response 200 SHOW
  • Returned if everything went well
    
    
  • Response 400 SHOW
  • Returned if unable to decode or validate a message to be imported
    
    
  • Response 401 SHOW
  • Returned if unauthorized
    
    
  • Response 409 SHOW
  • Returned if bulk import returned an error, duplicate_key is the first duplicate id. New messages are inserted into the database.
    {
      "meta": {
        "duplicate_key": "456",
        "endpoint": "/messages/import",
        "forwarded_for": "",
        "request_id": "",
        "timestamp": "2017-06-22T08:18:52.802639367Z"
      },
      "errors": [
        {
          "status": 409,
          "title": "Conflict",
          "detail": "E11000 duplicate key error collection: cmore-messages.messages index: _id_ dup key: { : \"456\" }"
        }
      ]
    }
    
    
  • Response 413 SHOW
  • Returned if the client sent too many messages at once.
    Default import limit is 25000 messages
    
    
POST /messages/retract

You need to provide the X-Api-Key header and send the request over HTTPS.

The request body MUST be a valid JSON document in the specified format.

The /messages/retract endpoint is used when there is a need to invalidate a list of messages.

  • Requests SHOW
  • > Content-Type: application/json
    > X-Api-Key: f00bar01234
  • Response 200 SHOW
  • < Content-Type: application/json; charset=utf-8
  • Response 400 SHOW
  • Returned if unable to decode the request body
    
    
  • Response 401 SHOW
  • Returned if unauthorized
    
    
  • Response 404 SHOW
  • Returned if unable to retract any message in the provided list
    
    
POST /messages/sync{?key}

Used to sync all deleted messages back to the Adobe Campaign system.

This endpoint is automatically triggered by the Temporize Scheduler every 4 minutes.

Example payload (sent to pmserviceSync)

{
  "messages":[
    {"id":"123"},
    {"id":"456"}
  ]
}
  • Parameters
  • Name Description Required Type Example
    key

    The API key used by the sync scheduler. (You may send the X-Api-Key header instead)

    Required string temporize-58648235b0490d0081a942f9
  • Response 200 SHOW
  • < Content-Type: application/json; charset=utf-8
  • Response 401 SHOW
  • Returned if unauthorized
    
    
  • Response 404 SHOW
  • Returned if unable to set the messages to status synced in the database
    
    
  • Response 500 SHOW
  • Returned if unable to delete messages or perform the sync request
    
    
  • Response 503 SHOW
  • Returned if sync is disabled
    
    
POST /messages/cleanup{?key}

Scheduled database cleanup. (Removing synced and expired messages from MongoDB)

This endpoint is automatically triggered by the Temporize Scheduler

  • Parameters
  • Name Description Required Type Example
    key

    The API key (You may send the X-Api-Key header instead)

    Required string dashboard-9043a0f543e07f7ffa91a388
  • Response 200 SHOW
  • < Content-Type: application/json; charset=utf-8
  • Response 401 SHOW
  • Returned if unauthorized
    
    
  • Response 403 SHOW
  • Returned if requesting endpoint over HTTP
    
    
  • Response 404 SHOW
  • Returned if not found
    
    
  • Response 500 SHOW
  • Returned if database was unable to do the cleanup
    
    
GET /messages/{message_id}{?key}

Show any message, requires API key.

  • Parameters
  • Name Description Required Type Example
    message_id

    Message identifier

    Required string 123
    key

    The API key (You may send the X-Api-Key header instead)

    Required string client-9043a0f543e07f7ffa91a388
  • Response 200 SHOW
  • < Content-Type: application/json; charset=utf-8
    {
      "meta": {
        "endpoint": "/messages/1",
        "forwarded_for": "",
        "request_id": "",
        "timestamp": "2017-07-25T09:38:34.277120478Z"
      },
      "data": {
        "message": {
          "id": "1",
          "uid": "-1234",
          "body": "test body 2",
          "state": "imported",
          "type": "test",
          "created": "2017-01-01T01:01:01+01:00",
          "expires": "2032-01-01T01:01:01+01:00",
          "clients": [
            "ios",
            "android",
            "web"
          ],
          "prio": 0
        }
      }
    }
    
    
  • Response 400 SHOW
  • Returned if passed invalid message_id
    
    
  • Response 401 SHOW
  • Returned if unauthorized
    
    
  • Response 404 SHOW
  • Returned if not found in the database
    
    
DELETE /users/{user_id}/messages{?key}

Update the status of all imported messages for a user to deleted

  • Parameters
  • Name Description Required Type Example
    user_id

    User identifier

    Required string 234
    key

    The API key (You may send the X-Api-Key header instead)

    Required string client-9043a0f543e07f7ffa91a388
  • Response 200 SHOW
  • < Content-Type: application/json; charset=utf-8
  • Response 401 SHOW
  • Returned if unauthorized
    
    

Info

Endpoints containing information about the C More Messages service.

GET /__status

Whatsup status document

  • Response 200 SHOW
  • < Content-Type: application/json; charset=utf-8