LivePersonInc / node-agent-sdk

LivePerson Agent Messaging SDK for NodeJS
MIT License
49 stars 79 forks source link

updateConversationField - Close dialog: missing parameter #153

Open mseragiotto opened 1 year ago

mseragiotto commented 1 year ago

I tried to implement the listed code for closing the conversation dialog and trigger the PCS bot, but was not working: conversation looks closed from consumer side, Survey in progress without any survey triggered was shown from Agent side.

Looking at the way to do the same action through Connector API (the 'unofficial' way), sounds like the closedCause parameter is missing.

By adding it, using the value 'AGENT', the PCS bot trigger works fine.

Here below the updated code to add in the readme file:

    agent.updateConversationField({
    conversationId: conversationId/dialogId,
    conversationField: [{
        field: 'DialogChange',
        type: 'UPDATE',
        dialog: {
            dialogId: conversationId/dialogId,
            state: 'CLOSE',
            closedCause: 'AGENT'
        }
    }]
}, (e, resp) => {
    if (e) { console.error(e) }
    console.log(resp)
});