microsoft / omnichannel-chat-sdk

Headless Chat SDK to build your own chat widget against Dynamics 365 Omnichannel Services.
MIT License
43 stars 41 forks source link

initialize() throws ChatConfigRetrievalFailure error #293

Closed mschuelein closed 11 months ago

mschuelein commented 12 months ago

Problem: I wanted to use the Chat SDK in our backend, to use it to integrate the Dynamics 365 live chat into our widget. However I can't use it at the moment, because everytime I try to execute initialize, I get the same error.

Scenario: I did everything like it is described in the Readme: https://github.com/microsoft/omnichannel-chat-sdk#initialization. For orgUrl and orgId I use the values that are inside the snippet of the live chat widget. For widgetId I use a value I chose myself. I tried this with two different Dynamics 365 organisations, with the same result.

Expected Behaviour: The chat config gets returned

Actual Behaviour: The function throws the following error: { message: "ChatConfigRetrievalFailure", httpResponseStatusCode: 400, }

Inside the node module file OmnichannelChatSDK.js the following error gets thrown: 'AxiosError: Request failed with status code 400\n at settle (C:\\Git\\Chatbot-Backend\\node_modules\\axios\\lib\\core\\settle.js:19:12)\n at IncomingMessage.handleStreamEnd (C:\\Git\\Chatbot-Backend\\node_modules\\axios\\lib\\adapters\\http.js:585:11)\n at IncomingMessage.emit (node:events:525:35)\n at endReadableNT (node:internal/streams/readable:1359:12)\n at processTicksAndRejections (node:internal/process/task_queues:82:21)'

xTEddie commented 11 months ago

widgetId should be the retrieved from the data-app-id attribute of the widget snippet

<script
    id="Microsoft_Omnichannel_LCWidget"
    src="[src]"
    data-app-id="[widgetId]"
    data-org-id="[orgId]"
    data-org-url="[orgUrl]"
>
</script>