I’ve been using incoming webhook provided in O365 connector to receive custom notification in my corporate’s channels in Microsoft Teams, one day a line of text is appended under the message, it says:
Action Required: O365 connectors within Teams will be deprecated and notifications from this service will stop. Learn more about the timing and how the Workflows app provides a more flexible and secure experience. If you want to continue receiving these types of messages, you can use a workflow to post messages from a webhook request. Set up workflow
So, I needed to migrate my webhook notifications from O365 connectors to Workflows app. And I’ve had trouble finding the right documentation to do so. Here’s how I did it:
First, right click on the team you want to migrate the webhook to, and select
Workflows
in the menu.In the dialog that pops up, choose
Post to a channel when a webhook request is received
.You’ll be asked to provide a name for the workflow. I used the default name.
In the same step, you’ll be asked the “Connections” to use, this will be the account that will post the messages to the channel. Click on the dots next to the “Microsoft Teams” and a selection of accounts will appear. Choose the account you want to use, I chose a separate utility account (a service account) for this purpose.
Then you’ll be asked to provide a channel to post the messages to. Choose the channel you want to post the messages to.
Click
Add workflow
to finish the setup.Copy the webhook URL that is generated for you, then click
Done
Initially I thought this is all I need to be able to migrate my webhook notifications from O365 connectors to Workflows app. But in fact the following also needs to be migrated:
- The user on behalf of whom the notifications are sent.
- The webhook URL that I used to send the notifications to.
- The format of the payload is different.
Let’s start with the first one.
Change the user on behalf of whom the notifications are sent
After I done the steps above, I tried to send a notification to the webhook URL generated by the Workflows app, but I keep getting 403 error. Reviewing the History of the workflow, I see the following error:
|
|
Some Internet research told me: in public channel, Workflow is able to send message with the “Flow Bot” (Added when the Workflow app is added to the team), but in private channel, Workflow is unable to send message with the “Flow Bot”.
To solve this, I have to change the user on behalf of whom the notifications are sent:
Right click on the team you just created the workflow to, and select
Workflows
. In the popup dialog, clickManage
.You’ll then redirected to the Workflows app. Click on the name of the workflow you just created.
Click on the
Edit
button on the top row.Click on
Send each adaptive card
.Click
Post your own adaptive card as the Flow bot to the channel
.This is the place where you can change the user on behalf of whom the notifications are sent.
Click on the arrow of the
Post as
and chooseUser
.Click
Save
to save the changes.
Update the webhook URL
Remember to change the webhook URL in your code to the one generated by the Workflows app.
Change the payload format
The payload (body in HTTP request) that I used to send to the O365 connector webhook is like this:
|
|
But the payload that I need to send to the Workflows app is like below, the main difference is that you have to send an Adaptive Card as the body of the request:
|
|
You can visit the official documentation for more available components in Adaptive Card.
After all these steps, I was able to successfully migrate my webhook notifications from O365 connectors to Workflows app. I hope this guide helps you to do the same.