Create JavaScript files to upload as static resources and apply them to your Channel Menu website or Experience site. This code sample populates pre-chat settings and adds a company logo.
Required Editions
| View supported editions. |
| User Permissions Needed | |
|---|---|
| To create and edit static resources: | Customize Application AND Author Apex |
You can use JavaScript static resource files, including strings, arrays, JSON, and JS functions for the Channel Menu. To set up your code file, use this example for reference.
-
Specify
_snapinsSnippetSettingsFileon the Global window object.window._snapinsSnippetSettingsFile = (function() {})(); -
Store settings on
embedded_svc.menu.snippetSettingsFileto merge in Channel Menu.window._snapinsSnippetSettingsFile = (function() { console.log("Code settings file loaded"); // Chat menu-item specific settings embedded_svc.menu.snippetSettingsFile = { TestChatChannel: { settings: { prepopulatedPrechatFields: {"Subject":"Login Issue"}, smallCompanyLogoImgURL: "https://yourwebsite.here/company_logo.png" } } }; })();
In the sample code, TestChatChannel is a placeholder for your
unique Channel Menu item name, so make sure to update it.
When your file is complete, return to Embedded Static Resources for static resource upload instructions.