Share feedback, ideas and get community help

Updated 3 months ago

HTML & Javascript implementation - how to check if it loaded correctly

Hi there,

I had an issue earlier today where my embeded Typebot was not loading and I was getting the error:
Error! Couldn't initiate the chat. ()

The issue was that I didn't have an apiHost set in my initStandard() call and the default was going to
https://chat.typebot.io/api/v1/typebots/
Adding an apiHost of: https://typebot.io fixed this.

This error came out of nowhere i.e. the chat was working on my site yesterday and stopped working today.
I'd like to set up some error handling so that if there's an error with the Typebot in future, I can show something else.

Is there anything in the HTML & Javascript library I could use to tell if there's an error with initialising the chat to prevent this happening in future?
The only solution I have come up with so far is to use querySelectors to parse the loaded data and if an error exists in the children - I show something else.

Thanks in advance!
B
D
4 comments
So sorry for the inconvenience. This bug was introduced lately as I am incrementally introducing the new chat API server
It should work fine now.
No problem - I updated my configuration to set my apiHost to "https://typebot.io" to fix it yesterday - is this solution ok going forward?
Yes that’s fine!
Add a reply
Sign up and join the conversation on Discord