# Configure the MessageBird for Salesforce app

## Connect Salesforce to MessageBird

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

Please note that a force.com presence is needed to expose the webhooks that are needed for conversation updates.

Follow these steps to configure the application:

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

   <figure><img src="/files/HoYDw0XQHUc5JD6YmQEd" alt=""><figcaption></figcaption></figure>

   \ <br>
2. If there are no force.com sites in the org, then you’ll see the following screen:<br>

   <figure><img src="/files/LzYdUmAOE32lP6HSiMdv" alt=""><figcaption></figcaption></figure>
3. To create the force.com site, make sure that the site domain is already available and click the '**Continue to Setup screen'** button.
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.

## Configure 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. Navigate to **MessageBird Setup** from Salesforce app launcher. You will land on the **Account Settings** tab.
2. 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.

   <figure><img src="/files/ZqadtrCzuzzKHnSPl443" alt=""><figcaption></figcaption></figure>
3. 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 always use the **live** mode API Key for product instances of Salesforce (even if the package is installed on a Salesforce sandbox).

   <figure><img src="/files/PRkgwRFQT9OwqecobAd9" alt=""><figcaption></figcaption></figure>
4. 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.
5. In the ReportURL field, enter the force.com site that you created in the [Connect Salesforce to MessageBird](#h_01F4SCC2E6P6SE3BH2S74MZXPE) step.
6. If you are using the WhatsApp channel, copy the WhatsApp Template Namespace Id from the [WhatsApp channel page](https://dashboard.messagebird.com/en/channels/whatsapp) in the MessageBird dashboard and paste it in the **WhatsApp Namespace** field in the configuration.
7. Save the configuatation. You have to refresh the page to see the configuration.&#x20;

## Sync Channels & Templates

Follow these steps to sync the MessageBird channels and WhatsApp templates to Salesforce:

1. Click on the icon next to the configuration.
2. Click on **'Sync Channels'** to sync the channels.
3. Click on **'Sync Templates'** to sync WhatsApp templates.&#x20;

<figure><img src="/files/y2s0U3ys8ZXuVBnPAxuc" alt=""><figcaption></figcaption></figure>

To confirm the sync, please go to **App Launcher** and open the **MessageBird** app, and follow these steps:

1. Navigate to the Channels tab and switch to the **All Channels** view to see the synced channels.&#x20;
2. Navigate to the HSM Template Header and switch to the **All HSM Template Headers** to view the synced templates.&#x20;

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

Webhook setup is needed to notify Salesforce of new conversations and messages on MessageBird channels synced to Salesforce.&#x20;

To set up the webhook configuration, follow these steps:

1. Navigate to **MessageBird Setup** from Salesforce app launcher. You will land on the Account Settings tab. Switch to **Webhook Settings.**
2. Select the configuration record that you want to change from the drop-down menu.
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 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="/files/HVzR6r4uh2lSrClb5CkS" alt=""><figcaption></figcaption></figure>

## 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.

### Contact phone fields

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.

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

<figure><img src="/files/CIVACAKckGx3QlEOYoKO" 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        | +14088001500 |
| Incorrect US number        | 4088001500   |
| Correct Singapore number   | 6567355020   |
| Incorrect Singapore number | 67355020     |
| Incorrect Singapore number | +657355020   |

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

&#x20;

## Set up Send Message Flow <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.
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 the **Configuration name**.
7. In the **Default Value** field, change the ‘**ConfigurationName**’ to the one that is configured in the **MessageBird Setup** tab.
8. Click Done to activate your flow!

<figure><img src="/files/eHc98Jako9IG8CXm2cUS" alt=""><figcaption></figcaption></figure>

## Integration with Cases <a href="#h_01f4scayearrcx9zw1g36ta057" id="h_01f4scayearrcx9zw1g36ta057"></a>

MessageBird package out of the box comes with two flows:

**Create Case from new MB Conversation.**

This flow is used to automatically create a Case in Salesforce when a new MessageBird conversation is created. If you do not want cases to be created when a conversation is created, please disable this flow.&#x20;

**Archive MB Conversation on Case Close.**

This flow is used to automatically archive the relevant conversation when a case is closed. Please disable this flow if you do not wish to archive the conversations.

&#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 objects 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;

The application configuration is complete. You will be able to send and receive messages on MessageBird channels from your Salesforce instance. Next, you can explore the following articles:

1. [MessageBird Conversations in the Contacts Page](https://support.messagebird.com/hc/en-us/articles/4419799717777).
2. [MessageBird conversations in the Case page](https://support.messagebird.com/hc/en-us/articles/4419802887569).
3. [Configuring business flows in Salesforce (optional)](https://support.messagebird.com/hc/en-us/articles/4419633733521).&#x20;
4. [Sync MessageBird conversations to Salesforce](https://support.messagebird.com/hc/en-us/articles/4419799717777).


---

# 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-sales-service-cloud/configure-the-messagebird-for-salesforce-app.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.
