Multiple Adaptive Card Sample 1

works with tekos.co platform. This is some Adaptive Card displayed on tekos chat rooms

[{"id":"2e0c8c8b.26f4b4","type":"inject","z":"8eb50c91.720f5","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":420,"wires":[["1d63c9a0.2722c6"]]},{"id":"1d63c9a0.2722c6","type":"template","z":"8eb50c91.720f5","name":"","field":"card","fieldType":"msg","format":"json","syntax":"plain","template":"{\n    \"type\": \"AdaptiveCard\",\n    \"body\": [\n        {\n            \"type\": \"TextBlock\",\n            \"size\": \"Medium\",\n            \"weight\": \"Bolder\",\n            \"text\": \"${title}\"\n        },\n        {\n            \"type\": \"ColumnSet\",\n            \"columns\": [\n                {\n                    \"type\": \"Column\",\n                    \"items\": [\n                        {\n                            \"type\": \"Image\",\n                            \"style\": \"Person\",\n                            \"url\": \"${creator.profileImage}\",\n                            \"size\": \"Small\"\n                        }\n                    ],\n                    \"width\": \"auto\"\n                },\n                {\n                    \"type\": \"Column\",\n                    \"items\": [\n                        {\n                            \"type\": \"TextBlock\",\n                            \"weight\": \"Bolder\",\n                            \"text\": \"${creator.name}\",\n                            \"wrap\": true\n                        },\n                        {\n                            \"type\": \"TextBlock\",\n                            \"spacing\": \"None\",\n                            \"text\": \"Created {{DATE(${createdUtc},SHORT)}}\",\n                            \"isSubtle\": true,\n                            \"wrap\": true\n                        }\n                    ],\n                    \"width\": \"stretch\"\n                }\n            ]\n        },\n        {\n            \"type\": \"TextBlock\",\n            \"text\": \"${description}\",\n            \"wrap\": true\n        },\n        {\n            \"type\": \"FactSet\",\n            \"facts\": [\n                {\n                    \"$data\": \"${properties}\",\n                    \"title\": \"${key}:\",\n                    \"value\": \"${value}\"\n                }\n            ]\n        }\n    ],\n    \"actions\": [\n        {\n            \"type\": \"Action.ShowCard\",\n            \"title\": \"Set due date\",\n            \"card\": {\n                \"type\": \"AdaptiveCard\",\n                \"body\": [\n                    {\n                        \"type\": \"Input.Date\",\n                        \"id\": \"dueDate\"\n                    },\n                    {\n                        \"type\": \"Input.Text\",\n                        \"id\": \"comment\",\n                        \"placeholder\": \"Add a comment\",\n                        \"isMultiline\": true\n                    }\n                ],\n                \"actions\": [\n                    {\n                        \"type\": \"Action.Submit\",\n                        \"title\": \"OK\"\n                    }\n                ],\n                \"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\"\n            }\n        },\n        {\n            \"type\": \"Action.OpenUrl\",\n            \"title\": \"View\",\n            \"url\": \"${viewUrl}\"\n        }\n    ],\n    \"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\",\n    \"version\": \"1.3\"\n}","output":"json","x":320,"y":420,"wires":[["35079ba2.2fe4d4"]]},{"id":"35079ba2.2fe4d4","type":"function","z":"8eb50c91.720f5","name":"Stock","func":"msg.roomId = \"!LAMIpamyCBxUOVQhii:m.tekos.co\"\n// specicy your room ID\n\nmsg.url = \"https://\"+env.get(\"BASE_URL\")+\"/_matrix/client/r0/rooms/\"+msg.roomId+\"/send/m.room.message?access_token=\"+env.get(\"TEKOS_BOT_TOKEN\");\nmsg.payload={\n    \"body\": \"\",\n    \"msgtype\": \"m.text\",\n    \"sidebar\": true,\n    \"adaptiveCard\":msg.card\n}\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":530,"y":420,"wires":[["409abf73.f8cfa","25208914.d0ab06"]],"icon":"node-red/debug.svg"},{"id":"409abf73.f8cfa","type":"http request","z":"8eb50c91.720f5","name":"","method":"POST","ret":"txt","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":690,"y":420,"wires":[["afb0ef7.1479a1"]]},{"id":"afb0ef7.1479a1","type":"debug","z":"8eb50c91.720f5","name":"success","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":870,"y":420,"wires":[]},{"id":"25208914.d0ab06","type":"debug","z":"8eb50c91.720f5","name":"success","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":685,"y":379,"wires":[]},{"id":"7f63bb84.863d34","type":"change","z":"8eb50c91.720f5","name":"Set Data","rules":[{"t":"set","p":"stock.name","pt":"msg","to":"Amazon.com, Inc. (NASDAQ: AMZN)","tot":"str"},{"t":"set","p":"brand","pt":"msg","to":"https%3A%2F%2Fwww.marketplace.org%2Fwp-content%2Fuploads%2F2019%2F07%2Fama2.png","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":160,"wires":[["bcd47449.c24b68"]]},{"id":"bcd47449.c24b68","type":"template","z":"8eb50c91.720f5","name":"Card template from designer","field":"card","fieldType":"msg","format":"json","syntax":"mustache","template":"{\n    \"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\",\n    \"type\": \"AdaptiveCard\",\n    \"version\": \"1.3\",\n    \"speak\": \"Amazon stock is trading at $62.30 a share, which is down .32%\",\n    \"body\": [\n        {\n            \"type\": \"Image\",\n            \"url\": \"{{brand}}\",\n            \"size\": \"Large\",\n            \"horizontalAlignment\": \"Center\"\n        },\n        {\n            \"type\": \"Container\",\n            \"items\": [\n                {\n                    \"type\": \"TextBlock\",\n                    \"text\": \"{{stock.name}}\",\n                    \"size\": \"Medium\",\n                    \"isSubtle\": true\n                },\n                {\n                    \"type\": \"TextBlock\",\n                    \"text\": \"September 19, 4:00 PM EST\",\n                    \"isSubtle\": true\n                }\n            ]\n        },\n        {\n            \"type\": \"Container\",\n            \"spacing\": \"None\",\n            \"items\": [\n                {\n                    \"type\": \"ColumnSet\",\n                    \"columns\": [\n                        {\n                            \"type\": \"Column\",\n                            \"width\": \"stretch\",\n                            \"items\": [\n                                {\n                                    \"type\": \"TextBlock\",\n                                    \"text\": \"75.30\",\n                                    \"size\": \"ExtraLarge\"\n                                },\n                                {\n                                    \"type\": \"TextBlock\",\n                                    \"text\": \"▼ 0.20 (0.32%)\",\n                                    \"size\": \"Small\",\n                                    \"color\": \"Attention\",\n                                    \"spacing\": \"None\"\n                                }\n                            ]\n                        },\n                        {\n                            \"type\": \"Column\",\n                            \"width\": \"auto\",\n                            \"items\": [\n                                {\n                                    \"type\": \"FactSet\",\n                                    \"facts\": [\n                                        {\n                                            \"title\": \"Open\",\n                                            \"value\": \"62.24\"\n                                        },\n                                        {\n                                            \"title\": \"High\",\n                                            \"value\": \"62.98\"\n                                        },\n                                        {\n                                            \"title\": \"Low\",\n                                            \"value\": \"62.20\"\n                                        }\n                                    ]\n                                }\n                            ]\n                        }\n                    ]\n                }\n            ]\n        }\n    ],\n    \"backgroundImage\": {\n        \"horizontalAlignment\": \"Right\",\n        \"verticalAlignment\": \"Center\"\n    },\n    \"verticalContentAlignment\": \"Bottom\"\n}","output":"json","x":480,"y":160,"wires":[["544c770a.0d6878","3f3764b8.b5811c"]]},{"id":"544c770a.0d6878","type":"function","z":"8eb50c91.720f5","name":"","func":"msg.roomId = \"!LAMIpamyCBxUOVQhii:m.tekos.co\"\n\nmsg.url = \"https://\"+env.get(\"BASE_URL\")+\"/_matrix/client/r0/rooms/\"+msg.roomId+\"/send/m.room.message?access_token=\"+env.get(\"TEKOS_BOT_TOKEN\");\nmsg.payload={\n    \"body\": \"\",\n    \"msgtype\": \"m.text\",\n//     \"composer\": true,\n    \"adaptiveCard\":msg.card\n}\n\n\nreturn msg;\n","outputs":1,"noerr":0,"x":670,"y":160,"wires":[["da3a8dc4.e274d"]]},{"id":"da3a8dc4.e274d","type":"http request","z":"8eb50c91.720f5","name":"","method":"POST","ret":"txt","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":810,"y":160,"wires":[["546051b4.d9789"]]},{"id":"546051b4.d9789","type":"debug","z":"8eb50c91.720f5","name":"success","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":960,"y":160,"wires":[]},{"id":"c93c388f.040b48","type":"inject","z":"8eb50c91.720f5","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":160,"wires":[["7f63bb84.863d34"]]},{"id":"3f3764b8.b5811c","type":"debug","z":"8eb50c91.720f5","name":"success","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":649,"y":100,"wires":[]},{"id":"fa028038.e8bb5","type":"change","z":"8eb50c91.720f5","name":"Set Data","rules":[{"t":"set","p":"stock.name","pt":"msg","to":"Amazon.com, Inc. (NASDAQ: AMZN)","tot":"str"},{"t":"set","p":"brand","pt":"msg","to":"https%3A%2F%2Fwww.marketplace.org%2Fwp-content%2Fuploads%2F2019%2F07%2Fama2.png","tot":"str"},{"t":"set","p":"chart","pt":"msg","to":"{         type: 'doughnut',     data: {       labels: [\"Africa\", \"Asia\", \"Europe\", \"Latin America\", \"North America\"],       datasets: [         {           label: \"Population (millions)\",           backgroundColor: [\"#3e95cd\", \"#8e5ea2\",\"#3cba9f\",\"#e8c3b9\",\"#c45850\"],           data: [2478,5267,734,784,433]         }       ]     },     options: {       title: {         display: true,         text: 'Predicted world population (millions) in 2050'       }     }     }","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":280,"wires":[["269043d0.70bb9c"]]},{"id":"269043d0.70bb9c","type":"template","z":"8eb50c91.720f5","name":"Card with a chart","field":"card","fieldType":"msg","format":"json","syntax":"plain","template":"{\n    \"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\",\n    \"type\": \"AdaptiveCard\",\n    \"version\": \"1.3\",\n    \"speak\": \"Amazon stock is trading at $62.30 a share, which is down .32%\",\n    \"body\": [\n        {\n            \"type\": \"Image\",\n            \"url\": \"{{brand}}\",\n            \"size\": \"Large\",\n            \"horizontalAlignment\": \"Center\"\n        },\n        {\n            \"type\": \"Container\",\n            \"items\": [\n                {\n                    \"type\": \"TextBlock\",\n                    \"text\": \"{{stock.name}}\",\n                    \"size\": \"Medium\",\n                    \"isSubtle\": true\n                },\n                {\n                    \"type\": \"TextBlock\",\n                    \"text\": \"September 19, 4:00 PM EST\",\n                    \"isSubtle\": true\n                }\n            ]\n        },\n        {\n            \"type\": \"Container\",\n            \"spacing\": \"None\",\n            \"items\": [\n                {\n                    \"type\": \"ColumnSet\",\n                    \"columns\": [\n                        {\n                            \"type\": \"Column\",\n                            \"width\": \"stretch\",\n                            \"items\": [\n                                {\n                                    \"type\": \"TextBlock\",\n                                    \"text\": \"75.30\",\n                                    \"size\": \"ExtraLarge\"\n                                },\n                                {\n                                    \"type\": \"TextBlock\",\n                                    \"text\": \"▼ 0.20 (0.32%)\",\n                                    \"size\": \"Small\",\n                                    \"color\": \"Attention\",\n                                    \"spacing\": \"None\"\n                                }\n                            ]\n                        },\n                        {\n                            \"type\": \"Column\",\n                            \"width\": \"auto\",\n                            \"items\": [\n                                {\n                                    \"type\": \"FactSet\",\n                                    \"facts\": [\n                                        {\n                                            \"title\": \"Open\",\n                                            \"value\": \"62.24\"\n                                        },\n                                        {\n                                            \"title\": \"High\",\n                                            \"value\": \"62.98\"\n                                        },\n                                        {\n                                            \"title\": \"Low\",\n                                            \"value\": \"62.20\"\n                                        }\n                                    ]\n                                }\n                            ]\n                        }\n                    ]\n                }\n            ]\n        },\n    {\n      \"type\": \"ChartComponent\",\n      \"title\": \"Please wait...\",\n      \"value\": {\n        type: 'doughnut',\n    data: {\n      labels: [\"Africa\", \"Asia\", \"Europe\", \"Latin America\", \"North America\"],\n      datasets: [\n        {\n          label: \"Population (millions)\",\n          backgroundColor: [\"#3e95cd\", \"#8e5ea2\",\"#3cba9f\",\"#e8c3b9\",\"#c45850\"],\n          data: [2478,5267,734,784,433]\n        }\n      ]\n    },\n    options: {\n      title: {\n        display: true,\n        text: 'Predicted world population (millions) in 2050'\n      }\n    }\n    }\n    }\n    ],\n    \"backgroundImage\": {\n        \"horizontalAlignment\": \"Right\",\n        \"verticalAlignment\": \"Center\"\n    },\n    \"verticalContentAlignment\": \"Bottom\"\n}","output":"json","x":450,"y":280,"wires":[["47cdb337.766f4c"]]},{"id":"47cdb337.766f4c","type":"function","z":"8eb50c91.720f5","name":"","func":"msg.roomId = \"!LAMIpamyCBxUOVQhii:m.tekos.co\"\n\nmsg.url = \"https://\"+env.get(\"BASE_URL\")+\"/_matrix/client/r0/rooms/\"+msg.roomId+\"/send/m.room.message?access_token=\"+env.get(\"TEKOS_BOT_TOKEN\");\nmsg.payload={\n    \"body\": \"\",\n    \"msgtype\": \"m.text\",\n//     \"composer\": true,\n    \"adaptiveCard\":msg.card\n}\n\n\nreturn msg;\n","outputs":1,"noerr":0,"x":670,"y":280,"wires":[["f03dcdd.ad3553"]]},{"id":"f03dcdd.ad3553","type":"http request","z":"8eb50c91.720f5","name":"","method":"POST","ret":"txt","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":810,"y":280,"wires":[["934f11b7.6f656"]]},{"id":"934f11b7.6f656","type":"debug","z":"8eb50c91.720f5","name":"success","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":960,"y":280,"wires":[]},{"id":"43e886c5.4e23c8","type":"inject","z":"8eb50c91.720f5","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":280,"wires":[["fa028038.e8bb5"]]},{"id":"9430034b.6e2d9","type":"function","z":"8eb50c91.720f5","name":"stats","func":"msg.roomId = \"!LAMIpamyCBxUOVQhii:m.tekos.co\"\n\n\nmsg.url = \"https://\"+env.get(\"BASE_URL\")+\"/_matrix/client/r0/rooms/\"+msg.roomId+\"/send/m.room.message?access_token=\"+env.get(\"TEKOS_BOT_TOKEN\");\nmsg.payload={\n    \"body\": \"\",\n    \"msgtype\": \"m.text\",\n    \"projected\": true,\n    \"adaptiveCard\":{\n  \"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\",\n  \"type\": \"AdaptiveCard\",\n  \"version\": \"1.0\",\n  \"body\": [\n    {\n      \"speak\": \"Tom's Pie is a Pizza restaurant which is rated 9.3 by customers.\",\n      \"type\": \"ColumnSet\",\n      \"columns\": [\n        {\n          \"type\": \"Column\",\n          \"width\": 2,\n          \"items\": [\n            {\n              \"type\": \"TextBlock\",\n              \"text\": \"PIZZA\"\n            },\n            {\n              \"type\": \"TextBlock\",\n              \"text\": \"Tom's Pie\",\n              \"weight\": \"bolder\",\n              \"size\": \"extraLarge\",\n              \"spacing\": \"none\"\n            },\n            {\n              \"type\": \"TextBlock\",\n              \"text\": \"4.2 ★★★☆ (93) · $$\",\n              \"isSubtle\": true,\n              \"spacing\": \"none\"\n            },\n            {\n              \"type\": \"TextBlock\",\n              \"text\": \"**Matt H. said** \\\"I'm compelled to give this place 5 stars due to the number of times I've chosen to eat here this past year!\\\"\",\n              \"size\": \"small\",\n              \"wrap\": true\n            }\n            \n              ]\n            },\n        {\n          \"type\": \"Column\",\n          \"width\": 1,\n          \"items\": [\n            {\n              \"type\": \"Image\",\n              \"url\": \"https://picsum.photos/300?image=882\",\n              \"size\": \"auto\"\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"type\": \"ChartComponent\",\n      \"title\": \"Please wait...\",\n      \"value\": {\n        type: 'doughnut',\n    data: {\n      labels: [\"Africa\", \"Asia\", \"Europe\", \"Latin America\", \"North America\"],\n      datasets: [\n        {\n          label: \"Population (millions)\",\n          backgroundColor: [\"#3e95cd\", \"#8e5ea2\",\"#3cba9f\",\"#e8c3b9\",\"#c45850\"],\n          data: [2478,5267,734,784,433]\n        }\n      ]\n    },\n    options: {\n      title: {\n        display: true,\n        text: 'Predicted world population (millions) in 2050'\n      }\n    }\n    }\n    }\n  ],\n  \"actions\": [\n \n    {\n      \"type\": \"Action.Cloudinary\",\n      \"title\": \"cloudinary\",\n      \"language\": \"fr\",\n      \"upload_text\": \"Télécharger 1 photo\",\n      \"cloudname\": \"digi-technologies\",\n      \"uploadpreset\": \"frvxsfj7\",\n      \"posturl\": \"https://spopin-dev.tekos.co/billing/contract/imagecompteur1/5ebac9ff0657f00012a7a0c8\",\n      \"buttontext\": \"Je choisis ma photo\",\n    },\n    {\n      \"type\": \"Action.Stripe\",\n      \"title\": \"Payer\",\n      \"text\": \"Hello world!\",\n      \"key\":\"pk_test_uFwFmjGxwDPkDjaqjhnBPAEo00pfLZjjoY\",\n      \"session_id\":\"cs_test_fldnTJF7UeMIAAw2eaJ0Iht7kk9WSNYAh2xuzFa6mplvYkH387THHkKW\"\n  }\n  ]\n}\n}\n\n\nreturn msg;\n\n\n\n","outputs":1,"noerr":0,"x":390,"y":320,"wires":[[]],"icon":"node-red/debug.svg"}]

Flow Info

Created 4 years, 11 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x2)
  • debug (x5)
  • function (x4)
  • http request (x3)
  • inject (x3)
  • template (x3)

Tags

Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option