I am trying to pass custom data from my website to the Chatbot, but I encounter a CORS error in the browser console. Below is the setup I have implemented:
Scripts Added to the Page<script>
window["chtlConfig"] = {
chatbotId: ***
};
</script>
<script
async
data-id="***"
id="chatling-embed-script"
type="text/javascript"
src="https://chatling.ai/js/embed.js">
</script>
After the script is loaded, I attempt to pass data to the Chatbot using the following code:window["Chatling"].setVariables(
{
contact_job_title: "1234"
},
function (success, errorMessage) {
if (!success) {
console.error("Error:", errorMessage);
} else {
console.log("Success");
}
}
);
When executing the above code, I get the following error in the browser console:
Access to fetch at 'https://chatling.ai/public/embed/chatbot/v2/chat/svv' from origin 'https://my.domain.com' has been blocked by CORS policy:
Response to preflight request doesn't pass access control check:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
The error suggests that the server is not allowing cross-origin requests from my domain.
Request for Assistance
Validation: Please let me know if there are any mistakes in my implementation.
Solution: How can I resolve this CORS error to successfully pass data to the Chatbot?
Thank you in advance for your support!
Please authenticate to join the conversation.
Completed
π Bug Reports
About 1 year ago

Hooman
Get notified by email when there are changes.
Completed
π Bug Reports
About 1 year ago

Hooman
Get notified by email when there are changes.