Messaging schema
The messaging schema defines how the message passing should work in between your app and the app you are trying to integrate with. The messaging schema is the JSON object that defines the following properties:
Properties
Property | Description | Value Type |
---|---|---|
type | The type of messaging that you want to use. Supported values: 1. hook |
string |
handoverFields | Form presented to the user when configuring the offloading template | Fields schema |
subscriptionFields | Define which fields are needed | Fields schema |
operation | The messaging operations that your app can perform. | Operation Schema |
Example
src/messaging.jsindex.js
module.exports = {
type: "hook",
handoverFields: [
{
key: "topic",
label: "Topic",
dynamic: "channel.id.name",
placeholder: "Choose topic",
required: true,
helpText:
"The topic to apply to the offloaded conversation, only valid when the conversation was not iniciated via Freshdesk Messaging",
},
{
key: "group",
label: "Group",
dynamic: "group.id.name",
placeholder: "Choose group",
required: true,
helpText:
"The conversation will be assigned to the group that you specify. Agents in each group can pick up conversations at their convenience or Intelliassign will assign the chat if you have it enabled for the group.",
},
],
subscriptionFields: [
{
key: "bot_group",
label: "Bot group",
dynamic: "group.id.name",
placeholder: "Choose group",
required: true,
helpText: "The bot will only reply to messages on this group.",
},
{
key: "auth_header",
label: "Authentication header",
type: "text",
required: true,
helpText:
"The auth header is used to validate API calls from FreshChat. It is provided by FreshChat when you set up the webhook connection.",
},
],
operation: {
performOffload: async (sdk, bundle) => {
// TODO: Write your code to offload to your offloading provider
},
performSubscribe: async (sdk, bundle) => {
// TODO: Write your code to subscribe to your subscription provider
},
performSend: async (sdk, bundle) => {
// TODO: Write your code to send message to your messaging provider
},
performReceive: async (sdk, bundle) => {
// TODO: Write your code to receive message from your messaging provider
},
performUnsubscribe: async (sdk, bundle) => {
// TODO: Write your code to unsubscribe from your subscription provider
},
},
};
const messaging = require("./src/messaging");
module.exports = {
...,
messaging,
};