Use Case - Expected Queue Waiting Time Announcement

Announce expected queue waiting times by leveraging Power Automate

In this scenario we demonstrate how to create a dynamic announcement using the current Queue Position of a customer, to give them an indication of how long they are likely to wait before their call can be accepted. To achieve this, a Power Automate Flow calculates an average queue time over the last 100 calls and announces it dynamically in the Nimbus “Announcement” Workflow Activity.

PRECONDITIONS

In this use case we assume that you've already created a Nimbus service. 

Enterprise Routing Your service needs to have an Enterprise Routing service license assigned to be able to use the advanced Workflow Activities and schedule outbound calls via Power Automate. See Nimbus Features for a full overview of all available features by license.

Additionally, ensure to read and follow the Nimbus Power Automate Connector preconditions, as this Use Case will make use of Nimbus Trigger Events and Flow Actions.

 

INC Icon Legend Accordion

Show Icon Legend

💡 = A hint to signal learnings, improvements or useful information in context. 🔍 = Info points out essential notes or related page in context.
☝ = Notifies you about fallacies and tricky parts that help avoid problems. 🤔 = Asks and answers common questions and troubleshooting points.
❌ = Warns you of actions with irreversible / data-destructive consequence. ✅ = Intructs you to perform a certain (prerequired) action to complete a related step.
 
 

Preparing in Nimbus

We will store and use Parameters as starting and endpoint for the Queue duration calculation. The Nimbus Workflow will fill these parameters with queue information, while a parallel-running Power Automate Flow Action will do the necessary Nimbus task retrieval and calculation work.

💡Tip: If you want to re-use either your Parameters or Workflows within multiple services, make sure place them in high-level Organization Units accordingly.

 

Create Parameters

✅ In Nimbus Configuration you need to create 3 Parameters with default values.

Name

Default Value

CurrentQueueLength

0

InitialQueueLength

1

CurrentQueueTime

0

Create Nimbus Workflow

Expand to see the entire workflow

 
 
Steps Screenshots
  1. Start your workflow as you would with an Accept, some Announcements, etc. 
  2. Start with a "Queue Task" activity and set the RONA to your desired value. 
  1. Retrieve the Queue Position with a “Get Queue Position” activity.
  2. Set the service to “Current Service” and Custom Context Parameter to “InitialQueueLength”.  
    💡This is one the Parameters you created previously above.
  1. Add another “Get Queue Position”.
  2. Set the service to “Current Service” again but set the parameter to “CurrentQueueLength”.
  1. Use a “Play Music” activity
  2. Set the duration to the time you want in between the queue time announcements.  
    💡For Testing it's been set to 30 sec, for a productive scenario a higher time would be recommended.
  1. Add a “Check Task” activity.
  2. Set the “Queue Time Limit” to the max time you want a Task to be queued.
  1. Add a “Check Parameter” activity
  2. Connect the “Limit not Reached” exit node from the previous from “Check Task” activity.
  3. Put in the “CurrentQueueTime” parameter
  4. Connect the “No Match” and “Not set” paths back to 2nd “Get Queue Position”.
  1. Put in an Announcement and connect it to the “Check 1” path from the last activity.
  2. Connect the Announcement back to the 2nd “Get Queue Position”.
  3. In the Announcement, add the Prompt Text with your CurrentQueueTime parameter as the dynamic time.  

    Example Prompt:  
    Your current queue time is $(CustomContextParameters.CurrentQueueTime) minutes.
  1. End the Workflow after the “Check task” with the “Limit Reached” exit node:
    1. Add an Announcement like “Apologies, we could not find anyone in time”
    2. Don't forget to “Disconnect” the call for session closure.
  2. Save and close your workflow.

Create SharePoint Lists

Two SharePoint lists are needed, one to store the Queue Time for each call, another to store the average time per person in queue. We called our lists “Queue” and “Average” accordingly:

Steps Screenshots
  1. Go to your Sharepoint Site.
  2. Add two lists, “Queue” and “Average”. Choose “blank list” for both.  
    3. Make sure the PowerAutomate User has access to these lists. 

Within your “Queue” list:

  1. Add a column of type “Number”. 
  2. Name it “QueueTImeAgent” and save it: 

Within your “Average” list:

  1. Add a column of type “Number” 
  2. Name it “AverageQueueTime” 

Create Power Automate Flows

