Share feedback, ideas and get community help

Updated 5 months ago

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

At a glance

The community member had an issue with their embedded Typebot not loading, receiving the error "Error! Couldn't initiate the chat. ()". The issue was that they didn't have an apiHost set in their initStandard() call, and the default was going to https://chat.typebot.io/api/v1/typebots/. Setting the apiHost to https://typebot.io fixed the issue.

The community member would like to set up error handling to show something else if there's an error with the Typebot in the future, and is asking if there's anything in the HTML & JavaScript library they could use to detect if there's an error with initializing the chat.

In the comments, another community member apologized for the inconvenience, stating that the bug was introduced lately as they were incrementally introducing the new chat API server, and that it should work fine now. The original community member confirmed that setting the apiHost to https://typebot.io fixed the issue, and asked if that solution is okay going forward, to which the other community member replied that it is fine.

Useful resources
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