Skip to Content
Product Information
Author's profile photo Jonas Haas

SAP Digital Manufacturing: Notify workers via Microsoft Teams Integration

This blog enables you to notify workers via Teams using the powerful extensibility capabilities of SAP Digital Manufacturing as well as the Business Technology Platform.
To achieve this I am making use of the @mention capabilities of MS Teams.

This is only a simple example on how to use the Format cards in Microsoft Teams in order to mention users. It can be expanded to cover Use cases such as:

  1. Notifying Supervisors on certain Events in a Production/Process Order
  2. Requesting release of Process/Production Orders
  3. Notifying other departments
  4. Many more

Furthermore the Cards can be used to enhance the Look of messages.
Please refer to Format cards in Microsoft Teams

This example uses the default schema for “User mention in Incoming Webhook with Adaptive Cards” according to this Microsoft Teams Documentation. The schema definition can be expanded to fit your individual customer requirements.

Adaptive Card Designer

Prerequisites:

In order to get started with the initial Integration please refer to blog by Kevin Hunter:
Integrating Microsoft Teams with SAP Digital Manufacturing Cloud

Setup:

Create a Service:

Creating a Service

  • Select Add
  • Select New Service
  • Make the following entries

  • Add Body Schema:
  • Content Type: application/json
  • Data Type: Structure
  • Schema: Define Inline Schema

Paste the following:

{
    "type": "object",
    "properties": {
        "type": {
            "type": "string"
        },
        "attachments": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "contentType": {
                        "type": "string"
                    },
                    "content": {
                        "type": "object",
                        "properties": {
                            "type": {
                                "type": "string"
                            },
                            "body": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "type": {
                                            "type": "string"
                                        },
                                        "text": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "$schema": {
                                "type": "string"
                            },
                            "version": {
                                "type": "string"
                            },
                            "msteams": {
                                "type": "object",
                                "properties": {
                                    "entities": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "type": {
                                                    "type": "string"
                                                },
                                                "text": {
                                                    "type": "string"
                                                },
                                                "mentioned": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "required": [
        "type",
        "attachments"
    ]
}
  • Click Save
  • Click Create for the Service

Use the Service in a Production Process:

The following is a simple example to test the functionality:

Example Production Process

  • Script Task:
$output.attachments=[
   {
      "contentType":"application/vnd.microsoft.card.adaptive",
      "content":{
         "type":"AdaptiveCard",
         "body":[
            {
               "type":"TextBlock",
               "text":"Hi <at>Firstname Lastname</at>"
            }
         ],
         "$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
         "version":"1.0",
         "msteams":{
            "entities":[
               {
                  "type":"mention",
                  "text":"<at>Firstname Lastname</at>",
                  "mentioned":{
                     "id":"firstname.lastname@examplemail.de",
                     "name":"Firstname Lastname"
                  }
               }
            ]
         }
      }
   }
]
  • Define the output parameter of the script as your newly created schema. Make sure to select the attachmentsSchema within

  • Make the following entries in the MicrosoftTeamsMention Block:

MicrosoftTeamsMention Block

 

  • Deploy and Test

With this done you can check for the messages in your Teams channel.

Summary:

  1. Do preparation of teams integration.
  2. Create a custom Service to mention people
  3. Adjust the schema to your requirements
  4. Use the Service in you Production Processes

Thanks for reading. If you have any further questions let me know in the comments.
Relevant community resources:

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.