In this use case we want to make use of the Microsoft Office 365 suite to tackle our after-call work.

When a call is terminated, the Agent gets a message on Teams with some predefined after-call work actions to can choose from. In our use case these actions are:

  • Sending a pre-defined welcome message to the customer.
  • Sending a customer satisfaction survey to the customer.
  • Creating a follow-up meeting in Teams with the customer.

When a call is terminated and missed, the flow sends a missed call adaptive card in the group's general channel.


The whole flow looks like this:

Limitations

This use case makes use of the "Post a choice of options as the flow bot to the user" element. This Power Automate Teams element provides simple buttons with options and pre-implemented actions. A user can't provide additional input to these actions as the actions don't wait for a response. 

(lightbulb) A different approach would be an implementation with adaptive cards which we investigate in another use case. In that case, the user can provide input to the flow element. For instance, if she/he wants to send out a standard mail but edit it before sending.

Preconditions

  • You already have a running flow that looks up customer data in your CRM. We are using Hubspot in our showcase. (info) You can learn more about this in Use Case - Looking up caller information in HubSpot.
  • To make the actions work, we need at least the customer's email address from the CRM. For the missed call case, we need the link to the customer's CRM data sheet.


Icon Legend

(lightbulb) = A tip or hint to signal a learning, improvement or useful information in context.(info) = Info points out essential notes or related page in context.
(warning) = Notifies you about fallacies and tricky parts.(question) = Asks and answers questions and troubleshooting points..
(error) = Warns you to avoid actions with irreversible / data-destructive consequence.(tick) = Signals you to perform a certain (prerequired) action to complete a related step.


Create the first branch of the flow

  1. Create a new Power Automate Flow with a Nimbus "GetOnUpdated" trigger and set the event to "Terminated".
  2. Add Initialize variable "HasBeenConectedToAgent" to it and set LastConnectedAgent as a string value to the variable.
    (lightbulb) This value is either is filled with the agents Teams UPN (agentname@tenant.com) or does not exist in the response of the trigger if the call has not been answered. Thus, we want to branch the flow depending on the value of LastConnectedUserAgent:
  3. Add a Condition element to the flow and set the condition to "HasBeenConectedToAgent is greater than leave blank".

    → Your flow should now look as follows:

"If yes" branch

  1. Add the following elements to the flow:
    • "Get User Profile (V2)" - set the value of User(UPN)= LastConnectedAgentId. The element returns the profile with Displayname of the agent. We want to use Displayname in our email messages to personalise the message content.
    • "Post a choice of options as the flow bot to the user", with the following content:
      • Options Item 1 = Send Welcome Email
      • Options Item 2 = Send Survey Email
      • Options Item 3 = Create A Follow-up Meeting
      • Recipient=  @{triggerOutputs()?['body/lastConnectedUserId']}
      • Message = What do you need me to do?
      • Headline = Finalize your call with @{triggerOutputs()?['body/customer/firstName']} @{triggerOutputs()?['body/customer/lastName']}
    • "Switch Case", on the selectedOption of the previous element

      This element creates a post in Teams that looks like this:

      When the user interacts with the card, a comment can be added

      (lightbulb) Note, that if no answer is supplied, the flow runs for 30 days.

      After submitting the customer sees the choice with provided comments.

      (tick) In the next step we implement the different options of the switch clause.

Option Item 1: "Send Welcome Email" with Microsoft Outlook

  1. Add a "Send an email (V2)" step to the flow. We want to send the mail to the customer:
    • To = @{triggerOutputs()?['body/customer/email']}
  2. Edit Subject and Body according to your needs.

    This is the email in our example: 

    We are using the comments field from the previous element to personalize the email.
    Once triggered, this step sends the following email to the customer:

Option Item 2: "Send Survey Email" with Microsoft Forms and Microsoft Outlook

  1. Build a survey on forms.office.com. Copy the public link to the survey.
    (lightbulb) Our survey example looks like this:
  2. Add a "Send an email (V2)" element to the flow. We want to send the mail to the customer:
    • To = @{triggerOutputs()?['body/customer/email']}
  3. Edit Subject and Body according to your needs.

    This is the email in our example:We are using the comments field from the previous element to personalise the email.
    Once triggered, this step sends the following email to the customer:

