'Twilio Flex listen for Agent status in a custom plugin (Available, Offline)
I'm trying to listen for an action to get the agent status.
Something like this:
flex.Actions.addListener("agentAvailable", (payload) => alert("Triggered after event agentAvailable"));
Solution 1:[1]
You need the SetActivity Action. Invoking the SetActivity Action allows you to change a worker's status between their available activities. All actions have a before and after event, so in this case you should listen for the afterSetActivity event. You would then have to inspect the activity to check whether it was the available activity and then trigger your alert.
flex.Actions.addListener("afterSetActivity", (payload) => {
if (payload.activityAvailable) {
alert("Agent is now available!");
}
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | philnash |
