cancel
Showing results for 
Search instead for 
Did you mean: 

Message Format in MSTeam

ksinghal
Participant
0 Kudos
759

Hi Experts,

I have integrated MS Team into SAP DMC using this blogs . I am getting message in a Same format as mentioned below

but instead of this I need message in a table format as mentioned below


Can anyone please help me out on this.

Thanks & Regards

Accepted Solutions (1)

Accepted Solutions (1)

Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Kartik,

Microsoft Teams has something called Adaptive Cards https://adaptivecards.io/samples/ which might be able to display the data in a table. This requires formatting the JSON message created in SAP DM into the adaptive card format and sending it to teams. Here is a sample of an integration card I created and sent to Teams.

Thanks

Kevin

Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos

Also check this page https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-format?... that explains how to format messages for integration cards.

Thanks

Kevin

ksinghal
Participant
0 Kudos

Hi Kevin,

Thanks for provide me this information.

Can it possible for you to provide me Schema and JSON message format for this. This will help me a lot.

BR.

Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos
var content = {
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.2",
    "body": [{
            "type": "TextBlock",
            "text": "Service Request ",
            "wrap": true,
            "size": "large",
            "color": "accent",
            "isSubtle": true,
            "id": "acTitel"
        }, {
            "type": "ColumnSet",
            "columns": [{
                    "type": "Column",
                    "width": "stretch",
                    "items": [{
                            "type": "TextBlock",
                            "text": "Raised by",
                            "wrap": true,
                            "weight": "Bolder",
                            "id": "a"
                        }
                    ]
                }, {
                    "type": "Column",
                    "width": "stretch",
                    "items": [{
                            "type": "TextBlock",
                            "text": "User ID\n",
                            "wrap": true,
                            "id": "acUserID"
                        }
                    ]
                }
            ]
        }, {
            "type": "TextBlock",
            "text": "At Location",
            "wrap": true,
            "size": "Large",
            "weight": "Bolder",
            "separator": true
        }, {
            "type": "FactSet",
            "facts": [{
                    "title": "Workcenter",
                    "value": "sWorkcenter"
                }, {
                    "title": "Operation",
                    "value": "sOperation"
                }, {
                    "title": "Resource",
                    "value": "sResource"
                }
            ],
            "id": "acLocation"
        }, {
            "type": "TextBlock",
            "text": "Current Product ",
            "wrap": true,
            "separator": true,
            "size": "Large",
            "weight": "Bolder"
        }, {
            "type": "FactSet",
            "facts": [{
                    "title": "Order",
                    "value": "sOrder"
                }, {
                    "title": "SFC",
                    "value": "sSFC"
                }
            ],
            "id": "acProduct"
        }
    ],
    "actions": [{
            "type": "Action.OpenUrl",
            "title": "View Order Details",
            "url": "https://xxxxxxxxx.test.execution.eu20.dmc.cloud.sap/cp.portal/site#ManageOrders-Display?sap-ui-app-id-hint=sap.dm.dme.manageorder&/ShopOrders/ShopOrderBO:",
            "id": "acActionViewOrderDetails"
        }
    ]
};

content.body[1].columns[1].items[0].text = $input.userID;
content.body[3].facts[0].value = $input.workcenter;
content.body[3].facts[1].value = $input.operation;
content.body[3].facts[2].value = $input.resource;
content.body[5].facts[0].value = $input.order;
content.body[5].facts[1].value = $input.SFC;
content.actions[0].url = content.actions[0].url + $input.plant + "," + $input.order;

$output.content = content;

Sure, I have the script above in a script task and this creates the JSON message that I pass to the MS Teams Service . The example above is what created the screenshot in my previous comment. You will need to paste in your DM url into the url field and create the appropriate inputs and output.

Hope this helps

Kevin

ksinghal
Participant
0 Kudos

Hi Kevin,

Thanks for provide me this information.

