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:
- Search for MessageBird Setup by typing MessageBird into the search bar and clicking MessageBird Setup.
- If there are no force.com sites in the org, then you’ll see the following screen:
- To create the force.com site, make sure that the site domain is already available and click the 'Continue to Setup screen' button.
- 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
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.
- Navigate to MessageBird Setup from Salesforce app launcher. You will land on the Account Settings tab.
- Now, you need to find your Access Key and Signing Key. Navigate to your MessageBird Dashboard and click the Developers icon on the toolbar on the left-hand side of your screen.
- 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).
- 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.
- In the ReportURL field, enter the force.com site that you created in the Connect Salesforce to MessageBird step.
- If you are using the WhatsApp channel, copy the WhatsApp Template Namespace Id from the WhatsApp channel page in the MessageBird dashboard and paste it in the WhatsApp Namespace field in the configuration.
- Save the configuatation. You have to refresh the page to see the configuration.
Sync Channels & Templates
Follow these steps to sync the MessageBird channels and WhatsApp templates to Salesforce:
- Click on the icon next to the configuration.
- Click on 'Sync Channels' to sync the channels.
- Click on 'Sync Templates' to sync WhatsApp templates.
To confirm the sync, please go to App Launcher and open the MessageBird app, and follow these steps:
- Navigate to the Channels tab and switch to the All Channels view to see the synced channels.
- Navigate to the HSM Template Header and switch to the All HSM Template Headers to view the synced templates.
Set up Webhooks
Webhook setup is needed to notify Salesforce of new conversations and messages on MessageBird channels synced to Salesforce.
To set up the webhook configuration, follow these steps:
- Navigate to MessageBird Setup from Salesforce app launcher. You will land on the Account Settings tab. Switch to Webhook Settings.
- Select the configuration record that you want to change from the drop-down menu.
- 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.
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.
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!
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.
|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
Set up Send Message Flow
To enable the application to send messages to the MessageBird conversations API, you’ll need to set up a flow.
- In Salesforce, go to Settings and click Setup in the top right-hand corner of your screen.
- In the Quick Find in the left-hand corner, search for Flows.
- From the list of pre-defined flows, click the Message-Send flow. The flow template will be cloned.
- Click Save As and enter a recognizable name for the flow.
- Inside your newly created flow, open the toolbox and click on the Manager tab.
- Under the Variables menu, click on the Configuration name.
- In the Default Value field, change the ‘ConfigurationName’ to the one that is configured in the MessageBird Setup tab.
- Click Done to activate your flow!
Integration with Cases
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.
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.
Assign Permission Sets
There are two permission sets in the package which need to be assigned to the respective users:
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 below.
- The Messagebird Standard user permission set can be used by standard users and allows them to create conversations and send messages.
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: