Skip to main content

I commented with my question here too: 

 

How do I programmatically update the Zapier Chatbot embed code so that I pass params?

 

ChatGPT suggested the following :
 

<script>
function createChatbotEmbed(params) {
const chatbotEmbed = document.createElement(‘zapier-interfaces-chatbot-embed’);
chatbotEmbed.setAttribute(‘is-popup’, ‘false’);
chatbotEmbed.setAttribute(‘chatbot-id’, ‘<Redacted for post>’);
chatbotEmbed.setAttribute(‘height’, ‘600px’);
chatbotEmbed.setAttribute(‘width’, ’90%’);
if (params) {
chatbotEmbed.setAttribute(‘params’, JSON.stringify(params));
}
// Append the embed code to the DOM
document.querySelector(‘.h6’).appendChild(chatbotEmbed);
// Debugging: log the final embed element
console.log(chatbotEmbed.outerHTML);
}
// Check if the logged_in_user object exists and contains a softr_user_email property
if (window.logged_in_user && window.logged_in_user.‘softr_user_email’]) {
// Get the user’s email
const userEmail = window.logged_in_userl‘softr_user_email’];
console.log(“User email:“, userEmail); // Debugging line
// Create the chatbot embed code with parameters
// createChatbotEmbed({ email: userEmail });
createChatbotEmbed({ customParam: userEmail });
} else {
console.log(“User not logged in or email not available”); // Debugging line
createChatbotEmbed(null);
}
</script>
</p>
</div>

The script correctly grabs the logged in user’s email address and updates the embed code but Zapier’s chatbot doesn’t seem to recognize it. IN the code above, I previously had the ‘email’ line instead of the customParam line . But neither are recognized. 

I see this but it’s unclear whether embeds can receive parameters and how?

https://zapier.com/blog/create-custom-ai-chatbots-with-interfaces/#embed


Softr.io support suggested asking this question as well:

> Lastly ensure there are no CORS issues or restrictions on the Zapier side that might be preventing the correct handling of parameters.


If I send ?email=firstname@gmail.com like it shows in the note below, will it accept it as the email address for lead capture?

https://help.zapier.com/hc/en-us/articles/21961587870221-Use-URL-parameters-with-directives-and-greetings#h_01HGX4HXBMFHKZG831JKNDBFBW 


Hi @alanwunsche 👋

We’ve removed your duplicate question that was asked in the other Community thread. Please refrain from cross-post the same post in multiple topics in future as it goes against our Community Code of Conduct: 


Unfortunately, it’s not currently possible to pass those kind of parameters in a chatbot’s embed code. Currently it’s only possible to pass parameters to a standalone (non-embedded) chatbot as the parameters are passed within the URL of the chatbot page that will be opened.

I’d recommend submitting a new feature request to the Chatbots team here to have the ability to pass custom parameters to an embedded chatbot added. That’ll get it on the team’s radar and allow us to start tracking interest in that type of feature.

Sorry to not have a more immediate solution. If you have any further questions or if there's anything else I can help with please do let me know! 🙂