Traditionally, SharePoint designer workflows help organizations to adhere to consistent business processes, and they also improve organizational efficiency and productivity by managing the tasks and steps involved in business processes.
To bridge the gap of business process automation between on-premises and the cloud, Microsoft put Flow as the successor of SharePoint workflow. However, due to the heavy investment made in SharePoint designer workflows, it might take a long time to make the switch.
In the meantime, it's possible to take advantage of the new services in the cloud from the existing SharePoint workflows. I am going to show a simple example of sending an actionable message card to a Microsoft Teams channel from a SharePoint workflow.
Step 1 Create an Incoming Webhook in a Teams channel
Name the webhook "SPWorkflowRichMsgCard" (the name can usually be an application or service which all members in the team can understand)
Copy the Url of the webhook, and save it for later use
Step 2 Create a simple workflow
Add "Build Dictionary" action
Name the dictionary "RequestHeader". (Note: value of "Authorization" is empty string)
Fill "RequestHeader" with http header info
Add "Set Workflow Variable" Action
Name the variable "TempRequestBody", and set it as String
Open text builder
Paste following JSON snippet into the text editor, and save it
{
"@context": "https://schema.org/extensions",
"@type": "MessageCard",
"themeColor": "0072C6",
"title": "Sample Feedback Card",
"text": "Tell us how you like Actionable Messages. Click **Learn More** to learn more about Actionable Messages!",
"potentialAction": [
{
"@type": "ActionCard",
"name": "Send Feedback",
"inputs": [
{
"@type": "TextInput",
"id": "feedback",
"isMultiline": true,
"title": "Let us know what you think about Actionable Messages"
}
],
"actions": [
{
"@type": "HttpPOST",
"name": "Send Feedback",
"isPrimary": true,
"target": "http://..."
}
]
},
{
"@type": "OpenUri",
"name": "Learn More",
"targets": [
{
"os": "default",
"uri": "https://docs.microsoft.com/outlook/actionable-messages"
}
]
}
]
}
Add another "Set Workflow Variable" action, name it "RequestBody", and set it as Dictionary, Open workflow lookup window
Set "Data source" as "Workflow Variables and Parameters", "Field from source" as "Variable: TempRequestBody" (the String variable defined above)
Add "Call Http Web Service" action
Update the Url of the service with the webhook Url saved above
Update the properties of the "Call Http Web Service" action
Update the value of "RquestHeaders" with variable "RequestHeader"
Update the value of "RquestContent" with variable "RequestBody", and save the changes
Add workflow end stage, then save and publish the workflow
Step 3 Test it
Trigger a workflow instance
Open the Teams channel, there should be a rich message card posed by "SPWorkflowRichMsgCard", and it's ACTIONABLE!
Hope it's helpful...