Hello Team:
I am pretty new to Zendesk SDK and programming but I'd like to programmatically use the comment.text area to leave an internal note after the chat has ended to let the agent knows that the chat has ended, just for visibility purposes.
Additionally I would like to remove the send button on the right during chat sessions since we are running the sendMessage method via code instead, any idea on how to achieve these things, fellas?
So far, I am able to detect when the chat ends via the zopim_chat_ended tag, but I don't think this is totally efficient, besides that, I'd rather leave a rich text or HTML message as the last message of the session thread just before the chat comes to an end, stating that the chat session has ended,
useEffect(() => {
client.on('ticket.tags.changed', (ev) => {
constjustEnded= ev?.some((el) => el ==='zopim_chat_ended');
if (justEnded) {
setChatHasEnded(true);
let strChatEndedMsg ='<p>This chat session has ended.</p>';
client.set('comment.type', internalNote);
client.set('comment.text', strChatEndedMsg);
}
});
}, []);

The editor for Chat only supports plain text and there's no current functionality that allows the Send button to be hidden. Though it is possible to add a private rich text comment to the ticket by updating it via REST API.
Also if you'd like to build out a workflow where you add the private comment once the ticket receives the
zopim_chat_endedtag, take a look at building a webhook to send the update ticket request rather than a ZAF app. If there are no other significant features planned within your app, it may be simpler to connect the webhook to a trigger that fires when thezopim_chat_endedtag gets added.