Salesforce Site
Setting up Cohere on Salesforce Sites requires installing the script and then updating the Content Security Policy (CSP).

Install Cohere

1. In Salesforce Setup, navigate to Platform Tools -> Feature Settings -> Digital Experiences -> All Sites and click the "Builder" link for your site.
2. In Builder, head to Settings -> Advanced and click the "Edit Head Markup" button.
3. Copy and paste the Cohere script tag (below) into the text area.
1
<script>!function(){var e=window.Cohere=window.Cohere||[];if(e.invoked)console.error("Tried to load Cohere twice");else{e.invoked=!0,e.snippet="0.2",e.methods=["init","identify","stop","showCode","getSessionUrl","makeCall","addCallStatusListener","removeCallStatusListener","widget"],e.methods.forEach(function(o){e[o]=function(){var t=Array.prototype.slice.call(arguments);t.unshift(o),e.push(t)}});var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src="https://static.cohere.so/main.js",o.crossOrigin="anonymous";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(o,t)}}();</script>
2
<script>window.Cohere.init("INSERT_API_KEY_HERE");</script>
Copied!
4. Replace INSERT_API_KEY_HERE with your API key from the Cohere Dashboard -> Settings -> Team -> API key.
5. Click the save button, and Cohere should be installed!

Update Content Security Policy (CSP)

Immediately after installing Cohere, popups that say "Can't Access Resources" will appear. Just click "OK" when they show up; we will resolve these errors in the following steps.
1. In your site's Builder page, navigate to Settings -> Security & Privacy.
2. Change the Security Level from "Strict" to "Relaxed".
3. Refresh the page.
4. Click the "Allow URL" button on the "script-src" resource and change the URL to "https://*.cohere.so".
5. Click the "Allow URL" button on the "connect-src" resource and change the URL to "wss://*.cohere.so".
6. Click the "Allow URL" button on the "media-src" resource and change the URL to "https://static.cohere.so".
7. Refresh the page again, and your site should have Cohere and be ready to publish!