But I am looking for Schema that we need to define in Manage Service Registry. Can you please share that if possible.

Also, I need to know that which Data Type I need to select.

BR.

Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Kartik,

Apologies I misunderstood your question, the schema is already in the blog post. Its exactly the same schema as if you were just sending text, you basically just send the JSON structure created by the script I posted above and send it to the same schema in the blog post.

Thanks

Kevin

ksinghal
Participant
0 Kudos

Hi Kevin,

After using same JSON Structure and Schema which was given in your blog post. I am getting message in JSON format (Screenshot attached) but I want in a same way as you posted above like a job card.

JSON Structure

var content = {
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.2",
    "body": [{
            "type": "TextBlock",
            "text": "Service Request ",
            "wrap": true,
            "size": "large",
            "color": "accent",
            "isSubtle": true,
            "id": "acTitel"
        }, {
            "type": "ColumnSet",
            "columns": [{
                    "type": "Column",
                    "width": "stretch",
                    "items": [{
                            "type": "TextBlock",
                            "text": "Raised by",
                            "wrap": true,
                            "weight": "Bolder",
                            "id": "a"
                        }
                    ]
                }, {
                    "type": "Column",
                    "width": "stretch",
                    "items": [{
                            "type": "TextBlock",
                            "text": "User ID\n",
                            "wrap": true,
                            "id": "acUserID"
                        }
                    ]
                }
            ]
        }, {
            "type": "TextBlock",
            "text": "At Location",
            "wrap": true,
            "size": "Large",
            "weight": "Bolder",
            "separator": true
        }, {
            "type": "FactSet",
            "facts": [{
                    "title": "Workcenter",
                    "value": "sWorkcenter"
                }, {
                    "title": "Operation",
                    "value": "sOperation"
                }, {
                    "title": "Resource",
                    "value": "sResource"
                }
            ],
            "id": "acLocation"
        }, {
            "type": "TextBlock",
            "text": "Current Product ",
            "wrap": true,
            "separator": true,
            "size": "Large",
            "weight": "Bolder"
        }, {
            "type": "FactSet",
            "facts": [{
                    "title": "Order",
                    "value": "sOrder"
                }, {
                    "title": "SFC",
                    "value": "sSFC"
                }
            ],
            "id": "acProduct"
        }
    ],
    "actions": [{
            "type": "Action.OpenUrl",
            "title": "View Order Details",
            "url": "https://xxxxxxxxx.test.execution.eu20.dmc.cloud.sap/cp.portal/site#ManageOrders-Display?sap-ui-app-id-hint=sap.dm.dme.manageorder&/ShopOrders/ShopOrderBO:",
            "id": "acActionViewOrderDetails"
        }
    ]
};


content.body[1].columns[1].items[0].text = $input.userID;
content.body[3].facts[0].value = $input.workcenter;
content.body[3].facts[1].value = $input.operation;
content.body[3].facts[2].value = $input.resource;
content.body[5].facts[0].value = $input.order;
content.body[5].facts[1].value = $input.SFC;
content.actions[0].url = content.actions[0].url + $input.plant + "," + $input.order;

$output.content = content;

Schema

{

“type”: “object”,

“properties”:

{

“text”:

{

“description”: “Message To Be Sent”,

“type”: “string”

}

},

“required”: [

“text”

]

}

Message Screen

ksinghal
Participant
0 Kudos
Hi Kevin,

Answers (1)

Answers (1)

0 Kudos

Hi Kartikksinghal,

you can checkout the following blog for the general adaptive card approach.
Use the Adaptive Card Designer and refer to the table example.

Kind Regards
Jonas

ksinghal
Participant
0 Kudos

Hi Jonas,

Thanks for helping me out.

Can you help me to correct me Schema that we need to define in Manage service registry.

This is my Message format

Script Code

