With your Mainstay web-bot, you are able to embed the web-bot code on a Salesforce community page you've created.
Here is a sample of the Mainstay web-chat embedded on a Salesforce Community page:
Note: it is not possible to insert the Mainstay web-chat embed code via aura or lwc component, only via visualforce.
How do I Embed the Mainstay Web-Chat?
In order to set up your webchat code, we recommend doing the following:
- Create a new visualforce page.
- Embed your Mainstay web-chat code in the <body>. Your web-chat code can be found in your Webchat Settings under the section Webchat Preview and Embed Code:
<apex:page standardStylesheets="false" showHeader="false" sidebar="false">
<html>
<body>
<!-- DO NOT EDIT BELOW THIS LINE -->
<!-- Mainstay Web Chat -->
<script>window.admitHubBot = {botToken: "1234567890" };</script>
<script async="true" src="https://webbot.mainstay.com/static/js/webchat.js"></script>
<link rel="stylesheet" type="text/css" href="https://webbot.mainstay.com/static/css/webchat.css"/>
<!-- DO NOT EDIT ABOVE THIS LINE -->
</body>
</html>
</apex:page>
Note: You must use <script async="true" src="https://webbot.mainstay.com/static/js/webchat.js"></script> instead of <script async src="https://webbot.mainstay.com/static/js/webchat.js"></script>
3. Make sure that "Available for Lightning Experience, Lightning Communities, and the mobile app" is selected for this page:
4. Place this visualforce page on the footer component of community layout:
5. Make sure that the profiles that are running Salesforce Community have access to this visualforce page.
What if I run into issues with my Salesforce page?
Below are some helpful Salesforce support articles on adding Mainstay to your trusted sites and steps to changing the settings for security within the community to allow access to third-party hosts like Mainstay:
5.1 Add Mainstay URLs to Salesforce CSP Trusted Sites
Summary
Overall, because the Lightning Community is a composition of standard and custom components, and Salesforce does not have access to the outermost component, we can simply paste it to the outer component (body, as it should be). So it is possible to create a custom page layout, position this chat footer element to the right bottom side, and place there the visualforce page that contains the Mainstay web-chat embed.
Please don't hesitate to reach out to our support team, for further help, by utilizing our support widget!
Comments
0 comments
Article is closed for comments.