Schedule an Adaptive Card post in a specified room

This flow is a template for tekos.co platform

[{"id":"b85da536.265d28","type":"cronplus","z":"247015ca.aae05a","name":"1/3. Schedule your post","outputField":"payload","timeZone":"","persistDynamic":true,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"Cron","topic":"schedule2","payloadType":"default","payload":"","expressionType":"cron","expression":"0 55 16 29 SEP * 2020","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":150,"y":160,"wires":[["94960761.57bf28"]],"info":"use this node to specify when your Acard will be sent\n\nYou can send the message one time or usign a schedule"},{"id":"94960761.57bf28","type":"change","z":"247015ca.aae05a","name":"2/3. Set Room ID & user token","rules":[{"t":"set","p":"room_id","pt":"msg","to":"YbWS:m.tekos.co","tot":"str"},{"t":"set","p":"user.access_token","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":160,"wires":[["1128867c.b53c4a"]],"info":"Set the room Id where you need to send your message\n\nroomid is the id after the https://test.tekos.co/#/room/\n\nexxample: in\nhttps://test.tekos.co/#/room/!nVDjjJNhfvoAhmYbWS:m.tekos.co\n\nthe room id is !nVDjjJNhfvoAhmYbWS:m.tekos.co\n\n"},{"id":"1128867c.b53c4a","type":"template","z":"247015ca.aae05a","name":"3/3. Set Card message","field":"payload.content","fieldType":"msg","format":"json","syntax":"mustache","template":"{\n    \"type\": \"AdaptiveCard\",\n    \"body\": [\n        {\n            \"type\": \"ColumnSet\",\n            \"horizontalAlignment\": \"Center\",\n            \"columns\": [\n                {\n                    \"type\": \"Column\",\n                    \"items\": [\n                        {\n                            \"type\": \"ColumnSet\",\n                            \"horizontalAlignment\": \"Center\",\n                            \"columns\": [\n                                {\n                                    \"type\": \"Column\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"Image\",\n                                            \"url\": \"https://messagecardplayground.azurewebsites.net/assets/LocationGreen_A.png\"\n                                        }\n                                    ],\n                                    \"width\": \"auto\"\n                                },\n                                {\n                                    \"type\": \"Column\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"TextBlock\",\n                                            \"text\": \"**Redmond**\"\n                                        },\n                                        {\n                                            \"type\": \"TextBlock\",\n                                            \"spacing\": \"None\",\n                                            \"text\": \"8a - 12:30p\"\n                                        }\n                                    ],\n                                    \"width\": \"auto\"\n                                }\n                            ]\n                        }\n                    ],\n                    \"width\": 1\n                },\n                {\n                    \"type\": \"Column\",\n                    \"spacing\": \"Large\",\n                    \"separator\": true,\n                    \"items\": [\n                        {\n                            \"type\": \"ColumnSet\",\n                            \"horizontalAlignment\": \"Center\",\n                            \"columns\": [\n                                {\n                                    \"type\": \"Column\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"Image\",\n                                            \"url\": \"https://messagecardplayground.azurewebsites.net/assets/LocationBlue_B.png\"\n                                        }\n                                    ],\n                                    \"width\": \"auto\"\n                                },\n                                {\n                                    \"type\": \"Column\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"TextBlock\",\n                                            \"text\": \"**Bellevue**\"\n                                        },\n                                        {\n                                            \"type\": \"TextBlock\",\n                                            \"spacing\": \"None\",\n                                            \"text\": \"12:30p - 3p\"\n                                        }\n                                    ],\n                                    \"width\": \"auto\"\n                                }\n                            ]\n                        }\n                    ],\n                    \"width\": 1\n                },\n                {\n                    \"type\": \"Column\",\n                    \"spacing\": \"Large\",\n                    \"separator\": true,\n                    \"items\": [\n                        {\n                            \"type\": \"ColumnSet\",\n                            \"horizontalAlignment\": \"Center\",\n                            \"columns\": [\n                                {\n                                    \"type\": \"Column\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"Image\",\n                                            \"url\": \"https://messagecardplayground.azurewebsites.net/assets/LocationRed_C.png\"\n                                        }\n                                    ],\n                                    \"width\": \"auto\"\n                                },\n                                {\n                                    \"type\": \"Column\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"TextBlock\",\n                                            \"text\": \"**Seattle**\"\n                                        },\n                                        {\n                                            \"type\": \"TextBlock\",\n                                            \"spacing\": \"None\",\n                                            \"text\": \"8p\"\n                                        }\n                                    ],\n                                    \"width\": \"auto\"\n                                }\n                            ]\n                        }\n                    ],\n                    \"width\": 1\n                }\n            ]\n        },\n        {\n            \"type\": \"ColumnSet\",\n            \"columns\": [\n                {\n                    \"type\": \"Column\",\n                    \"items\": [\n                        {\n                            \"type\": \"ColumnSet\",\n                            \"columns\": [\n                                {\n                                    \"type\": \"Column\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"Image\",\n                                            \"horizontalAlignment\": \"Left\",\n                                            \"url\": \"https://messagecardplayground.azurewebsites.net/assets/Conflict.png\"\n                                        }\n                                    ],\n                                    \"width\": \"auto\"\n                                },\n                                {\n                                    \"type\": \"Column\",\n                                    \"spacing\": \"None\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"TextBlock\",\n                                            \"text\": \"2:00 PM\"\n                                        }\n                                    ],\n                                    \"width\": \"stretch\"\n                                }\n                            ]\n                        },\n                        {\n                            \"type\": \"TextBlock\",\n                            \"spacing\": \"None\",\n                            \"text\": \"1hr\",\n                            \"isSubtle\": true\n                        }\n                    ],\n                    \"width\": \"110px\"\n                },\n                {\n                    \"type\": \"Column\",\n                    \"backgroundImage\": {\n                        \"url\": \"https://messagecardplayground.azurewebsites.net/assets/SmallVerticalLineGray.png\",\n                        \"fillMode\": \"RepeatVertically\",\n                        \"horizontalAlignment\": \"Center\"\n                    },\n                    \"items\": [\n                        {\n                            \"type\": \"Image\",\n                            \"horizontalAlignment\": \"Center\",\n                            \"url\": \"https://messagecardplayground.azurewebsites.net/assets/CircleGreen_coffee.png\"\n                        }\n                    ],\n                    \"width\": \"auto\",\n                    \"spacing\": \"None\"\n                },\n                {\n                    \"type\": \"Column\",\n                    \"items\": [\n                        {\n                            \"type\": \"TextBlock\",\n                            \"text\": \"**${Subject}**\"\n                        },\n                        {\n                            \"type\": \"ColumnSet\",\n                            \"spacing\": \"None\",\n                            \"columns\": [\n                                {\n                                    \"type\": \"Column\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"Image\",\n                                            \"url\": \"https://messagecardplayground.azurewebsites.net/assets/location_gray.png\"\n                                        }\n                                    ],\n                                    \"width\": \"auto\"\n                                },\n                                {\n                                    \"type\": \"Column\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"TextBlock\",\n                                            \"text\": \"${Location.DisplayName}\"\n                                        }\n                                    ],\n                                    \"width\": \"stretch\"\n                                }\n                            ]\n                        },\n                        {\n                            \"type\": \"ImageSet\",\n                            \"spacing\": \"Small\",\n                            \"imageSize\": \"Small\",\n                            \"images\": [\n                                {\n                                    \"type\": \"Image\",\n                                    \"url\": \"https://messagecardplayground.azurewebsites.net/assets/person_w1.png\",\n                                    \"size\": \"Small\"\n                                },\n                                {\n                                    \"type\": \"Image\",\n                                    \"url\": \"https://messagecardplayground.azurewebsites.net/assets/person_m1.png\",\n                                    \"size\": \"Small\"\n                                },\n                                {\n                                    \"type\": \"Image\",\n                                    \"url\": \"https://messagecardplayground.azurewebsites.net/assets/person_w2.png\",\n                                    \"size\": \"Small\"\n                                }\n                            ]\n                        },\n                        {\n                            \"type\": \"ColumnSet\",\n                            \"spacing\": \"Small\",\n                            \"columns\": [\n                                {\n                                    \"type\": \"Column\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"Image\",\n                                            \"url\": \"https://messagecardplayground.azurewebsites.net/assets/power_point.png\"\n                                        }\n                                    ],\n                                    \"width\": \"auto\"\n                                },\n                                {\n                                    \"type\": \"Column\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"TextBlock\",\n                                            \"text\": \"**Contoso Brand Guidelines** shared by **Susan Metters**\"\n                                        }\n                                    ],\n                                    \"width\": \"stretch\"\n                                }\n                            ]\n                        }\n                    ],\n                    \"width\": 40\n                }\n            ]\n        },\n        {\n            \"type\": \"ColumnSet\",\n            \"spacing\": \"None\",\n            \"columns\": [\n                {\n                    \"type\": \"Column\",\n                    \"width\": \"110px\"\n                },\n                {\n                    \"type\": \"Column\",\n                    \"backgroundImage\": {\n                        \"url\": \"https://messagecardplayground.azurewebsites.net/assets/SmallVerticalLineGray.png\",\n                        \"fillMode\": \"RepeatVertically\",\n                        \"horizontalAlignment\": \"Center\"\n                    },\n                    \"items\": [\n                        {\n                            \"type\": \"Image\",\n                            \"horizontalAlignment\": \"Center\",\n                            \"url\": \"https://messagecardplayground.azurewebsites.net/assets/Gray_Dot.png\"\n                        }\n                    ],\n                    \"width\": \"auto\",\n                    \"spacing\": \"None\"\n                },\n                {\n                    \"type\": \"Column\",\n                    \"items\": [\n                        {\n                            \"type\": \"ColumnSet\",\n                            \"columns\": [\n                                {\n                                    \"type\": \"Column\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"Image\",\n                                            \"url\": \"https://messagecardplayground.azurewebsites.net/assets/car.png\"\n                                        }\n                                    ],\n                                    \"width\": \"auto\"\n                                },\n                                {\n                                    \"type\": \"Column\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"TextBlock\",\n                                            \"text\": \"about 45 minutes\",\n                                            \"isSubtle\": true\n                                        }\n                                    ],\n                                    \"width\": \"stretch\"\n                                }\n                            ]\n                        }\n                    ],\n                    \"width\": 40\n                }\n            ]\n        },\n        {\n            \"type\": \"ColumnSet\",\n            \"spacing\": \"None\",\n            \"columns\": [\n                {\n                    \"type\": \"Column\",\n                    \"items\": [\n                        {\n                            \"type\": \"TextBlock\",\n                            \"spacing\": \"None\",\n                            \"text\": \"8:00 PM\"\n                        },\n                        {\n                            \"type\": \"TextBlock\",\n                            \"spacing\": \"None\",\n                            \"text\": \"1hr\",\n                            \"isSubtle\": true\n                        }\n                    ],\n                    \"width\": \"110px\"\n                },\n                {\n                    \"type\": \"Column\",\n                    \"backgroundImage\": {\n                        \"url\": \"https://messagecardplayground.azurewebsites.net/assets/SmallVerticalLineGray.png\",\n                        \"fillMode\": \"RepeatVertically\",\n                        \"horizontalAlignment\": \"Center\"\n                    },\n                    \"items\": [\n                        {\n                            \"type\": \"Image\",\n                            \"horizontalAlignment\": \"Center\",\n                            \"url\": \"https://messagecardplayground.azurewebsites.net/assets/CircleBlue_flight.png\"\n                        }\n                    ],\n                    \"width\": \"auto\",\n                    \"spacing\": \"None\"\n                },\n                {\n                    \"type\": \"Column\",\n                    \"items\": [\n                        {\n                            \"type\": \"TextBlock\",\n                            \"text\": \"**Alaska Airlines AS1021 flight to Chicago**\"\n                        },\n                        {\n                            \"type\": \"ColumnSet\",\n                            \"spacing\": \"None\",\n                            \"columns\": [\n                                {\n                                    \"type\": \"Column\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"Image\",\n                                            \"url\": \"https://messagecardplayground.azurewebsites.net/assets/location_gray.png\"\n                                        }\n                                    ],\n                                    \"width\": \"auto\"\n                                },\n                                {\n                                    \"type\": \"Column\",\n                                    \"items\": [\n                                        {\n                                            \"type\": \"TextBlock\",\n                                            \"text\": \"Seattle Tacoma International Airport (17801 International Blvd, Seattle, WA, United States)\",\n                                            \"wrap\": true\n                                        }\n                                    ],\n                                    \"width\": \"stretch\"\n                                }\n                            ]\n                        },\n                        {\n                            \"type\": \"Image\",\n                            \"url\": \"https://messagecardplayground.azurewebsites.net/assets/SeaTacMap.png\",\n                            \"size\": \"Stretch\"\n                        }\n                    ],\n                    \"width\": 40\n                }\n            ]\n        }\n    ],\n    \"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\",\n    \"version\": \"1.3\"\n}","output":"json","x":660,"y":160,"wires":[["788a3bfa.f16634"]],"info":"Set the Aadaptive Card Message\ngo to the Designer and design the adaptive card you need to send"},{"id":"788a3bfa.f16634","type":"function","z":"247015ca.aae05a","name":"bot send message","func":"msg.url = 'https://m.tekos.co/_matrix/client/r0/rooms/' +msg.room_id+ '/send/m.room.message?access_token='+msg.user.access_token\nmsg.headers ={\n //   \"Authorization\" : \"Bearer sk_test_LYtqjhDKfkXv3fOmb4PT4va400SSWORV4p\",\n    \"Content-type\": \"application/json\"\n}\nmsg.payload ={\n        msgtype:'m.text',\n        body:'',\n        adaptiveCard:msg.payload.content\n    }\n\n\n\n//msg.payload={\n      //  \"body\": env.get('message'), //\"This is an example text message\",\n       // \"msgtype\": \"m.text\"\n//}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":815,"y":160,"wires":[["8266d7d8.065658"]],"l":false},{"id":"8266d7d8.065658","type":"http request","z":"247015ca.aae05a","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":875,"y":160,"wires":[["d9033ef.ebb4ec"]],"l":false},{"id":"d9033ef.ebb4ec","type":"debug","z":"247015ca.aae05a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":935,"y":160,"wires":[],"l":false}]

Flow Info

Created 5 years, 2 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x1)
  • debug (x1)
  • function (x1)
  • http request (x1)
  • template (x1)
Other

Tags

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