var content = {
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.2",
    "body": [{
            "type": "TextBlock",
            "text": "Service Request ",
            "wrap": true,
            "size": "large",
            "color": "accent",
            "isSubtle": true,
            "id": "acTitel"
        }, {
            "type": "ColumnSet",
            "columns": [{
                    "type": "Column",
                    "width": "stretch",
                    "items": [{
                            "type": "TextBlock",
                            "text": "Raised by",
                            "wrap": true,
                            "weight": "Bolder",
                            "id": "a"
                        }
                    ]
                }, {
                    "type": "Column",
                    "width": "stretch",
                    "items": [{
                            "type": "TextBlock",
                            "text": "User ID\n",
                            "wrap": true,
                            "id": "acUserID"
                        }
                    ]
                }
            ]
        }, {
            "type": "TextBlock",
            "text": "At Location",
            "wrap": true,
            "size": "Large",
            "weight": "Bolder",
            "separator": true
        }, {
            "type": "FactSet",
            "facts": [{
                    "title": "Workcenter",
                    "value": "sWorkcenter"
                }, {
                    "title": "Operation",
                    "value": "sOperation"
                }, {
                    "title": "Resource",
                    "value": "sResource"
                }
            ],
            "id": "acLocation"
        }, {
            "type": "TextBlock",
            "text": "Current Product ",
            "wrap": true,
            "separator": true,
            "size": "Large",
            "weight": "Bolder"
        }, {
            "type": "FactSet",
            "facts": [{
                    "title": "Order",
                    "value": "sOrder"
                }, {
                    "title": "SFC",
                    "value": "sSFC"
                }
            ],
            "id": "acProduct"
        }
    ],
    "actions": [{
            "type": "Action.OpenUrl",
            "title": "View Order Details",
            "url": "https://xxxxxxxxx.test.execution.eu20.dmc.cloud.sap/cp.portal/site#ManageOrders-Display?sap-ui-app-id-hint=sap.dm.dme.manageorder&/ShopOrders/ShopOrderBO:",
            "id": "acActionViewOrderDetails"
        }
    ]
};


content.body[1].columns[1].items[0].text = $input.userID;
content.body[3].facts[0].value = $input.workcenter;
content.body[3].facts[1].value = $input.operation;
content.body[3].facts[2].value = $input.resource;
content.body[5].facts[0].value = $input.order;
content.body[5].facts[1].value = $input.SFC;
content.actions[0].url = content.actions[0].url + $input.plant + "," + $input.order;

$output.content = content;

Schema

{
  "type": "object",
  "properties": {
    "type": { "type": "string", "const": "AdaptiveCard" },
    "$schema": { "type": "string" },
    "version": { "type": "string" },
    "body": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": { "type": "string" },
          "text": { "type": "string" },
          "wrap": { "type": "boolean" },
          "size": { "type": "string" },
          "color": { "type": "string" },
          "isSubtle": { "type": "boolean" },
          "id": { "type": "string" },
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": { "type": "string" },
                "width": { "type": "string" },
                "items": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "type": { "type": "string" },
                      "text": { "type": "string" },
                      "wrap": { "type": "boolean" },
                      "weight": { "type": "string" },
                      "id": { "type": "string" }
                    },
                    "required": ["type", "text", "wrap", "weight", "id"]
                  }
                }
              },
              "required": ["type", "width", "items"]
            }
          },
          "separator": { "type": "boolean" },
          "weight": { "type": "string" },
          "facts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "title": { "type": "string" },
                "value": { "type": "string" }
              },
              "required": ["title", "value"]
            }
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": { "type": "string", "const": "Action.OpenUrl" },
                "title": { "type": "string" },
                "url": { "type": "string" },
                "id": { "type": "string" }
              },
              "required": ["type", "title", "url", "id"]
            }
          }
        },
        "required": ["type"]
      }
    }
  },
  "required": ["type", "$schema", "version", "body"]
}
This Schema is not working. Can u please help me in correcting this schema