✅ In the next steps, three flows are created, also including the Nimbus Power Automate Connector to differentiate between each incoming (customer) task.  
 

3 Power Automate flows which can run in parallel and used by multiple services

  • Flow 1: QueueTime - Capture the queue times.
  • Flow 2: QueueAverageCalc - To calculate the average from all the results.
  • Flow 3: QueueAnnouncement - To prepare the announcement.

Flow 1: Queue Time

✅ First, the QueueTime flow: 

Expand to see a preview of the flow…

 
 
Steps Screenshots

Start by creating the QueueTime flow:  

  1. Go to Power Automate, “My flows” and under “New flow” select “Automated cloud flow”
  2. Use the Nimbus Trigger Event “When a task changes state”.
    1.  Set it to trigger for the service you want the announcements in. Trigger on the events “In Queue”, “Queue Left” and “Connected to User” 

Then add a “Filter Query” action: “Filter InitialQueueLength”. 

  • In the from field, add the dynamic content “Task Information Custom Context Parameters”
  • Select “Edit in advanced mode”
  • In the Filter Query field the expression “@equals(item()?['Name'], 'InitialQueueLength')” 

Initialize a variable: “InitialQueueLength”

  • name the variable itself “InitialQueueLength”, 
  • type string 
  • A value an expression: “first(body('Filter_InitialQueueLength'))?['Value']”

Initialize another variable: "Initialize InitialQueueLengthInt”

  • name the variable itself “InitialQueueLengthInt”
  • type integer 
  • value is the expression “int(variables('InitialQueueLength'))”

Initialize another variable: "Initialize QueueTimeAgent”

  • name the variable itself “QueueTimeAgent”
  • type integer 
  • leave the value empty

Initialize another variable: "Initialize CurrentTime”

  • name the variable itself “CurrentTime”
  • type string 
  • value is the expression “formatDateTime(utcNow(), 'HH:mm:ss')”

Initialize another variable: "Initialize QueueStartTime”

  • name the variable itself “QueueStartTime” 
  • type string 
  • leave the value empty 
     

Initialize another variable: "Initialize QueueTotalTime”

  • name the variable itself “QueueTotalTime”
  • type Integer 
  • leave the value empty

Add a condition,

  • from the dynamic content, choose Nimbus Event for the first value
  • Set is equal to, “InQueue” as the second value

Under the TRUE condition, do a “Update Task”

  • put the Nimbus Task ID from dynamic content into the “Task ID” field
  • select “Custom Context Parameters” from the advanced parameters. Put this in the fields.  
    "name": "QueueStartTime",  
    "value": (from the dynamic content) CurrnetTime variable

Under false, do a “Filter array”, call it “Filter QueueStartTime”

  • in the From field add “Task Information Custom Context Parameter Value” from the dynamic content. 
  • Select “Edit in advanced mode”
  • “@equals(item()?['Name'], 'QueueStartTime')” 

After the Filter array, do a set variable: “Set QueueStartTime”

  • Choose the variable “QueueStartTime” for the name, in the value itself
  • enter the expression “first(body('Filter_QueueStartTime'))?['Value']”

Do another set variable: “Set QueueTotalTime”

  • choose the variable “QueueTotalTIme” for the name, in the value itself
  • enter the expression “div(sub(ticks(variables('CurrentTime')), ticks(variables('QueueStartTime'))), 10000000)”

Do another set variable: “Set QueueTimeAgent”

  • choose the variable “QueueTimeAgent” for the name
  • in the value itself, enter the expression “div(variables('QueueTotalTime'), variables('InitialQueueLengthInt'))”

The last action for this flow is a SharePoint “create item”. 

  • Select the site where you created the queue list. 
  • For the List Name, choose your “Queue” list. 
  • Under advanced parameters, view the “QueueTimeAgent” column and enter the “QueueTimeAgent” variable as the value.
 
 

Flow2: QueueAverageCalc

Next setup the QueueAverageCalc flow:

Expand to see a preview of the flow…

 
 
Steps Screenshots

Use a Recurrence trigger:

  • Set the Interval to 1
  • Frequency to hour. 
  • Time Zone and Start Time according to what is needed.

Initialize a variable “Initialize sumQueueTime”

  • name the variable itself “sumQueueTime” 
  • Type “Float” 
  • Value “0” 

