ChatInboxResult chat.inbox-result@1

Generated at from openvibe-contracts v0.221.0 and openvibe-sdk v0.65.0.

Version
1.0.0
Owner
chat
Visibility
public
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/chat/inbox-result.v1.json

chat.inbox-result@1: a support inbox as its people see it ({ inbox, members?, embed? }: the widget snippet and panel address), or the inboxes a person works in ({ inboxes }, each with their role and how many conversations wait and are open). Secrets (the identity secret, webhook and action secrets) appear only on the answer that made them.

Fields

FieldTypeRequiredDescriptionConstraints
inboxobject
inbox.idstringyes
  • pattern ^inb_[0-9A-HJKMNP-TV-Z]{26}$
inbox.namestringyes
inboxesarray of object
inboxes[].idstringyes
inboxes[].namestringyes
inboxes[].roleenumyes
  • one of "owner", "agent"
inboxes[].waitinginteger
inboxes[].openinteger
membersarray of object
embedobject
embed.scriptstring
embed.panelstring

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: an-inbox
{
  "inbox": {
    "id": "inb_01J9ZQ3M5K8V2R4T6Y8W0X2C4B",
    "name": "Pixel Lamp Co."
  },
  "embed": {
    "script": "<script src=\"https://openvibe.chat/widget.js\" data-inbox=\"inb_01J9ZQ3M5K8V2R4T6Y8W0X2C4B\" async></script>",
    "panel": "https://openvibe.chat/embed/inbox/inb_01J9ZQ3M5K8V2R4T6Y8W0X2C4B"
  }
}
Valid: my-inboxes
{
  "inboxes": [
    {
      "id": "inb_01J9ZQ3M5K8V2R4T6Y8W0X2C4B",
      "name": "Pixel Lamp Co.",
      "role": "owner",
      "waiting": 2,
      "open": 5
    }
  ]
}
Rejected: bad-role
{
  "inboxes": [
    {
      "id": "inb_01J9ZQ3M5K8V2R4T6Y8W0X2C4B",
      "name": "x",
      "role": "boss"
    }
  ]
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('chat.inbox-result@1', value);   // { valid, errors: [{ path, message }] }