# Configuring business flows in Salesforce (optional)

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;

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

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%2FScreen_Shot_2021-03-30_at_3.48.10_PM.png?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%2FScreen_Shot_2021-03-30_at_3.55.27_PM.png?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%2FScreen_Shot_2021-03-30_at_3.56.37_PM.png?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%2FScreen_Shot_2021-03-30_at_3.57.56_PM.png?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%2FScreen_Shot_2021-03-30_at_3.59.21_PM.png?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%2FScreen_Shot_2021-03-30_at_7.05.10_PM.png?alt=media" alt=""><figcaption></figcaption></figure>

&#x20;

#### Set it up in Salesforce

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%2FScreen_Shot_2021-03-30_at_4.00.43_PM.png?alt=media" alt=""><figcaption></figcaption></figure>

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

### Error message when archiving

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

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;
