# How to set up the MessageBird Salesforce Sales & Service Cloud integration

In this guide, you’ll learn how to set up the MessageBird Salesforce Sales & Service Cloud application.

&#x20;

### In this guide: <a href="#h_01hbz9fbv928esfz0d2rt1zqkw" id="h_01hbz9fbv928esfz0d2rt1zqkw"></a>

1. [How to get the MessageBird for Salesforce app](#h_01F4SB1NR07MHSTA38R6WEPFSY)
2. [Configure the MessageBird for Salesforce app](#h_01F4SB331TCRPNGS57P90HH99Z)
   * [Assign permission sets](#h_01F4SCAYEARRCX9ZW1G36TA057)
   * [Connect Salesforce to MessageBird](#h_01F4SCC2E6P6SE3BH2S74MZXPE)
   * [Configure your account settings](#h_01F4SCE4YAKGS9E4JAHC9VYQ01)
   * [Set up webhooks](#h_01F4SCFJ79WXGARKNMG52HFH7T)
   * [Advanced configurations](#h_01F4SCJWAVCBNBF1BQWA9T4XBZ)
   * [Set up a flow in Salesforce](#h_01F4SCPCWS10X4GDXFVN6R0NNP)
   * [Get all MessageBird conversations](#h_01F4SCSHK9XPENAED4ZNB46VBN)
   * [Get all MessageBird conversation messages](#h_01F4SCTTNTCN1WYG5T4YABJDQG)
   * [Out-of-office messages](#h_01F4SCVQ76P72P0SDBRKKMY1K1)
   * [HSM Templates Integration](#h_01F4SCWG9PK40A9DDNJGZ44KED)
3. [Configuring business flows in Salesforce (optional)](#h_01F4SB49GANJK669PJKWWQSMW8)
   * [Assigning conversations to queues](#h_01F4SCXFZPV12HGSHK4MG1WYJG)
   * [Salesforce Omnichannel widget configuration](#h_01F4SCYRDT4H1GW82HFTJ9MHAR)
   * [Connecting SFSC to Flow Builder](#h_01F4SCZWKXVZWJVY4QWKZPTPRH)
4. [Troubleshooting](#h_01F4SD0WFEEA2PC4Z2FZF5E897)

&#x20;

### Requirements <a href="#h_01hbz9fbva8k74jwyqgamrhsn9" id="h_01hbz9fbva8k74jwyqgamrhsn9"></a>

Before you get started, take a look at what you need to set this up.

* A [MessageBird account](https://dashboard.messagebird.com/en-us/sign-up)
* A Salesforce Enterprise (or higher) license with Lightning support
* Access to the SMS and WhatsApp Business channels
* Administrative access to Salesforce — as Salesforce for MessageBird is not a Salesforce license
* [MyDomain](https://help.salesforce.com/articleView?id=domain_name_overview.htm\&type=5) configured for Salesforce
* The MessageBird for Salesforce application, installed on your Salesforce Environment
* Your MessageBird Access Key and Signing Key

&#x20;

## Step one: Get the MessageBird for Salesforce app <a href="#h_01f4sb1nr07mhsta38r6wepfsy" id="h_01f4sb1nr07mhsta38r6wepfsy"></a>

1. Go to the [Salesforce AppExchange](https://appexchange.salesforce.com/mktcollections/cloud-collections/MarketingCloud) and search for MessageBird.
2. Choose **Messagebird for Salesforce: Multichannel Conversations & Messaging**.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-ec3c3d2d4dc7182519d8c4a964b5683fa00ada24%2F360019797718?alt=media" alt=""><figcaption></figcaption></figure>
3. On the purchase page of the app, click **Get Now** in the bottom-right of your screen to purchase the app from AppExchange and start the installation.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-f247d4bc2c17d5bbcd60eb39ca0e069e20a4caaf%2F360019694157?alt=media" alt=""><figcaption></figcaption></figure>
4. A pop-up will open. Choose whether you want to install the MessageBird package in the Sandbox or in the Production environment.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-ec5f0d317e1d842abc9bc7422e2091931190693b%2F360019694197?alt=media" alt=""><figcaption></figcaption></figure>
5. Installation details will be prompted, where you can define access for this package. This means defining which Business Units the users in the SFSSC account are able to use in this package. You can install it for Admins Only (recommended), for All Users, or for specific profiles. Select the option you want, click **Confirm**, then click **Install**!<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-0e3be683fa1e75f75ea0fb345f899d3faad70045%2F360019694277?alt=media" alt=""><figcaption></figcaption></figure>
6. A pop-up will open. The pop-up will ask you to confirm that you want to grant third-party access to MessageBird. Make sure all of the boxes are checked, click **Continue** to start the installation to start, and then click **Done**.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-9657bf911aa7959dd4e85ca959d569c9b6f060ab%2F360019694717?alt=media" alt=""><figcaption></figcaption></figure>

And that’s it! You will now be able to see the MessageBird Package on your **Installed Packages**.<br>

<figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-29cb4c88bfe6ad5e82d5c361dcb041ebed82a02e%2F360019800238?alt=media" alt=""><figcaption></figcaption></figure>

&#x20;

## Step two: Configure the MessageBird for Salesforce app <a href="#h_01f4sb331tcrpngs57p90hh99z" id="h_01f4sb331tcrpngs57p90hh99z"></a>

The custom setting **Webhook Config** has a Debug mode field. A default organization level value can be created with Debug mode **true** to create custom Debug logs for the webhook.

&#x20;

### Assign permission sets <a href="#h_01f4scayearrcx9zw1g36ta057" id="h_01f4scayearrcx9zw1g36ta057"></a>

There are two **permission sets** in the package which need to be assigned to the respective users:

* Messagebird\_Admin
* Messagebird\_Standard\_user

Before assigning users to the permission sets, you need to add the permission to **read**, **create** and **edit Opt\_Out** custom object for both of them. To do this change, clone the permission set, edit them and add the users.

* **The Messagebird Admin permission set** can only be used by admins. It allows them to create Configuration metadata, Webhooks, HSM templates, and look at the Debug logs (custom object). For more information about what admins can do, take a look at the [configuration details](#h_01F4SD868TN4TXPJZ325ZMXZN9) below.
* **The Messagebird Standard user permission set** can be used by standard users and allows them to create conversations and send messages.

&#x20;

### Connect Salesforce to MessageBird <a href="#h_01f4scc2e6p6se3bh2s74mzxpe" id="h_01f4scc2e6p6se3bh2s74mzxpe"></a>

To connect Salesforce with MessageBird, you must set up their endpoint, access key, and other settings on the package configuration.

**NOTE:** A force.com presence is needed to expose the webhooks that are needed for conversation updates.<br>

Follow these steps:

1. Go to **Setup**.
2. Click **Installed packages**.
3. Click **Configure**.

**OR**

1. Search for MessageBird Setup by typing MessageBird into the search bar and clicking **MessageBird Setup**.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-4b101817043ccc8ac3e2ed2fb47d08e0321a822c%2F360019696977?alt=media" alt=""><figcaption></figcaption></figure>
2. If there are no force.com sites in the org, then you’ll see the following screen:<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-0e67353ed1b81e6d81d88be64ae0de89eb6399b5%2F360019696997?alt=media" alt=""><figcaption></figcaption></figure>
3. To create the force.com site, make sure that the site domain is already available and click **Continue to Setup screen**.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-10b977c17bbe921862cfc0434a18131023141ac3%2F360019801018?alt=media" alt=""><figcaption></figcaption></figure>
4. Enter your site name and click **Create site**. This will create a custom force.com site and the permission set **Webhook Assignment** will assign the guest user of the site.

&#x20;

### Configure your account settings <a href="#h_01f4sce4yakgs9e4jahc9vyq01" id="h_01f4sce4yakgs9e4jahc9vyq01"></a>

The **Account Settings tab** allows you as an admin to create configuration custom metadata records with the **Access Key** and **Signing Key** of your MessageBird account.

1. Go to Settings and choose Setup in the top right corner.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-1eb0b2c33d8c591dc99f51a6d04c46c91fd397d3%2F360019802338?alt=media" alt=""><figcaption></figcaption></figure>
2. In the Quick Find in the left-hand corner of your screen, search for Packages. In the list of Packages, you should see MessageBirdPackage predefined.
3. Click **Configure**.
4. Now, you need to find your **Access Key** and **Signing Key**. Navigate to your [MessageBird Dashboard](https://dashboard.messagebird.com/) and click the [Developers](https://dashboard.messagebird.com/en/developers/settings) icon on the toolbar on the left-hand side of your screen.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-1bf91018caa4685da42fe429ec982a3290567c3f%2F360019697297?alt=media" alt=""><figcaption></figcaption></figure>
5. To get your **Access Key**, click on **API access**, then select **Show key**. Click **Copy**, and paste this key into the relevant field on the Salesforce configuration page. Please use the **live** mode API Key for product instances of Salesforce.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-3c65b268dac8649c2b6d8d4bc14a2d15365644b2%2F360019697457?alt=media" alt=""><figcaption></figcaption></figure>
6. To get your **Signing Key**, click in **API Settings**, then select **Show key**. Click **Copy** and paste into the relevant field on the Salesforce configuration page.
7. In the ReportURL field, enter the force.com site that you created in the [Connect Salesforce to MessageBird](#h_01F4SCC2E6P6SE3BH2S74MZXPE) step.

&#x20;

#### Take a look at the configuration details <a href="#h_01f4sd868tn4txpjz325zmxzn9" id="h_01f4sd868tn4txpjz325zmxzn9"></a>

Now that you’ve set this up, take a look at what your admin permissions allow you to do. To access the configuration variables, click the arrow to the right of **Configuration Details**.

<figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-5307dfb57365ae17d5eab10bf9e9904184c1c43a%2F360019802018?alt=media" alt=""><figcaption></figcaption></figure>

You’ll now be able to perform the following actions:

* Update: Updates configurations.
* Show keys: Displays the Access and Signing keys in a human-readable format.
* Hide keys: Obfuscates the Access and Signing keys.
* Sync channels: Synchronizes channel information from MessageBird to the Salesforce plugin. This is a required action when you first set up the connection, and you must repeat it every time a new channel is configured on the MessageBird side.
* Sync templates: Synchronizes WhatsApp templates from MessageBird to the Salesforce plugin. This is a required action every time new templates are created.
* Get WhatsApp Namespace: Get the namespace for the WhatsApp channel from MessageBird. This is a required action when you first set up the connection, and you must repeat it every time the namespace information is changed on the MessageBird side.

&#x20;

### Set up webhooks <a href="#h_01f4scfj79wxgarknmg52hfh7t" id="h_01f4scfj79wxgarknmg52hfh7t"></a>

#### Webhook settings <a href="#h_01hbz9fbva13g7my6h2td7tzb0" id="h_01hbz9fbva13g7my6h2td7tzb0"></a>

The Webhook Settings tab allows admins to create webhooks for each configuration record. To do this, follow these steps:

1. Select the configuration record that you want to change from the drop-down menu in the Webhook Settings tab.
2. In the Webhook URL field, enter the force.com site that you created in the [Connect Salesforce to Messagebird](#h_01F4SCC2E6P6SE3BH2S74MZXPE) step.
3. The channels displayed in the drop-down menu will be those that are synced for each configuration. When you’re done, click **Create Webhook**.

**NOTE:** For a well-functioning system, you’ll need to create a webhook for each channel that you have in your MessageBird account that you want to use in your Salesforce environment.

#### List of webhooks <a href="#h_01hbz9fbva15tpnknexd9rqcm0" id="h_01hbz9fbva15tpnknexd9rqcm0"></a>

A list of webhooks is displayed in the Configurations drop-down menu. If you want to delete a webhook, you can click on the arrow next to the status of the webhook and click **Delete**.

<figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-7c5a0589407af79f4249fb5cfb79aa2e0d1e6c69%2F360019698037?alt=media" alt=""><figcaption></figcaption></figure>

&#x20;

### Advanced configurations <a href="#h_01f4scjwavcbnbf1bqwa9t4xbz" id="h_01f4scjwavcbnbf1bqwa9t4xbz"></a>

The **Advanced Configuration** tab allows admins to choose the **Browser Synchronisation Method** for the conversations/messages. You can choose between **Platform events** or **Query every X seconds**.

By default, we’re using the Salesforce platform events mechanism to receive updates for messages and conversations. However, if you’re reaching the limits of your events quota, you can switch to using the query method for conversation updates.

Read more about [Salesforce events limits](https://developer.salesforce.com/docs/atlas.en-us.platform_events.meta/platform_events/platform_event_limits.htm).

**NOTE:** For the best user experience, with a low latency of receiving messages, use the events mechanism.

&#x20;

#### Contact phone fields <a href="#h_01hbz9fbvacdmw6kkwvrqqrhfv" id="h_01hbz9fbvacdmw6kkwvrqqrhfv"></a>

The fields in the **Selected** column are used to search to link the contact with the conversation when you receive incoming messages. In the following example, the Business Phone is the field that will be used to link the contact to the conversations. You can add other fields such as **Business Fax**, **Mobile Number**, **Home Phone**, **Other Phone**, and **Asst. Phone**. When you send outgoing messages, the application will automatically pick up the phone number from the Phone (Business Phone) field, under the Contact object.

&#x20;

Don’t forget to click **Save** when you’re finished configuring your settings!

<figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-acc0a701fcd988220cfeadd7bdb703c0777d5ab3%2F360019802258?alt=media" alt=""><figcaption></figcaption></figure>

**Note about numbers**

To match a contact with their respective number, we need their number to be in international format (country code included). Otherwise, the system might not be able to infer the corresponding country.

For example:

| Correct US number          | 14088001500 |
| -------------------------- | ----------- |
| Incorrect US number        | 4088001500  |
| Correct Singapore number   | 6567355020  |
| Incorrect Singapore number | 67355020    |

* For a US number: correct 14088001500, incorrect: 4088001500
* For a Singapore number correct 6567355020, incorrect: 67355020

&#x20;

### Set up a flow in Salesforce <a href="#h_01f4scpcws10x4gdxfvn6r0nnp" id="h_01f4scpcws10x4gdxfvn6r0nnp"></a>

To enable the application to send messages to the MessageBird conversations API, you’ll need to set up a flow.

1. In Salesforce, go to **Settings** and click **Setup** in the top right-hand corner of your screen.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-1eb0b2c33d8c591dc99f51a6d04c46c91fd397d3%2F360019802338?alt=media" alt=""><figcaption></figcaption></figure>
2. In the Quick Find in the left-hand corner, search for **Flows**.
3. From the list of pre-defined flows, click the **Message-Send** flow. The flow template will be cloned.
4. Click **Save As** and enter a recognizable name for the flow.
5. Inside your newly created flow, open the toolbox and click on the **Manager** tab.
6. Under the **Variables** menu, click on **Configuration name**.
7. In the **Default Value** field, change the ‘**ConfigurationName**’ to the one that is configured in the MessageBird Setup tab.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-4f39dcc361d544c874e2e3349dbde41958dff5bd%2F360019698377?alt=media" alt=""><figcaption></figcaption></figure>
8. Click Done to activate your flow!

&#x20;

#### Adding a Lightning component to the Conversation detail page <a href="#h_01hbz9fbvaxqv574y2x1xnm6q4" id="h_01hbz9fbvaxqv574y2x1xnm6q4"></a>

1. In Salesforce, open any **Conversation Record Detail** page.
2. Go to **Settings**.
3. Click **Edit page**.
4. Scroll down to find the **Custom** tab.
5. Select the **Send Messages** component and drag it to your page.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-582a4c38acdf0d686b130f8b14de5b9bd81e80d1%2F360019802678?alt=media" alt=""><figcaption></figcaption></figure>

&#x20;

#### Adding a Lightning component to the Contact detail page <a href="#h_01hbz9fbvajpk81dj5953t68yj" id="h_01hbz9fbvajpk81dj5953t68yj"></a>

1. In Salesforce, open any **Contact Record Detail** page.
2. Go to **Settings**.
3. Click **Edit** page.
4. Scroll down to find the **Custom** tab.
5. Select the **Contact Conversation View** component and drag it to your page.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-b704dddb77a7481752a776994e9f3a6d3e1afbb8%2F360019698597?alt=media" alt=""><figcaption></figcaption></figure>

### Get all MessageBird conversations <a href="#h_01f4scshk9xpenaed4znb46vbn" id="h_01f4scshk9xpenaed4znb46vbn"></a>

To bring all of your MessageBird conversations into Salesforce, we run a batch process in the developer console. You’re required to do this operation the first time that you install the plugin (to retroactively get existing conversations).

1. Click the gear icon on the top-right hand corner of your page.
2. Click **developer console**.
3. Copy-paste the code. It will look similar to this:

<pre><code><strong>mbird.GetAllConversationsBatch c1 = new mbird.GetAllConversationsBatch();
</strong>c1.configurationName = ‘mbird__MessageBird'; //QualifiedApiName of the configuration created in the setup screen.

Database.executeBatch(c1);
</code></pre>

&#x20;

### Get all MessageBird conversation messages <a href="#h_01f4scttntcn1wyg5t4yabjdqg" id="h_01f4scttntcn1wyg5t4yabjdqg"></a>

To bring all of your MessageBird conversation messages into Salesforce, we run a batch process in the developer console.

1. Click the gear icon on the top-right hand corner of your page.
2. Click **developer console**.
3. Before getting all the messages, run the batch to get all conversations, as we get messages for each conversation in this batch.
4. Copy-paste the code. It will look similar to this:

<pre><code><strong>mbird.GetAllMessagesBatch c2 = new mbird.GetAllMessagesBatch();
</strong>c2.configurationName = ‘mbird__MessageBird'; //QualifiedApiName of the configuration created in the setup screen.

Database.executeBatch(c2);
</code></pre>

&#x20;

### Out-of-office messages <a href="#h_01f4scvq76p72p0sdbrkkmy1k1" id="h_01f4scvq76p72p0sdbrkkmy1k1"></a>

To send **out-of-office messages** to your customers, set up business hours in the org, and connect it to your channels with an out-of-office message.

1. In Salesforce, go to **Setup**.
2. Search for and click on **Business Hours**.
3. Configure your business hours as required.
4. Go to the **Channels tab** and select the **Channel record** for which you want the out-of-office message to be sent.
5. Enter the modified business hours record in the **Business Hours** field and enter your message in the **Out of Office Message** field.

<figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-429aac777daa1f086e1a1e4246118718202e0d0a%2F360019698837?alt=media" alt=""><figcaption></figcaption></figure>

&#x20;

### HSM Templates Integration <a href="#h_01f4scwg9pk40a9ddnjgz44ked" id="h_01f4scwg9pk40a9ddnjgz44ked"></a>

To create HSM templates in Salesforce and send them for approval, follow these steps:

1. Go to the **HSM Template Headers tab** and create a new record. Choose your category and language policy.
2. Go to the related list and create new HSM Template records for the different languages with Language and Template content.
3. Keep in mind that the accepted templates will be shown in the conversation component to send messages.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-f9fa5dcdd45cc93fe731c5fe8db1c9a1ad09ae96%2F360019698857?alt=media" alt=""><figcaption></figcaption></figure>
4. Once you’ve created the HSM Template records, click on the **Integrate** quick action on the HSM Template Header page for approval.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-4d7444ab60fe808e2348adb0665939a0be76434b%2F360019698937?alt=media" alt=""><figcaption></figcaption></figure>
5. For each HSM Template, go to the related list and enter the **Parameter Records** to add them in the template message.
6. The field **Source Text** is a constant text value and **Source Field** is the field name of the object.
7. The **Order field** is the order in which the parameters in the template are replaced. For example, in the template is ‘Hi {{1}}’ with a related parameter, Source text ‘Teja’ and order ‘1’, the parameter record with order 1 will replace {{1}} in the template when the message is sent to the customer as ‘Hi Teja’.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-7cc6f7fd760774386e2abf10d3dd6fc38ed3b6b4%2F360019803258?alt=media" alt=""><figcaption></figcaption></figure>

   \ <br>

## Configuring business flows in Salesforce (optional) <a href="#h_01f4sb49ganjk669pjkwwqsmw8" id="h_01f4sb49ganjk669pjkwwqsmw8"></a>

These settings are not required, they’re suggestions for ways that you can connect conversations with your agents. Feel free to skip these and stick with your company’s existing processes.

&#x20;

### Assigning conversations to queues <a href="#h_01f4scxfzpv12hgshk4mg1wyjg" id="h_01f4scxfzpv12hgshk4mg1wyjg"></a>

If your support system operates based on queues (not a must, but this is a typical way of managing support), then a process is needed to ensure that new conversations are assigned to the appropriate queue.<br>

<figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-b21247290f680cb976479bb483bd7f62a5a93114%2F4405541966481?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-ee8be2c3bf8ae698c890fbef6c0bcff7a2319182%2F360019803358?alt=media" alt=""><figcaption></figcaption></figure>

&#x20;

#### Defining the queue <a href="#h_01hbz9fbvazcsz9ehd4adw7wh4" id="h_01hbz9fbvazcsz9ehd4adw7wh4"></a>

If you are using queues, you need to define who is part of the queue.

<figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-1849094f38d3f769c18e92dbe1c610426db193b5%2F360019699337?alt=media" alt=""><figcaption></figcaption></figure>

### Setting up Omnichannel - Simple, least Active routing <a href="#h_01f4scyrdt4h1gw82hftj9mhar" id="h_01f4scyrdt4h1gw82hftj9mhar"></a>

You could set Omnichannel up to serve your needs better, but that is beyond the scope of this document.

&#x20;

&#x20;

1. Enable Omnichannel *Setup -> Omnichannel -> Omnichannel settings and* mark the checkbox Enable Omnichannel and Save.
2. Set up your Service Channel in *Setup -> Omnichannel -> Service channels Click on new*
3. Put the name and the Developer name Eg: *Case Queue*. Add Case as the *Salesforce Object* and save.

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-cb8bdffbb7c08d0700cbc09b5bc33c0f2e034ba8%2FkOyHoLXAWyVfX5J6beo4jIf7xJLpA_3MWj9rEXb1F3f9EP8vqxQJUSBJgF6yyZDWexmkmEFwrsxtI_xU5bPIZBvMed82EUxMyKCqeomyKca3UlAk1wZQw6Dr0STHEU00mFWkC8s6oaNFv1WKvE3t8rY?alt=media" alt=""><figcaption></figcaption></figure>
4. Create Routing Configurations put the name and developer name, set routing priority to 1, and set *Units of Capacity* to 1.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-a01d0756e7aa788458831634b370b72b3b8ffaed%2FR3-W_E17CdMuV4SK7p0pgHhd8qjTXqtRjX8lM6R_pr8LUvzbzNb0VJSxPYAePClRde5nbaNKYRuU-r27o6sc2vPSGbfWOR0S1yh90mUwGuSRd8JEAN_fS1c139I8UO4X1LS42xJuGf_8F52j9v76KQs?alt=media" alt=""><figcaption></figcaption></figure>
5. Create a new Queue in Users-> Queue, set the label and name and developer name, write down this developer name you will need it later, assign the routing configuration you created, and add Case to the supported objects. Add all the users you want on your queue, they should have access to the Salesforce Messagebird Package, and then save.

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-508a2510300bbdd455387f1ac858eb467b918ed1%2FfU-K0KSr_Zx-FXLEmzS3YntsGEtfIh3sO1U8MHqYtmrz63URowmSrRxKfDDR5d3wuMRWM8xU7_SkS25gEzAejlM_IUB-O4ZDg_yX8X63vFCO236zo-l8b2AAc6dLXllPNaiJlwG1Q6C0riZHhUYxAOY?alt=media" alt=""><figcaption></figcaption></figure>
6. Setup presence configurations in *Omnichannel -> Presence* configuration add the name and the capacity, the number of cases each agent can work on simultaneously, leave all other defaults and click save.&#x20;
7. Create Presence Statuses in *Omni-channel -> Presence Statuses you will need to create at least 2. One online and assign the Case queue, and one offline.*
8. Enable the Omnichannel UI go to Setup->App Manager, select the app you use for Service Console and click on Edit. Inside click on Utility Items, add Utility Item and the Omni-channel.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-118215452a046c362004ace0725db6aa0adeb0c0%2F981wrkbCb95-LNwd1Fnt4c9THLPBCfkUFQ1ohn6O4OzQD0-ixDqQT8UvUjky_lme12vfvr6CHIiEuYcdNzp5bnnPztokhdeYlGdMHEZCGk1PinbmQ92cqq9_8CDLuIjNL0MpduHPzi0a1Zo3KB4tITs?alt=media" alt=""><figcaption></figcaption></figure>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-7a8b0d1377d0d98124cf5494ff4f28a2e51720c7%2FLoNPZZ_p9tRgJIfR-VkBCcpaBdhrqK3p7jYiQl2iFtYTzYf5kyIkt5rvTxC8tWfYctbngRPZDBnc8LqcE-AmjjPlg0bQtuAseGbcC40uowxQhftW9i34NILaG4lFaSWaXpbbAEaw6wxcImA_r5F6e5k?alt=media" alt=""><figcaption></figcaption></figure>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-38f7501208d2baa9b22bf787c9abe10469cf5273%2FbE05N6sU1CsuUuWhPOJuqD2Knfx1jKgmEIh-r-brlriWwQvYF9QPu0vDj1Nu3pRogsghe6hQm5a_4iTwXTGYdFvn6I3ZPHcUIQXfGBHT066YxqiGqfpi0PenSSWRgpSPmRa07knWIfVldFLq9B0KRHA?alt=media" alt=""><figcaption></figcaption></figure>

You are finished with the omni channel, but now you have to set up the flow that assigns the case to the correct queue.\ <br>

**Setup Flow**

1. If you are not familiar with Queue based routing, please watch this [video](https://www.youtube.com/watch?v=Ipdm_VD2V0E\&ab_channel=SFDCLearn%26Share),\
   Set up the template flow: *Create a Case from the new MB Conversation:*
2. You should add a Get Record element add the name Find Queue and add the object \[**Group Group**]

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-65f00fddfda78a2fbc69376072529a168851dd8c%2Fi4ikACZxHuTZx4z7FItOcaCcBgBBxgZlt33Db4MvGipJ1JMglwx_mOoZ6itVlZkou1rRsqfZmt9a4yb3d0PlOGSTxUNLXt-IRR8ZUW2tr3rjK_j0Ln-xWR4QgTG0XM2ORakz44UFMVug6rIleM42ghY?alt=media" alt=""><figcaption></figcaption></figure>
3. Select the Developer Name field and set it equal to the developer name setup in step 5 in the previous section of this guide.

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-5942d0597b7b1e16338d34a661404e08757ed98e%2FtNXenMtr8H6PV5ihk-9h-iOoN5eLSr4rmaHcWy7IBlufAKLierIjob2ZJgTQ0u-U-Qmg79bmuHYLMttxoMjtZD0MUO0_TtQ92KHUFIg0RULW0YFw3GhBw245othkHyzySCdvZzmCTmoqsh4zXcXQh6g?alt=media" alt=""><figcaption></figcaption></figure>
4. Once there, you will have two paths to follow to configure the trigger.
   1. If you want to use Messagebird Flow Builder to mark conversations as [managed by ](https://docs.bird.com/connectivity-platform/basics/flowbuilder-steps-glossary#id-01g1jen5k3hqacptnejekwb75t)Salesforce, your trigger should be configured like this

      <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-080615488f4110c18fafae5827d18a73a50f4303%2FF-YLMjwuwmbekY8Hy0t81GADsxd_O5TiXd908WicFngdctEZecYaJtDdFkcZDiclYPXQ_8Rx2vTDJCWZ4aDmw0MSHAxjTfUqByGPDSROiPWRBLhxvFrwl_OlB91QHXPV574-JnmsfR1T5MgUeHEuP8Y?alt=media" alt=""><figcaption></figcaption></figure>
   2. If you don’t use Messagebird Flow Builder, it should be configured like this:<br>

      <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-70c84a21eebbce953d64b3d39729c0d3542a4f6c%2FJ7fqrbQyGPz0_G_LrrKyANdGVgl_uwPabukB5Yyljg2JZKlzMslePLpr7a6wG0TCCzVhtnzhUL556ahs_IErdicvBDU1fqCq2lw_P-VD7VOAQKLqBeCTKg58GOW6xgJ1ojO08uPWGWX1BULYCDHhink?alt=media" alt=""><figcaption></figcaption></figure>
5. In both cases, the case creation should be configured like this, the owner id is the previously retrieved Queue by developer name, and the contact should be the one associated with the conversation<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-522cb8b6d9316cde445b62a9a99e03012f7ebd86%2F6wRnVoYtk5uu8P12ET2h1616aFO7mGKYS63N8sYkxqLx1OqezGQlnZj-eS0FFIOOg4CJbC6HNJLJEYX0zfQ83bhqfgrFgmTLAEHG4S6lFSSxc9UnYQzISuxn2YHfekov56lt6wm3-PSB1_i529S7Bmk?alt=media" alt=""><figcaption></figcaption></figure>
6. Finally, you save and Enable the flow.

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-c36debc5833ac4ad60edf588ee74c7b62449ae5e%2F0SMwoJVXR9ImZHB1UYBmTA1XKrSe709xw9FCTM846ffBBwbJqiZrtBTrz87l1YFEecBIC3cbASnwO63gP7wUfpfVKSZLOoL6UW2t6HDuQvDWWAFVecWrDK8AiT8gFigjnXUTazCs72sDp_sZL4PpAWw?alt=media" alt=""><figcaption></figcaption></figure>

Finally, go to your Cases Layout and add the **Case Conversation View** component.<br>

<figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-40c498d351f6d9a8451f0a2104e3c88d934aba4a%2Fq7vPEQpseOFhdgdegScvMAf-vf1lVHjvUk96Serx3i1kcurh2nsi-hHwEnD0pKspSHnX1tb-LoWZE6E4TsoocEBf5Vbujg5tRY2O29_nf-pSUWnrqvFCwIfeGHczUKs4h0O-XvktBSce_AMvmTFIOO4?alt=media" alt=""><figcaption></figcaption></figure>

&#x20;

Now, every new conversation should create a case that gets routed to your agents with a notification, and you should be able to continue the conversation from there.\ <br>

### Connecting SFSC to Flow Builder <a href="#h_01f4sczwkxvzwjvy4qwkzptprh" id="h_01f4sczwkxvzwjvy4qwkzptprh"></a>

Connecting SFSC to Flow Builder will allow for the definition of more complex scenarios like:

1. A contact reaches out.
2. The message is received inside Flow Builder, where automatic qualification and deflection happens.
3. Once no further deflection is possible, it is signaled to SFSC that an agent needs to be involved.
4. The conversation is handed over to SFSC and the agent receives a notification inside the Omnichannel widget.
5. The agent engages with the contact.
6. Once the conversation is over and the agent marks the conversation as closed (archives it), control is returned to Flow Builder.
7. Further automation can then be performed (e.g. send an NPS survey to the contact).

To achieve this a couple of steps are needed both on the Salesforce side and on the Flow Builder side.

&#x20;

#### Set it up in Flow Builder <a href="#h_01hbz9fbvbvrt7rmpvffjvyz26" id="h_01hbz9fbvbvrt7rmpvffjvyz26"></a>

1. Log in to your MessageBird Dashboard and navigate to [Flow Builder](https://dashboard.messagebird.com/en/flow-builder).
2. Click **Import flow** and import the [template flow](https://support.messagebird.com/hc/en-us/article_attachments/360019700697/SFSC_Flowbuilder_Connector_template.json) (see article attachment).<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-6e11003aa9110af899aa050836352c1f27e3ce20%2F360019805238?alt=media" alt=""><figcaption></figcaption></figure>
3. For the **Fetch variables** steps, replace the *salesforceInstanceBaseLink* with the proper link to your Salesforce instance, which is the same root as your Salesforce report URL (e.g. <https://messagebird-tso-1783cbe360c.secure.force.com)>.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-3cf0aead66b912ece7921cbb5ff9192582fb5004%2F360019700957?alt=media" alt=""><figcaption></figcaption></figure>
4. Select the **Await** webhook and copy the **webhook address**.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-6f157d77e60b43ae6323fc761f3c290a700cb96b%2F360019805338?alt=media" alt=""><figcaption></figcaption></figure>
5. Ensure that this link is passed as a parameter to the second **Fetch variable** step.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-8c04d3e808f737bda5f03058425a177ca3274a0f%2F360019701137?alt=media" alt=""><figcaption></figcaption></figure>
6. Connect the Flow as a listener to the channels for which you want to enable Flow Builder deflection by selecting the proper channels in the flow’s **trigger**.\
   **NOTE:** You should select any of the SMS or WhatsApp channels.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-0c3eb984e7a74031b41e651071745ee1a8e0d382%2F360019805558?alt=media" alt=""><figcaption></figcaption></figure>
7. On the last **HTTP Request** step, update the **Access Key** used to authorize the request with your sandbox’s live API key.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-68de9632459fa474bc13fd7d546f9e91ae615672%2F360019701277?alt=media" alt=""><figcaption></figcaption></figure>

&#x20;

#### Set it up in Salesforce <a href="#h_01hbz9fbvbwbcfj522nmcts2vj" id="h_01hbz9fbvbwbcfj522nmcts2vj"></a>

1. Inside the MessageBird’s package settings, under the advanced settings tab, ensure that the **Use Flow Builder** checkbox is enabled.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-1533a6181f23059c4208f7be09668d8ca4c46482%2F360019701417?alt=media" alt=""><figcaption></figcaption></figure>
2. In the Salesforce flows or process you have defined to assign conversations to queues and agents add an additional condition, “conversations is in Salesforce”, based on the *with\_Salesforce\_\_c* conversation parameter. By adding this extra condition, we will ensure that the Salesforce agents only get notified once the Flow Builder signaled to Salesforce that conversation automation has ended and an agent must now be notified.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-30287dc241fdd05a1b1db3f6fabc6aa4bf3bb3ed%2F360019805678?alt=media" alt=""><figcaption></figcaption></figure>

&#x20;

## Troubleshooting <a href="#h_01f4sd0wfeea2pc4z2fzf5e897" id="h_01f4sd0wfeea2pc4z2fzf5e897"></a>

### Error message when archiving <a href="#h_01hbz9fbvb6zzbq13fm1a3cxxd" id="h_01hbz9fbvb6zzbq13fm1a3cxxd"></a>

When attempting to Archive a conversation I am getting a “There was an error when trying to archive the conversation. Contact your administrator.” error message.

### Cause and solution <a href="#h_01hbz9fbvby1fhpdvtf86h1f75" id="h_01hbz9fbvby1fhpdvtf86h1f75"></a>

This will happen if the Salesforce agent attempts to **Archive** a conversation that is currently not in Salesforce (but is in Flow Builder). The **Archiving** action will work only once the conversation has been passed to Salesforce.<br>

No action is required regarding this message.<br>

&#x20;

&#x20;

&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bird.com/connectivity-platform/salesforce/how-to-set-up-the-messagebird-salesforce-sales-and-service-cloud-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
