If you are trying to end the flow and the conversation, why not using a "Disconnect" action in your Architect Inbound Message/Chat flow?
If you are asking about closing/terminating the websocket session (between customer and Genesys Cloud), and if you are referring to Messenger/WebMessaging (and not WebChatv2), then at this time, it is not possible to terminate the guest websocket session via Platform API.
You can request new features and share your use case at https://genesyscloud.ideas.aha.io/.
Indeed, terminating via Flow seems a good approach.
We are getting closer to GA release of new feature for End-User to "Clear" the conversation, which includes also WSS Action and JS Command to use for custom clients, see this Idea > Genesys Cloud Ideas Portal (now in Beta)
When we use this API, a "Disconnect" event is sent to the client via WebSocket. We can based on this event to close the WebSocket from the client side. But there are a lot of cases caused by the "Disconnect" event like the agent clicking on "End chat" on the Genesys side.
On the client side, there're any ways to differentiate the "Disconnect" event by API call?
No, there is no info carried to the client on why/who disconnected.
"When we use this API, a "Disconnect" event is sent to the client via WebSocket." As I mentioned above, you can use the Disconnect action in the Architect flow. It will have the same effect.
You can request an account here: Genesys | My Support
The account to access Genesys Cloud Idas is the same used to access My Support/Partner Portal/Knowledge Network community, ....
Could you explain more about how to trigger the Disconnect action in the Architect flow by API call from BE?
Because we only know the locked status of the client on the BE side.
No, you can't trigger the Disconnect action via API call. It is based on logic execution in your Architect flow.
As you mentioned bot in your first message, I don't know what bot integration you are using (Lex, DialogFlow, Genesys Bot flow, Bot Connector, ...) or if you have made an integration on your own.
My comment was about Bot integrated with Genesys Cloud.
If that's the case, then when the bot detects that the account is tagged as locked, it could exit the bot session returning to the Architect flow (specifying an intent or output session parameter so that the Architect flow knows the reason of the exit from the bot). And then invoke the Disconnect action.
I'm using Dialogflow ES. In case we use the Disconnect action in Architect flow, we need to wait user send the next message for the bot call fulfillment to know the user status