Freeday widget in Salesforce

This document explains how to display the Freeday chat inside your Salesforce environment. Replace YOUR_CHANNEL_ID with the value provided by your Freeday representative.

Prerequisites

  • Administrator rights in your Salesforce environment.
  • At least one Lightning App in your environment.

Create the Visualforce page

To display the Freeday chat, first create a Visualforce page with these settings:

  1. Label — the label of your Visualforce page.
  2. Name — the name of your Visualforce page.
  3. Description — optional.
  4. Enable Available for Lightning Experience, Experience Builder sites, and the mobile app.
  5. Replace the page markup with the template below, using your Channel ID.
<apex:page>
  <script type="module">
    const channelId = 'YOUR_CHANNEL_ID';
    const response = await fetch(`https://api.freeday.ai/webchat/v1/widget/${channelId}`);
    const freedayConfiguration = await response.json();
    const freedayWidget = await import(freedayConfiguration.cdnUrl);
    freedayWidget.bootstrap(freedayConfiguration);
  </script>
</apex:page>
Editing the Visualforce page in Salesforce

Add the page to your app

Once the Visualforce page is created, add it to an existing app:

  1. Open the Lightning App Builder.
  2. Select the Visualforce component from the left-hand menu and place it in the layout.
  3. In Visualforce Page Name, enter the name you gave the page.
  4. Adjust the height to suit your page layout.
Adding the Visualforce component in the Lightning App Builder