Developers

Create Ticket Adapter

Introduction

The purpose of this adapter is to create a ticket in the Messenger module. It can be used with the NL Escalation Adapter in order to create a ticket when there are no agents available.

Internal Adapter

This adapter is included in the Chatbot SDK to facilitate the steps to create a ticket in the Messenger module. It is available from version 1.68.2.

The adapter does the following actions:

  • Builds the Messenger JS Client.
  • Creates a ticket in the Messenger instance using the JS Client when the createTicket action is executed.

In order to use the adapter you need to add it to the adapters array:

adapters: [
    SDKInbentaCreateTicketAdapter.build(messengerConfig),
]

Configuration parameters

See the configuration parameters to be passed to the build function:

  • apiKey (string): API key from the Messenger instance to create the ticket.
  • domainKey (string): Domain key from the Messenger instance to create the ticket.
  • queue (function): The queue where the ticket will be created.
  • source (function) [optional]: The source ID of the ticket.
  • classifications (array) [optional]: Array with the classifications IDs (Example: classifications: [1,4,6])
  • importBotHistory (boolean) [optional]: Whether to import the chatbot previous conversation transcript into the ticket or not. The number of messages is limited to 150. Is set to true by default.

Messenger configuration object example:

const messengerConfig = {
    apiKey: '*********',
    domainKey: '**********',
    queue: function() {
        return 1;
    },
    source: function() {
        return 2;
    },
    classifications: [4,6],
    importBotHistory: true,
};

The following example shows how to initialize the SDK with this adapter:

<script>
  const authorization = {
    domainKey: <chatbot_domain_key>,
    inbentaKey: <chatbot_api_key>,
  };
  const createTicketConfig = {
    apiKey: <messenger_api_key>,
    domainKey: <messenger_domain_key>,
    queue: function() {
      return 1;
    },
    source: function() {
      return 2;
    },
    classifications: [4,6],
    importBotHistory: true,
  };
  InbentaChatbotSDK.buildWithDomainCredentials(authorization, {
    adapters: [
      SDKInbentaCreateTicketAdapter.build(createTicketConfig)
    ]
  });
</script>