Initialize a variable “Initialize countQueueTime”

  • name the variable itself “countQueueTime” 
  • type “Float” 
  • Value “0”

Add a SharePoint “Get items” action

  • Set the Site Address and choose your “Queue” List. 
  • Set the Top Count to specify how many previous calls you want to include for the average calculation. 

🤔How to define my Top Count?

💡The higher the number, the more values will be taken into consideration for the average calculation. 

💡A lower number will reduce accuracy but increase flow run time. We would recommend a value around 100 for a good balance.

 

 

 

Add a “Compose” action. 

  • In the Inputs field, add “QueueTimeAgent” from the SharePoint dynamic contents

⮑ The previous action should automatically create a “for each” loop.

 

Within the “For each” step from above:

  1. Add a “Increment variable” action: 
    1. Increment sumQueueTime” and select the variable “sumQueueTime”
  2. Add another “Increment variable” action: 
    1. Increment countQueueTime” 
    2. Select the variable “countQueueTime”
    3. For the value “1”

After the “For each” add a initialize variable action: "Initialize QueueTimeSum”

  • name the variable “QueueTimeSum” of type “Float”
  • for the value, add the expression: “div(variables('sumQueueTime'), variables('countQueueTime'))”

Add another “Compose” action: "Compose QueueTimeSum” 

  • in the inputs, add the expression: “first(split(string(variables('QueueTimeSum')), '.'))”

Initialize another variable: "Initialize RoundedAvgTime” 

  • name the variable itself “RoundedAvgTime” 
  • type “integer”
  • for the value the expression: “div(int(outputs('Compose_QueueTimeSum')),60)”

Add a condition

  • for the first value select the “RoundedAvgTime” variable
  •  “is equal to” and “0”.

⮑ The previous action should automatically create a “for each” loop.

 

Under ”true” add a “Update Item” SharePoint action: “Update 0”:

  • Set the Site Address 
  • Choose the “Average” List. Id = 1. From Advanced parameters
  • select “AverageQueueTime” and type in “1” 

Under ”false” add a “Update Item” SharePoint action: 

  • “Update over 0”. 
  • Set the Site Address 
  • Choose the “Average” List. Id = 1. 
  • From Adavanced parameters, select “AverageQueueTime” and add the “RoundedAvgTime” variable from the previous step.
   
 
 

Flow 3: Queue Announcement

✅ And last, the QueueAnnouncement flow:

Expand to see a preview of the flow…

 
 
Steps Screenshots

Trigger with the Nimbus “When a task changes state” trigger. 

  • Set it to trigger for the service you want the announcements in. 
  • Trigger on the event “Parameter Updated”

Add a SharePoint “Get item” action. 

  • Select your Site Address, 
  • Choose the “Average” List and enter “1” for the ID: 

Initialize a parameter: "Initialize AverageQueueTime Float”

  • Name the parameter “AverageQueueTime” of type “Float”, 
  • for the value add from the SharePoint dynamic content “AverageQueueTime”

Initialize another parameter: "Initialize QueueLength String”

  • name the parameter “QueueLength” of type “string”
  • for the value add from the Nimbus dynamic content “Updated Parameter value”

Initialize another parameter: "Initialize AverageQueueTime Integer” 

  • name the parameter “AverageQueueTimeInt” of type “integer”
  • for the value add the expression “int(variables('AverageQueueTime'))”

Initialize another parameter: "Initialize QueueLength Integer”

  • name the parameter “QueueLengthInt” of type “integer”
  • for the value add the expression “int(variables('QueueLength'))”

Initialize another parameter: "Initialize CurrentQueueTime Integer”

  • name the parameter “CurrentQueueTime”
  • for the value add the expression “mul(variables('QueueLengthInt'),variables('AverageQueueTimeInt'))”

End it with a Nimbus “Update task” action. 

  • Add the Nimbus Task ID from Nimbus Dynamic Content to the “Task ID” field. 
  • From the advanced parameters, show the “Custom Context Parameters” in the name write “CurrentQueueTime” for value, add the variable “CurrentQueueTime”
 
 

Finished!

We recommend a test call to your service to check the announcement functionality in your workflow and related Power Automate flow operations. 

  • The flow should calculate an average queue time over the last 100 calls - or what you set as Top Count above in your Power Automate QueueAverageCalc flow.
  • Depending on the caller's queue position, it will calculate an estimated queue time and announce it in the call.
     
 

Table of Contents