In this article, I did a pretty hefty run down of all things shared voicemail in Microsoft Teams. I also teased another article about creating a Power Automate Flow to deliver shared voicemails into a Teams channel instead of receiving them just by email. …which brings us to this article.
The idea behind all that is, that shared voicemails get posted as an adaptive card in a Teams channel, rather than that a few individuals receive shared voicemails by email.
Preparations
First, we need to identify or create a Microsoft 365 Group which will be configured as shared voicemail target on an auto attendant or a call queue. Next, we’ll need to enable the follow in inbox feature for this group and add a shared mailbox of choice to this M365 Group. (If you need help with this, please check the linked article at the beginning of this story.)
Building the Flow
Then we can start building our flow. Choose “When a new email arrives in a shared mailbox (V2)” (Office 365 Outlook) as your trigger and select the mailbox and its folder. (If this shared mailbox also receives other messages, you might want to include a subject filter under advanced options.)
Next, we’ll need to initialize some variables.
The value of this variable is the phone number which left the voicemail. We can get the number by splitting the from address at the “@” character and selecting the first value of the splitted string. This is done with the following expression.
split(triggerOutputs()?[‘body/from’], ‘@’)[0]
To avoid duplicate files, we will create a time stamp with this expression. (Adjust the name of the time zone to your own time zone. If you’re not sure how your time zone is called, just run “Get-TimeZone” in PowerShell and copy it’s Id.)
convertTimeZone(utcNow(),‘UTC’,‘W. Europe Standard Time’, ‘yyyy-MM-dd HH:mm:ss’)
And in the end, we will convert the “+” sign into an URL friendly format with this expression.
replace(variables(‘FromNumber’), ‘+’, ‘%2b’)
Now we have all the variables which we need. Choose “Get Attachment (V2)” (Outlook Office 365) as your next action. This will automatically add an “Apply to each” loop for this action. Let’s fill in the dynamic content of the trigger output such as “Message Id” and “Attachment Id”. To be sure that only voicemails are uploaded to SharePoint, I’ve added a condition which checks if the attachments filename ends with *.mp3.
If it does, we’ll save the file to SharePoint. If it doesn’t, we won’t do any further processing and the flow ends there. Notice how we’ll use the previously initialized variables to construct a unique filename consisting of the received date and the caller’s number. Once the file has been saved, we’ll create a share link to later access the file.
All that’s left to do now is to post an adaptive card to a channel and wait for a reply.
Paste the following JSON object into your flow and replace the variables with your own names if needed.
{
“$schema”: “http://adaptivecards.io/schemas/adaptive-card.json”,
“type”: “AdaptiveCard”,
“version”: “1.3”,
“body”: [
{
“type”: “TextBlock”,
“text”: “@{triggerOutputs()?[‘body/subject’]}”,
“size”: “Large”
},
{
“type”: “TextBlock”,
“text”: “New Voicemail from @{variables(‘FromNumber’)}”
},
{
“type”: “ActionSet”,
“actions”: [
{
“type”: “Action.OpenUrl”,
“title”: “Listen to Voicemail Message”,
“url”: “@{outputs(‘Create_sharing_link_for_a_file_or_folder’)?[‘body/link/webUrl’]}”
}
]
},
{
“type”: “ActionSet”,
“actions”: [
{
“type”: “Action.OpenUrl”,
“title”: “@{variables(‘FromNumber’)} Call Back”,
“url”: “https://teams.microsoft.com/l/call/0/0?users=4:@{variables(‘CallBackNumber’)}”
},
{
“type”: “Action.Submit”,
“title”: “Call Completed”,
“style”: “positive”
}
]
}
]
}
The Result
Let’s see how this looks from a user’s perspective. Whenever a new shared voicemail is received in the shared mailbox, the Flow will be triggered and sends an adaptive card into the channel.
All Team members will know that a new voicemail has been received and they can listen to it by clicking the button.
This will open the SharePoint link and the media can be played back in the browser.
Unfortunately, playing back media on adaptive cards is not yet supported in Teams.
Because we’ve inserted a calling deep link on the adaptive card, users will also be able to initiate a call directly from the card.
And finally, once the customer has been called back the adaptive card can be completed by clicking the “Call Completed” button. This will refresh the card and let all other channel members know, that there is no action needed from their side anymore. They will also be able to see, who completed the card.
I really hope that media cards will soon be supported to provide an even better user experience in Teams.
As always, I hope that you liked my article and that it helps you too, deliver a better user experience.