0

I dont see in the documentation anywhere the ability to hide the chat.

https://www.twilio.com/docs/flex/flex-webchat-basic-configuration

Essentially, I want the chat to NOT show on a website if no agents are available. Is this possible?

Judy007
  • 5,484
  • 4
  • 46
  • 68

1 Answers1

1

It looks like I have to call twilio flex to get avaialble workers, and set this property accordingly.

const defaultConfiguration: Config = {
...
available: {BoolValueDependingOnAgentAvail},

Here is an example of javascript that leverages the necessary API to obtain the worker count. Based on this variable, you can set the BoolValueDependingOnAgentAvail accordingly

    client.taskrouter
.workspaces('WSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
.workers.list()
.then(workers => {
    data = {
        availWorkersCount: Object.keys(workers.filter(x=> x.available === true && x.attributes.includes("sales"))).length
    };
Judy007
  • 5,484
  • 4
  • 46
  • 68
  • 1
    How did you call Twilio to get the BoolValueDependingOnAgentAvail? Can you share a bit more of the example? Really think Twilio lack in examples to do basic things needed to go to production. – Magnus Karlsson Sep 13 '19 at 10:40
  • 1
    I highly recommend using forums.twilio.com if you dont find any resolution on stackoverflow. Actually, if something is really urgent to you for production, you would be best suited to ask questions on both honestly. Twilio has been very responsive on both sites, however I noticed they respond a little quicker on forums.twilio. To try to answer your question myself, I would say you have many options depending on your technology stack. Using javascript, you can execute something like the example I provide above. – Judy007 Sep 13 '19 at 23:20