# Frontline Integration Service

> \[!WARNING]
>
> **Note**: SSO Configuration is a prerequisite for users to be able to log in to the Frontline App and use the integration service. Please visit this [section](/docs/frontline/sso) to review the steps for integrating your SSO provider with Frontline.

To use Twilio Frontline, you will need to enable a **server-side** web application, which is responsible for handling your customer data in Frontline. This backend-service, the **Frontline Integration Service**, handles responses to Frontline's callbacks and [Conversations API](/docs/conversations/api)'s webhooks.

![Diagram showing Frontline Integration Service connecting a mobile app to CRM with callbacks and customer data.](https://docs-resources.prod.twilio.com/a88d19988818823343e45c52e1862ea6512ae14b719caed63227a53b4f33528e.png)

As you will see in the [Node.js Quickstart](/docs/frontline/nodejs-demo-quickstart), we use our own backend service in Node.js called the **"Frontline Integration Service"** which connects to the Twilio Frontline interface and implements core features of routing and connecting customer data.

> \[!NOTE]
>
> **Note**: You can find our integration service example in this [repository](https://github.com/twilio/frontline-demo-service) in GitHub. This is meant to serve as a model, and you can clone this to use directly, or write your own integration service in your preferred programming language.

## Main features

### Return your Customer/CRM Information to the Frontline App

You can access lists of customers and customer details in the Frontline app. To populate this data, the Frontline application makes an API call to a configured **CRM Callback URL** to fetch customer data for each screen. This configurable **CRM Callback URL** will point to your integration service's CRM callback handler and based on the `Location` parameter, your integration service will retrieve the corresponding customer information or list of customers. You can find more information in the [Customers information & CRM](/docs/frontline/my-customers)section.

### Configure Conversations API Webhooks

Since the Frontline App is built on top of the [**Conversations API**,](/docs/conversations/api) to prepare incoming conversations for Frontline by connecting the CRM information to the conversation, we need to call and configure the **onConversationAdd** and **onParticipantAdded** webhooks.

* The **onConversationAdd** webhook will be called before creating a conversation, and it can be used for setting a `friendly_name` and `avatar` of the conversation.
* The **onParticipantAdded** webhook will be called when a participant has been added to the conversation, and it can be used for setting the `customer_id`, `avatar` and `display_name` for customers in a conversation.

You can find more information in the [Conversations Webhooks](/docs/frontline/conversations-webhooks) section, or see the [Node.js Quickstart](/docs/frontline/nodejs-demo-quickstart#how-to-enable-incoming-messages) for how to configure these webhooks.

### Handle Custom Routing Logic (optional)

You can define your own **custom routing logic** in your integration service. With custom routing, you can decide how incoming conversations will be assigned to workers. To handle custom routing, you have to configure the **Custom Routing Callback URL** in the [Frontline Console](https://www.twilio.com/console/frontline/routing). This callback will be called when an inbound conversation is created. You can find more information in the [Custom Routing](/docs/frontline/handle-incoming-conversations#2-custom-routing) section.

### Handle Message Templates (optional)

You can configure message templates with Frontline. Message templates are especially useful if you use **WhatsApp** as a **channel**. Please be aware that [WhatsApp has a limitation](/docs/frontline/templated-messages#using-whatsapp-templates-with-twilio-frontline) in which you can only send approved templates until a user responds to a message. When the application requests templates through the **Templates Callback URL,** it passes **CustomerId**, **Worker** and **ConversationSid** identifiers. Templates can be rendered based on those attributes, and the Frontline Integration Service should respond with processed templates as plain text, populated with any placeholders. You can find more information in the [Templated Messages](/docs/frontline/templated-messages) section.

### Handle Outgoing Conversations

When a Frontline user starts a new conversation from the Customer Details screen, the Frontline application makes an API request to the configured **Outgoing Conversations Callback URL.** This callback will tell the Frontline application which Twilio number to use for outgoing messages and calls.

In order to create a new outgoing conversation from the Frontline App, you will need to configure the **Outgoing Conversations Callback URL** in the Frontline console. You can find additional information about Outgoing Conversations in this [section](/docs/frontline/outgoing-conversations).

## What's Next?

Ready to try out the Frontline mobile app? Follow the [Frontline Serverless Quickstart](/docs/frontline/serverless-quickstart) to get the app running on your mobile phone with no code. If you are ready to build your own server side application, use the [Frontline Node.js Quickstart](/docs/frontline/nodejs-demo-quickstart) to start developing with Frontline.
