Resource
POST https://api.robinhq.com/messages
Succes message: 201 Created
Error in JSON: 400 Bad Request
Wrong authentication: 401 Invalid authorisation data
Starting with v1.7 of the ROBIN API, we added the possibility to use your own custom channel. In order for this to work, the ROBIN API needs to be configured (please contact api@robinhq.com for assistance). A custom channel has the following characteristics:
- 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
Webhook URL
Part of registering a custom channel, is defining a so called webhook URL. This is an URL that ROBIN posts replies to messages to. When an agent types a reply to a message that was created for a custom channel, that response is posted to the registered webhook URL for that channel. The data posted is a JSON string containing the following properties (this first section are properties that were provided to the original message):
{
"ChannelAccountExternalIdentifier": "whatsapp",
"ConversationGuid": "ddb44afc-b87d-4437-95c2-707543c84676",
"ConversationExternalIdentifier": "convId",
"MessageExternalIdentifier": "messId",
"RelationExternalIdentifier": "john@email.com",
"RelationName": "John",
"Content": "This is a message",
"IsPrivate": false,
"Referrer": "http://robinhq.com",
"Subject": "Question",
"SentDateTime": "2017-09-12T12:34:56",
"Attachments": [
{
"FileName": "attachment.txt",
"Base64Content": "MQ=="
}
]
}
The only exception is when a channel has “Send private as email” set and an agent sends a private reply, in which case the reply is sent directly via email and not posted to the webhook URL.
Schema of Custom Channel
Key | Type | Required | Description | Example |
---|---|---|---|---|
ChannelAccountExternalIdentifier | string | Yes | This is the registered name for the custom channel, determined when the channel is registered. | "whatsapp" |
ConversationGuid | string | No | The generated GUID of the conversation. | "ddb44afc-b87d-4437-95c2-707543c84676" |
ConversationExternalIdentifier | string | Yes | This is the external ID for the conversation. | "convId" |
MessageExternalIdentifier | string | Yes | This is the external ID for the message. | "messId" |
RelationExternalIdentifier | string | Yes | The external ID for the relation (usually an email address or phone number) | "john@email.com" |
RelationName | string | Yes | The name for the relation | "John" |
Content | string | Yes | The content of the answer. | "This is a message" |
IsPrivate | boolean | No | Indicates whether the returned message is marked private by the agent. | false |
Referrer | string | No | The referrer for the message, e.g. an URL | "http://robinhq.com" |
Subject | string | No | The subject for the message when a new conversation will be created. | "Question" |
SentDateTime | string | No | The date when a message was sent. | "2017-09-12T12:34:56" |
Attachments | array[Attachment] | Yes | An attachment object contains the following properties: FileName Base64Content | [] |
FileName | string | Yes | The filename of the attachment. Can be left empty if no attachments are attached. | "attachment.txt" |
Base64Content | string | No | The bytes of the attachment as base64 encoded string. Can be left empty if no attachments are attached. | "MQ==" |