Channel API

Introduction

In Agent Inbox there is a possibility to use your own custom channel. In order for this to work, the Agent Inbox API needs to be configured (please contact [email protected] for assistance). A custom channel has the following characteristics that needs to be defined before getting started:

  • External identifier
  • Name
  • Avatar (2 sizes: 18\18px and 26\26 px)
  • Webhook URL
  • Support private messaging (true/false)
  • Send private as email (true/false)
  • Support select webstore (true/false)
  • Support sending attachments

The incoming and outgoing requests are the same for a custom channel, but there is one thing that we want to highlight: ConversationGuid. This field is generated by Agent Inbox. So for the first incoming request, this doesn't has any value or function. With the first answer the agent from Agent Inbox we will send the ConversationGuid in the outgoing JSON. If the next incoming request has the same ConversationGuid, we will map the message into that conversation without having matching external identifiers for Conversation and Relation.

Messages

POST https://api.robinhq.com/messages/

Response codes

CodeDescription
201Created
400Bad Request
401Invalid authorisation data

Request body

{
  "ChannelAccountExternalIdentifier": "customChannel",
  "ConversationGuid": "mscConvGuid",
  "ConversationExternalIdentifier": "convId",
  "MessageExternalIdentifier": "messId",
  "RelationExternalIdentifier": "[email protected]",
  "RelationName": "John",
  "Content": "This is a message",
  "IsPrivate": false,
  "Referrer": "http://cm.com",
  "Subject": "Question",
  "SentDateTime": "2021-09-12T12:34:56",
  "Attachments": [
    {
      "FileName": "attachment.txt",
      "Base64Content": "MQ=="
    }
  ]
}

Request schema

NameTypeRequiredDescription
ChannelAccountExternalIdentifierStringYesThis is the registered name of the custom channel, determined when the channel is registered
ConversationGuidStringNoThe generated GUID of the conversation
ConversationExternalIdentifierIntegerYesThis is the external ID of the conversation
MessageExternalIdentifierStringYesThis is the external ID of the message
RelationExternalIdentifierFloatYesThe external ID of the relation (usually an email address or phonenumber)
RelationNameStringYesThe name of the relation
ContentStringYesThe content of the answer
IsPrivateBooleanNoIndicates whether the returned message is marked private by the agent
ReferrerStringNoThe referrer of the message, e.g. an URL
SubjectStringNoThe subject of the message when a new conversation will be created
SentDateTimeStringNoThe date when a message was sent
AttachmentsArrayYesAn attachment object
FileNameStringYesThe filename of the attachment. Can be left empty if no attachments are attached
Base64ContentStringNoThe bytes of the attachment as base64 encoded string. Can be left empty if no attachments are attached