Error in getting JSON object

Hi Team,

I am trying to implement chatbot mobile application (android / IOS). I tried the code provided in the documentation to fetch the JSON object like :

const request = new Request(‘Juji Chatbot Greeting’, {method: ‘POST’, body: ‘{“firstName”: “John”}’});

                        fetch(request)

                        .then(response => {

                          if (response.status === 200) {

                            return response.json();

                          } else {

                            throw new Error('Something went wrong on api server!');

                          }

                        })

                        .then(response => {

                          console.debug(response);

                          

                        }).catch(error => {

                          console.error(error);

                        });

but I am getting error message as :

Object {
“error”: “Missing first name”,
}

Kindly review and let me know where am I going wrong.

Regards,
Aniket Sinha

Thanks for trying out the documentation. The documentation is now updated to use the correct request payload format. Basically, the body needs to be form data, instead of a JSON object.

Hi Hyang,

Thank you for your help. I am able to get the JSON object which gives me participation ID and websocket URL.

However, I followed the documentation further and established websocket Connection but could not receive chat messages via GraphQL subscription.

I would like to request a meeting with you for some help and guidance.

Looking forward for your response.

Regards,
Aniket Sinha

Hi Hyang,

Could you please share any update on above request?

Regards,
Aniket Sinha

Please email hello@juji.io to setup a meeting with us. Thanks.