T
Typebot3mo ago
Donal

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!
Typebot - Open-source conversational apps builder
Powerful blocks to create unique chat experiences. Embed them anywhere on your apps and start collecting results like magic.
3 Replies
Baptiste
Baptiste3mo ago
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.
Donal
Donal3mo ago
No problem - I updated my configuration to set my apiHost to "https://typebot.io" to fix it yesterday - is this solution ok going forward?
Baptiste
Baptiste3mo ago
Yes that’s fine!