Significance

Accounts can now configure an active conversation limit where the server only sends over a set of n active conversations.

When sending messages through Server API on behalf of a bot (or a real user), there may be times when you may want to insert a message, but not change the active set of conversations for a participant. For example, a teacher may have 50 active conversations out of a group of 1,000 students; however, the system may want to remind all 1,000 students to finish their coursework. By including a significance in your message or on conversation create, you can easily message users without bringing their conversations to the forefront.

The significance object supports the following parameters:

Name Type Description
default string Default significance rating for all participants in the conversation. Allows low or normal. If not specified, normal is assumed.
recipients object Hash of participant overrides of the default significance rating. The Identity ID should be used to map to the significance rating for the message for that Identity.

HTTP request:

POST/apps/:app_uuid/conversations/:conversation_uuid/messages

Example:

{
  "sender_id": "layer:///identities/1234",
  "parts": [
    {
      "body": "Hello, World!",
      "mime_type": "text/plain"
    },
    {
      "body": "YW55IGNhcm5hbCBwbGVhc3VyZQ==",
      "mime_type": "image/jpeg",
      "encoding": "base64"
    },
  ],
  "significance": {
    "default": "low",
    "recipients": {
      "layer:///identities/5678": "normal"
    }
  }
}
curl -X POST \
     -H 'Accept: application/vnd.layer+json; version=3.0' \
     -H 'Authorization: Bearer <TOKEN>' \
     -H 'Content-Type: application/json' \
     https://api.layer.com/apps/<app_uuid>/conversations/<conversation_uuid>/messages\
 -d '{"sender_id":"layer:///identities/8rEsAfaBYS","parts":[{"body":"I have just the thing for you!","mime_type":"text/plain"}],"significance":{"default":"low","recipients":{"layer:///identities/5678":"normal"}}}'

Possible responses:

Message Sent Successfully | Status: 201 (Accepted)

HTTP request:

POST/apps/:app_uuid/conversations

Example:

{
  "participants": [
    "layer:///identities/1234",
    "layer:///identities/5678"
  ],
  "distinct": false,
  "metadata": {
    "background_color": "#3c3c3c"
  },
  "significance": {
    "default": "low",
    "recipients": {
        "layer:///identities/1234": "normal"
    }
  }
}
curl -X POST \
     -H 'Accept: application/vnd.layer+json; version=3.0' \
     -H 'Authorization: Bearer <TOKEN>' \
     -H 'Content-Type: application/json' \
     https://api.layer.com/apps/<app_uuid>/conversations\
 -d '{"participants":["layer:///identities/1234","layer:///identities/5678"],"distinct":false,"metadata":{"background_color":"#3c3c3c"},"significance":{"default":"low","recipients":{"layer:///identities/1234":"normal"}}}'

Possible responses:

Conversation Created Successfully | Status: 201 (Accepted) Matching Distinct Conversation Found | Status: 200 (Accepted) Conflicting Distinct Conversation Found | Status 409 (Conflict)