Option Item 3: "Create A Follow-up Meeting" with Microsoft Teams

  1. For the final third case, add a "Get future time" element. (lightbulb) We do so because we want to schedule the meeting two days ahead of the call.
  2. Also follow up with a "Create a Teams meeting" element to the flow.  
    (warning) Unfortunately, you can't select working days from the "Get future time" element.
    → If you want to add x working days, then you need to implement some steps as described in this solution: How to add only working days to a date using Power Automate (tomriha.com).
  3. The "Create a Teams meeting" element takes the following values:
    • Calendar id =  the connected user's personal calendar. 
    • Subject = Follow-up with @{triggerOutputs()?['body/customer/firstName']} @{triggerOutputs()?['body/customer/lastName']}
    • Message = Follow-up on Lunifico
    • Time zone = Select your time zone from the list / Central Europe Standard Time
    • Start time = @{body('Get_future_time')}
    • End time = @{addHours(body('Get_future_time'),1)}
    • Required attendees =  @{triggerOutputs()?['body/customer/email']};  @{outputs('Get_user_profile_(V2)')?['body/mail']}


(lightbulb) Also, note that this case could be even more flexible if the Agent could provide the date to the flow dynamically, adding flexibility in scheduling the meeting. As this would need extra steps we're just living this as a hint for now.

(tick) → Once triggered, this step creates an outlook calendar entry for the agent, the logged-in user in power automate and the customer

Option: Default

(lightbulb) You do not need to implement this case. 

"If yes" branch: Handling errors

(tick) After creating the switch case element we want to send a message to the chat so that the agent is informed about the execution of the action.

  1. Add "Post a message in a chat or channel" actions twice and connect them. (lightbulb) The first element should trigger if the case action ran into an error, the second if the error message was skipped, thus the case had been successf
     This should look as follows: 


    Action failedAction was successful

    Element Content

    Configure run after-part

    Outcome in Teams

"If no" branch

(tick) In this case, we've missed the call and want to post an adaptive card to the channel of the service.

Add a "Post adaptive card in a chat or channel" element to the flow with the following content:

  • Post as = Flow bot
  • Post in = Channel
  • Teams = select your service
  • Channel = General
  • Adaptive Card = copy the code block and edit the fields according to your needs:

    body

    {
        "type": "AdaptiveCard",
        "body": [
            {
                "type": "TextBlock",
                "size": "Medium",
                "weight": "Bolder",
                "text": "Missed Call"
            },
            {
                "type": "ColumnSet",
                "columns": [
                    {
                        "type": "Column",
                        "items": [
                            {
                                "type": "Image",
                                "style": "Person",
                                                      "url": "https://help.luware.com/download/attachments/31759305/NIMB?version=4&modificationDate=1605004975800&api=v2",
                                "size": "Small"
                            }
                        ],
                        "width": "auto"
                    },
                    {
                        "type": "Column",
                        "items": [
                            {
                                "type": "TextBlock",
                                "weight": "Bolder",
                                "text": "Nimbus Power Automate Flow",
                                "wrap": true
                            },
                            {
                                "type": "TextBlock",
                                "spacing": "None",
                                "text": "Created @{formatDateTime(utcNow(),'g')} ",
                                "isSubtle": true,
                                "wrap": true
                            }
                        ],
                        "width": "stretch"
                    }
                ]
            },
            {
                "type": "TextBlock",
                "text": "You missed a call from @{triggerOutputs()?['body/customer/firstName']} @{triggerOutputs()?['body/customer/lastName']}",
                "wrap": true
            }
        ],
        "actions": [
            {
                "type": "Action.OpenUrl",
                "title": "View Contact in Hubspot",
                "url": "@{triggerOutputs()?['body/customContextParameters/HubSpotUrl']}"
            }
        ],
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "version": "1.3"
    }
    JSON

    (lightbulb)This card looks like this when posted into the channel:

Important Note

We added an action button that points to the URL to the customer's page in the CRM. This URL needs to be populated to Nimbus within the lookup flow which is a pre-requirement of this flow.

→  Make sure you have read the (tick) Prerequirements of this use case and that the lookup-flow to your CRM of choice has run successfully.

UCIDUC  NIMB 040