External Contact Center Solutions
---

Your chatbot should be able to manage most of the queries and requests from end users However there may be some cases where an agent is required Example The end user's request is too complex for the chatbot to handle or cases where end users ask to speak to an agent

To enable Answers to transfer the chat to an agent you can integrate Answers not only with Infobip's contact center solution [Conversations](https://www.infobip.com/docs/conversations) but also with third-party Contact Center as a Solution (CCaaS) or Customer Relationship Management (CRM) solutions Example You can use Answers chatbots with your ticketing system; or use the digital channels which Answers supports with your contact center solution

This section explains how to integrate Answers with third-party CCaaS or CRM solutions The integration uses the [Conversations API](https://www.infobip.com/docs/conversations-api) which is available free of charge with Answers

To integrate Answers with the Conversations solution refer to the [Conversations](https://www.infobip.com/docs/conversations) section

## Prerequisites

A translation layer that enables integration between the CCaaS solution and Conversations API The translation layer must be able to handle the state of the Answers session and the equivalent entity on the CCaaS solution Example interaction ticket or case

The translation layer can be one of the following

- Part of the CCaaS solution The CCaaS solution must support integration with Conversations API
- A dedicated middleware application that enables integration between the CCaaS solution and Conversations API

## Technical Specifications

The following flow explains how to escalate an Answers session to an agent

1 Inform the CCaaS solution that there is a conversation that the solution needs to handle
2 Provide the conversation history and context to the CCaaS solution
3 Deliver all new inbound messages to the CCaaS solution
4 Enable the CCaaS solution to send outbound messages to the end user
5 Close the Answers session

### Infobip Conversations API [#infobip-conversations-api-technical-specifications]
#### Mandatory APIs [#mandatory-apis-technical-specifications]

The implementation uses the following mandatory APIs

For Account Configuration

[Update Account Configuration](https://www.infobip.com/docs/api/customer-engagement/conversations/update-conversation-account-configuration)

This API is used to subscribe to all inbound messages so that they can be transferred to the CCaaS solution

Currently this API does not support authentication When subscribing to inbound messages the resulting Post messages sent by Infobip do not include authentication credentials to gain access to the translation layer

This API supports only one webhook configuration at a time So overwriting a webhook removes the previous configuration

To Close a Conversation

[Update Conversation](https://www.infobip.com/docs/api/customer-engagement/conversations/update-conversation)

This API enables a conversation to be closed when the agent has completed the interaction

To Obtain Conversation History

Get Messages

This API is used to retrieve the history of the conversation so that it can be forwarded to the CCaaS solution

To Handle Messages

Create Message

This API is used by the translation layer to forward messages from the agent to the end user

#### Optional APIs [#optional-apis-technical-specifications]

The following optional APIs are used to customize or improve the implementation

To Add Context to a Conversation

The following APIs are used in the chatbot to add tags that provide context to the conversation This helps the translation layer identify the relevant queue language or campaign in the CCaaS solution to which the conversation must the routed

- Create Tag
- Add Tag
- Get Tags

To Handle Metadata

The following APIs are used in the chatbot to add metadata that provides context to the conversation for routing and prioritization Use the relevant key:value pairs

- Put Metadata
- Get Metadata

## Implementation

Carry out the instructions in each of the following sections

### Setup to Forward Inbound Messages [#setup-to-forward-inbound-messages-implementation]

After the chatbot hands over the conversation to an agent you need to make sure that new inbound messages are forwarded from the Conversations API to the CCaaS solution

Do the following

1 Configure the account (Update Account Configuration to send all new inbound messages to the translation layer
2 Configure the translation layer to store the authentication credentials for both Infobip and the CCaaS solution This enables the translation layer to send and receive messages

### Identify Conversations that Need External Agents [#identify-conversations-that-need-external-agents-implementation]

Configure your chatbot such that it can transfer the conversation to an agent

1 On the Infobip [web interface](https://portal.infobip.com//) go to Answers > Chatbots and navigate to your chatbot
2 Create a new dialog in which you will direct the end user to an agent if the chatbot is unable to handle the enquiry
3 In the new dialog do the following
    - Add an [ API](https://www.infobip.com/docs/answers/chatbot-elements/core-elements#api) element to inform the translation layer that the specific ConversationID must be routed to an agent
    - Add a [To Agent](https://www.infobip.com/docs/answers/chatbot-elements/core-elements#to-agent) element to end the Answers session and prevent the chatbot from responding to further messages from the end user

To add context to the conversation use tags andor metadata This helps the translation layer identify the relevant queue language or campaign in the CCaaS solution to which the conversation must the routed Configure the chatbot to attach any required context to the conversation before it deploys the To Agent element

Important
The To Agent element ends the Answers session immediately

### Hand Over to Agent [#hand-over-to-agent-implementation]

The translation layer receives the required information to pass the session from Answers (Conversations API) to the CCaaS solution The translation layer needs to get additional information before forwarding the session to the CCaaS solution

Configure the translation layer to do the following

- Use Get Messages to obtain the history The history contains a maximum of 1000 messages
- (Optional) Obtain tags andor metadata from the conversation
- Route the session content to the CCaaS solution
- Link the external entity and conversation ID

### Handle the Conversation [#handle-the-conversation-implementation]

After the session has been handed over to the CCaaS solution all new inbound messages must be forwarded from the Conversations API

- Translation layer The account configuration webhook (Update Account Configuration enables the translation layer to receive and forward end user messages to the CCaaS solution
- CCaaS solution Do one of the following as applicable
  - If the CCaaS solution has a webhook to subscribe to agent messages subscribe to the messages
  - If there is no webhook the translation layer needs to poll the CCaaS solution to check whether the agent has sent any new messages for open conversations

### Close the Conversation [#close-the-conversation-implementation]

The conversation must be closed to make sure that the end user can have new conversations with the chatbot Otherwise the chatbot cannot receive the end user's messages If the CCaaS solution also does not expect these messages the messages could be lost

After the agent closes the conversation or an equivalent entity Example case ticket or interaction the translation layer needs to use the Update Conversation API to close the conversation