Skip to content

Instantly share code, notes, and snippets.

@tandevmode
Created August 27, 2018 03:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save tandevmode/a39b85c9d4f55a4c8819f2180554a3fe to your computer and use it in GitHub Desktop.
Save tandevmode/a39b85c9d4f55a4c8819f2180554a3fe to your computer and use it in GitHub Desktop.
NodeRED flow of LINE API Playground
[
{
"id": "b1fd7946.f6a0c8",
"type": "http in",
"z": "9295d104.785ef",
"name": "",
"url": "/playground/api",
"method": "post",
"upload": false,
"swaggerDoc": "",
"x": 120,
"y": 229,
"wires": [
[
"ac846132.7704c",
"886ceec0.d59bd",
"690e26b0.70d098"
]
]
},
{
"id": "ac846132.7704c",
"type": "http response",
"z": "9295d104.785ef",
"name": "",
"statusCode": "200",
"headers": {},
"x": 147,
"y": 489,
"wires": []
},
{
"id": "886ceec0.d59bd",
"type": "debug",
"z": "9295d104.785ef",
"name": "Debug Incoming Webhook",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 207,
"y": 529,
"wires": []
},
{
"id": "690e26b0.70d098",
"type": "splitter",
"z": "9295d104.785ef",
"name": "Messages Splitter",
"property": "payload.events",
"x": 357,
"y": 229,
"wires": [
[
"71bead9f.2d6534"
]
]
},
{
"id": "273e46a1.85624a",
"type": "switch",
"z": "9295d104.785ef",
"name": "Message Types Switch",
"property": "payload.type",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "text",
"vt": "str"
},
{
"t": "eq",
"v": "postback",
"vt": "str"
},
{
"t": "eq",
"v": "follow",
"vt": "str"
}
],
"checkall": "true",
"outputs": 3,
"x": 800,
"y": 240,
"wires": [
[],
[
"f96ba873.03f778"
],
[]
],
"outputLabels": [
"",
"postback",
null
]
},
{
"id": "f96ba873.03f778",
"type": "switch",
"z": "9295d104.785ef",
"name": "Intent Switch",
"property": "payload.postback.data.intent",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "messages_demo",
"vt": "str"
},
{
"t": "eq",
"v": "actions_demo",
"vt": "str"
},
{
"t": "eq",
"v": "home",
"vt": "str"
},
{
"t": "eq",
"v": "rich_menu_demo",
"vt": "str"
},
{
"t": "eq",
"v": "liff_demo",
"vt": "str"
},
{
"t": "eq",
"v": "flex_demo",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 6,
"x": 1029,
"y": 215,
"wires": [
[
"f0da59e4.86bdf8"
],
[],
[
"e4231827.bcd568"
],
[
"834ffabf.918fa8"
],
[],
[
"2f3eebf8.0235d4"
]
]
},
{
"id": "f0da59e4.86bdf8",
"type": "switch",
"z": "9295d104.785ef",
"name": "Messages Demo Action Switch",
"property": "payload.postback.data.action",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "text",
"vt": "str"
},
{
"t": "eq",
"v": "imagemap",
"vt": "str"
},
{
"t": "eq",
"v": "photo",
"vt": "str"
},
{
"t": "eq",
"v": "video",
"vt": "str"
},
{
"t": "eq",
"v": "carousel",
"vt": "str"
},
{
"t": "eq",
"v": "buttons",
"vt": "str"
},
{
"t": "eq",
"v": "confirm",
"vt": "str"
},
{
"t": "eq",
"v": "home",
"vt": "str"
},
{
"t": "eq",
"v": "about",
"vt": "str"
}
],
"checkall": "true",
"outputs": 9,
"x": 1410,
"y": 160,
"wires": [
[
"2c2eceda.f442a2"
],
[
"da113af6.7c9198"
],
[
"eca8ac46.e4923"
],
[
"d4fc695b.3456b8"
],
[
"c8ad3ea1.adcd4"
],
[
"f1f5efd.1e5821"
],
[
"bc2c9dc1.30dad"
],
[],
[]
]
},
{
"id": "c8ad3ea1.adcd4",
"type": "change",
"z": "9295d104.785ef",
"name": "Messages (Carousel)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"template\",\"altText\":\"this is a carousel template\",\"template\":{\"type\":\"carousel\",\"actions\":[],\"columns\":[{\"thumbnailImageUrl\":\"https://scdn.line-apps.com/stf/linecorp/th/pr/LINE_TV.png\",\"title\":\"LINE TV Contents Digest\",\"text\":\"Visit LINE TV\",\"actions\":[{\"type\":\"uri\",\"label\":\"Visit LINE TV\",\"uri\":\"https://tv.line.me\"}]},{\"thumbnailImageUrl\":\"https://tv-img.pstatic.net/tv2-pt/20180311_214/eL3gF_1520705061228Fz432_PNG/1520705061158.png?type=f892_502\",\"title\":\"แต่งงานกันอีกครั้งเพื่อยืนยันคำว่า 'เรา'\",\"text\":\"LINE TV - My Dear Loser (Happy Ever After) EP.12 [ตอนจบ]\",\"actions\":[{\"type\":\"uri\",\"label\":\"Watch Now\",\"uri\":\"https://tv.line.me/v/2838276_my-dear-loser-รักไม่เอาถ่าน-ตอน-happy-ever-after-ep12-1-5-ตอนจบ\"}]},{\"thumbnailImageUrl\":\"https://tv-img.pstatic.net/tv1-pt/20180310_68/uxvYJ_15206706078667kvvF_PNG/1520670607823.png?type=f892_502\",\"title\":\"บอกข้ามา... ออเจ้าเป็นใครกันแน่?\",\"text\":\"LINE TV - บุพเพสันนิวาส EP.6\",\"actions\":[{\"type\":\"uri\",\"label\":\"Watch Now\",\"uri\":\"https://tv.line.me/v/2834293_บุพเพสันนิวาส-ep6-1-9\"}]},{\"thumbnailImageUrl\":\"https://tv-img.pstatic.net/tv2-pt/20180311_258/9OFRu_1520704032897qEW98_PNG/1520704032843.png?type=f892_502\",\"title\":\"แอบหนีไปหาสาวก็ต้องโดนแบบนี้!\",\"text\":\"LINE TV - บางรักซอย9/1 2018 EP.9\",\"actions\":[{\"type\":\"uri\",\"label\":\"Watch Now\",\"uri\":\"https://tv.line.me/v/2837696_บางรักซอย9-1-2018-ep9-1-4\"}]},{\"thumbnailImageUrl\":\"https://tv-img.pstatic.net/tv1-pt/20180311_155/Pxd6r_1520701970569SCf1V_PNG/1520701970523.png?type=f892_502\",\"title\":\"ป๋อมแป๋ม สอบใบขับขี่ครั้งแรกในชีวิต!\",\"text\":\"LINE TV - ก็กูทำไม่เป็น EP.3\",\"actions\":[{\"type\":\"uri\",\"label\":\"Watch Now\",\"uri\":\"https://tv.line.me/v/2838274_ก็กูทำไม่เป็น-ep3-ป๋อมแป๋ม-สอบใบขับขี่ครั้งแรกในชีวิต\"}]}]}},{\"type\":\"template\",\"altText\":\"LINE Store Themes\",\"template\":{\"type\":\"image_carousel\",\"columns\":[{\"imageUrl\":\"https://line-objects-dev.com/line-api-playground/images/LINE-JOBS-ImageCarousel1.png\",\"action\":{\"type\":\"uri\",\"label\":\"Apply Now!\",\"uri\":\"https://www.linejobs.me\"}},{\"imageUrl\":\"https://line-objects-dev.com/line-api-playground/images/LINE-JOBS-ImageCarousel2.png\",\"action\":{\"type\":\"uri\",\"label\":\"Apply Now!\",\"uri\":\"https://www.linejobs.me\"}},{\"imageUrl\":\"https://line-objects-dev.com/line-api-playground/images/LINE-JOBS-ImageCarousel3.png\",\"action\":{\"type\":\"uri\",\"label\":\"Apply Now!\",\"uri\":\"https://www.linejobs.me\"}}]}},{\"type\":\"text\",\"text\":\"⬆️These are samples of Carousel and Image Carousel. \\nSee Documentation here: \\nCarousel: https://developers.line.me/en/docs/messaging-api/reference/#carousel\\n\\nImage Carousel: https://developers.line.me/en/docs/messaging-api/reference/#image-carousel\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1740,
"y": 220,
"wires": [
[
"ef6c9a9f.b8cd08"
]
]
},
{
"id": "71bead9f.2d6534",
"type": "function",
"z": "9295d104.785ef",
"name": "Assign UserId + ReplyToken",
"func": "msg.ref = {}\nmsg.ref.userId = msg.payload.source.userId\nmsg.ref.replyToken = msg.replyToken\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 387,
"y": 269,
"wires": [
[
"555f9460.f0f7cc"
]
]
},
{
"id": "bc2c9dc1.30dad",
"type": "change",
"z": "9295d104.785ef",
"name": "Messages (Confirm)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"template\",\"altText\":\"this is a confirm template\",\"template\":{\"type\":\"confirm\",\"actions\":[{\"type\":\"message\",\"label\":\"Yes\",\"text\":\"Yes\"},{\"type\":\"message\",\"label\":\"No\",\"text\":\"No\"}],\"text\":\"This is a Confirm template message. Is that clear? \"}},{\"type\":\"text\",\"text\":\"⬆️This is a sample of Confirm Message. \\nSee Documentation here: https://developers.line.me/en/docs/messaging-api/reference/#confirm\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1740,
"y": 300,
"wires": [
[
"ef6c9a9f.b8cd08"
]
]
},
{
"id": "f1f5efd.1e5821",
"type": "change",
"z": "9295d104.785ef",
"name": "Messages (Button)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"template\",\"altText\":\"this is a buttons template\",\"template\":{\"type\":\"buttons\",\"actions\":[{\"type\":\"uri\",\"label\":\"ทั่วไป\",\"uri\":\"https://today.line.me/TH#100280\"},{\"type\":\"uri\",\"label\":\"ธุรกิจ\",\"uri\":\"https://today.line.me/TH#100279\"},{\"type\":\"uri\",\"label\":\"ไอที เทค\",\"uri\":\"https://today.line.me/TH#100464\"},{\"type\":\"uri\",\"label\":\"กีฬา\",\"uri\":\"https://today.line.me/TH#100288\"}],\"thumbnailImageUrl\":\"https://today.line-scdn.net/img/mainimg.png\",\"text\":\"LINE Today Daily Digests\"}},{\"type\":\"text\",\"text\":\"⬆️This is a sample of Buttons Message. \\nSee Documentation here: https://developers.line.me/en/docs/messaging-api/reference/#buttons\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1730,
"y": 260,
"wires": [
[
"ef6c9a9f.b8cd08"
]
]
},
{
"id": "eb90543f.97b1f8",
"type": "inject",
"z": "9295d104.785ef",
"name": "Init",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": "",
"x": 90,
"y": 20,
"wires": [
[
"1e9f38de.e8d197",
"fa113ca3.ced22",
"21afa6d8.ae66fa",
"593822da.8d3ffc"
]
]
},
{
"id": "1e9f38de.e8d197",
"type": "function",
"z": "9295d104.785ef",
"name": "Set Redis Client",
"func": "var redis = global.get('redis');\nvar client = redis.createClient({\"host\":'redis'});\n\nclient.on(\"error\", function (err) {\n console.log(\"Error \" + err);\n});\nflow.set('redisClient', client);",
"outputs": 1,
"noerr": 0,
"x": 280,
"y": 20,
"wires": [
[]
]
},
{
"id": "f2a4f4ac.359288",
"type": "comment",
"z": "9295d104.785ef",
"name": "No State",
"info": "",
"x": 760,
"y": 180,
"wires": []
},
{
"id": "f28302ad.9119b",
"type": "comment",
"z": "9295d104.785ef",
"name": "Webhook Tester State",
"info": "",
"x": 800,
"y": 400,
"wires": []
},
{
"id": "9e0c95a9.1c2468",
"type": "function",
"z": "9295d104.785ef",
"name": "Webhook Tester",
"func": "msg.payload = {messages:[{\n type:\"text\",\n text:\"Message Body: \\n\" + JSON.stringify(msg.payload, null, 4)\n}]}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 780,
"y": 440,
"wires": [
[
"f714f34d.24dcd"
]
]
},
{
"id": "679397dc.7bfbc8",
"type": "change",
"z": "9295d104.785ef",
"name": "Actions Demo Message",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"text\",\"text\":\"⬇️ You are now in Actions Showcase Mode\\nClick on an action type on carousel to see how Messaging API responses to these actions.\"},{\"type\":\"template\",\"altText\":\"this is a carousel template\",\"template\":{\"type\":\"carousel\",\"actions\":[],\"columns\":[{\"title\":\"Message Action\",\"text\":\"Triggers a text message\",\"actions\":[{\"type\":\"message\",\"label\":\"Message Action\",\"text\":\"Hello! I am a Text Message!\"},{\"type\":\"message\",\"label\":\"Message with Link\",\"text\":\"Please join us at https://developers.line.me\"},{\"type\":\"message\",\"label\":\"Message with Emoji\",\"text\":\"Here you go! 👌\"}]},{\"title\":\"URI Action\",\"text\":\"Links to external URLs/URIs\",\"actions\":[{\"type\":\"uri\",\"label\":\"Link to Website\",\"uri\":\"https://developers.line.me\"},{\"type\":\"uri\",\"label\":\"Call\",\"uri\":\"tel://1234\"},{\"type\":\"uri\",\"label\":\"line://nv/location/\",\"uri\":\"line://nv/location/\"}]},{\"title\":\"Postback Action\",\"text\":\"Triggers a Postback Action with Text\",\"actions\":[{\"type\":\"postback\",\"label\":\"Postback with Text\",\"text\":\"Added \\\"Bamboo GT Series 2in1\\\" to Cart\",\"data\":\"intent=shopping&action=add_to_cart&item=12\"},{\"type\":\"postback\",\"label\":\"Postback (no Text)\",\"data\":\"intent=shopping&action=checkout\"},{\"type\":\"postback\",\"label\":\"JSON Payload\",\"text\":\"{\\\"intent\\\":\\\"shopping\\\"}\",\"data\":\"{\\\"intent\\\":\\\"shopping\\\"}\"}]},{\"title\":\"Date Picker Action\",\"text\":\"Triggers a Date/Time Postback\",\"actions\":[{\"type\":\"datetimepicker\",\"label\":\"Select Date/Time\",\"data\":\"storeId=12345\",\"mode\":\"datetime\",\"initial\":\"2017-12-25t00:00\",\"max\":\"2019-08-24t23:59\",\"min\":\"2017-12-25t00:00\"},{\"type\":\"datetimepicker\",\"label\":\"Select Date\",\"data\":\"storeId=12345\",\"mode\":\"date\"},{\"type\":\"datetimepicker\",\"label\":\"Select Time\",\"data\":\"storeId=12345\",\"mode\":\"time\"}]},{\"title\":\"Share With Action\",\"text\":\"Set text messages that users can share\",\"actions\":[{\"type\":\"uri\",\"label\":\"Share text\",\"uri\":\"line://msg/text/?Hello%20World!\"},{\"type\":\"uri\",\"label\":\"Share bot\",\"uri\":\"line://nv/recommendOA/@linethdev2016\"},{\"type\":\"uri\",\"label\":\"Share bot\",\"uri\":\"line://ti/p/@linethdev2016\"}]},{\"title\":\"Camera\",\"text\":\"Triggers a Camera roll\",\"actions\":[{\"type\":\"uri\",\"label\":\"Open Camera Roll\",\"uri\":\"line://nv/camera/\"},{\"type\":\"uri\",\"label\":\"Single photo\",\"uri\":\"line://nv/cameraRoll/single\"},{\"type\":\"uri\",\"label\":\"Multiple Photos\",\"uri\":\"line://nv/cameraRoll/multi\"}]}]}},{\"type\":\"text\",\"text\":\"⬆️These are some examples of Actions we can use inside Template Messages and Rich Menus\\nSee Documentation here: https://developers.line.me/en/docs/messaging-api/message-types/#actions\\n\\nSee documentations on URIs/URL schemes we can use: https://developers.line.me/en/docs/line-login/using-line-url-scheme/\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1750,
"y": 543,
"wires": [
[
"fa7bbf4f.4f02a"
]
]
},
{
"id": "e4231827.bcd568",
"type": "switch",
"z": "9295d104.785ef",
"name": "Home Action Switch",
"property": "payload.postback.data.action",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "actions_demo",
"vt": "str"
},
{
"t": "eq",
"v": "messages_demo",
"vt": "str"
},
{
"t": "eq",
"v": "webhooks_demo",
"vt": "str"
},
{
"t": "eq",
"v": "profile_api_demo",
"vt": "str"
},
{
"t": "eq",
"v": "rich_menu_demo",
"vt": "str"
},
{
"t": "eq",
"v": "flex_demo",
"vt": "str"
},
{
"t": "eq",
"v": "liff_demo",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 7,
"x": 1380,
"y": 741,
"wires": [
[
"679397dc.7bfbc8"
],
[
"9a226c7f.b505a",
"74048eaf.9dcf1"
],
[
"d3f30156.e6d4d",
"a74851c8.4222a"
],
[
"ba1b616c.c7a98"
],
[
"1fdd538d.9ab2cc",
"55ef5f08.54ace",
"834ffabf.918fa8"
],
[
"b5ef2481.2bb5a8",
"9f671005.14b07"
],
[
"a222c102.6bc85",
"6b136907.4d41c8"
]
]
},
{
"id": "5b8463f5.3e4c9c",
"type": "http request",
"z": "9295d104.785ef",
"name": "",
"method": "POST",
"ret": "txt",
"url": "https://api.line.me/v2/bot/message/push",
"tls": "",
"x": 2030,
"y": 1680,
"wires": [
[
"46ac1bde.7354b4"
]
]
},
{
"id": "46ac1bde.7354b4",
"type": "debug",
"z": "9295d104.785ef",
"name": "Messaging API Response",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 2250,
"y": 1680,
"wires": []
},
{
"id": "39a84921.631c96",
"type": "change",
"z": "9295d104.785ef",
"name": "Append Header + UserId**",
"rules": [
{
"t": "set",
"p": "headers",
"pt": "msg",
"to": "{\"Authorization\":\"Bearer XXXXX\"}",
"tot": "json"
},
{
"t": "set",
"p": "payload.to",
"pt": "msg",
"to": "msg.ref.userId",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1820,
"y": 1680,
"wires": [
[
"5b8463f5.3e4c9c"
]
]
},
{
"id": "9fac0d93.391a1",
"type": "link in",
"z": "9295d104.785ef",
"name": "Send via Messaging API",
"links": [
"ef6c9a9f.b8cd08",
"fa7bbf4f.4f02a",
"f714f34d.24dcd",
"7d15af03.ebc48",
"d4381a46.304f28",
"9ff2d7b3.0b6408",
"e22a22f0.4baf6",
"665e173a.990ad8",
"67bb3304.02ad5c",
"b2d62af1.3b0988",
"3df16bc8.3852d4",
"c629cc42.6068b",
"fb16f936.9e0678",
"7936ab7e.2e4134",
"6d895bad.6fe2c4",
"62a5296d.c8f028",
"5c2c93ab.cf196c"
],
"x": 1615,
"y": 1680,
"wires": [
[
"39a84921.631c96"
]
]
},
{
"id": "c0eab4a2.dd5158",
"type": "comment",
"z": "9295d104.785ef",
"name": "Send via Messaging API",
"info": "",
"x": 1710,
"y": 1640,
"wires": []
},
{
"id": "ef6c9a9f.b8cd08",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"9fac0d93.391a1"
],
"x": 2029.5,
"y": 277,
"wires": []
},
{
"id": "fa7bbf4f.4f02a",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"9fac0d93.391a1"
],
"x": 1935,
"y": 543,
"wires": []
},
{
"id": "f714f34d.24dcd",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"9fac0d93.391a1"
],
"x": 895,
"y": 440,
"wires": []
},
{
"id": "f0947e8b.c1264",
"type": "http request",
"z": "9295d104.785ef",
"name": "",
"method": "POST",
"ret": "txt",
"url": "",
"tls": "",
"x": 2170,
"y": 1780,
"wires": [
[
"a1f35e1a.9d447"
]
]
},
{
"id": "a1f35e1a.9d447",
"type": "debug",
"z": "9295d104.785ef",
"name": "Rich Menu Response",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 2380,
"y": 1780,
"wires": []
},
{
"id": "7dfea157.1d71d",
"type": "change",
"z": "9295d104.785ef",
"name": "Append Header**",
"rules": [
{
"t": "set",
"p": "headers",
"pt": "msg",
"to": "{\"Authorization\":\"Bearer XXXX\"}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1990,
"y": 1780,
"wires": [
[
"f0947e8b.c1264"
]
]
},
{
"id": "ab0f6059.2461a",
"type": "link in",
"z": "9295d104.785ef",
"name": "Set Rich Menu",
"links": [
"6e3afc0d.9edcf4",
"748e2467.b160cc",
"bfb64617.2531b8",
"d25c737c.1cb1e",
"84ebd0eb.91e27",
"94742966.1f2c58"
],
"x": 1615,
"y": 1780,
"wires": [
[
"9347b551.c86908"
]
]
},
{
"id": "343b7f30.cef77",
"type": "comment",
"z": "9295d104.785ef",
"name": "Set Rich Menu",
"info": "",
"x": 1680,
"y": 1740,
"wires": []
},
{
"id": "9347b551.c86908",
"type": "function",
"z": "9295d104.785ef",
"name": "Set Rich Menu & UserID",
"func": "var richMenuId = msg.payload[\"richMenuId\"];\n\nmsg.url = \n \"https://api.line.me/v2/bot/user/\" + \n msg.ref.userId + \n \"/richmenu/\" + \n richMenuId\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1770,
"y": 1780,
"wires": [
[
"7dfea157.1d71d",
"2f030f51.145e6"
]
]
},
{
"id": "fa113ca3.ced22",
"type": "function",
"z": "9295d104.785ef",
"name": "Set Rich Menu Config",
"func": "var richMenuIds = {\n \"home\": \"richmenu-b8debf98edb810ac19c00ced40e999fb\",\n \"messages_demo\": \"richmenu-cd1546e294d3aafbf8e5cfd94544270a\",\n \"webhook_tester\": \"richmenu-f8088de87248192a8191c44da840b10a\",\n \"rich_menu_demo\":\"richmenu-ca71813ab3ad0e97316cf9d8453c0749\",\n \"flex_demo\":\"richmenu-27e87c4a50c008f85feec819c58f80a3\",\n \"liff_demo\":\"richmenu-296c309c560a7f6b1e7fb343c580a413\"\n \n}\n\nflow.set(\"richMenuIds\", richMenuIds);",
"outputs": 1,
"noerr": 0,
"x": 300,
"y": 60,
"wires": [
[]
]
},
{
"id": "9a226c7f.b505a",
"type": "function",
"z": "9295d104.785ef",
"name": "Set Rich Menu to Messages Demo",
"func": "msg.payload = {\n richMenuId: flow.get(\"richMenuIds\")[\"messages_demo\"]\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1780,
"y": 721,
"wires": [
[
"6e3afc0d.9edcf4"
]
]
},
{
"id": "6e3afc0d.9edcf4",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"ab0f6059.2461a"
],
"x": 1975,
"y": 721,
"wires": []
},
{
"id": "eca8ac46.e4923",
"type": "change",
"z": "9295d104.785ef",
"name": "Messages (Photo)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"image\",\"originalContentUrl\":\"https://line-objects-dev.com/line-api-playground/images/lineman.png\",\"previewImageUrl\":\"https://line-objects-dev.com/line-api-playground/images/lineman.png\",\"animated\":false},{\"type\":\"text\",\"text\":\"⬆️This is a sample of Image Message.\\nhttps://developers.line.me/en/docs/messaging-api/reference/#image-message\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1730,
"y": 140,
"wires": [
[
"ef6c9a9f.b8cd08"
]
]
},
{
"id": "c3d132e4.c0aff",
"type": "function",
"z": "9295d104.785ef",
"name": "Set Rich Menu/State to Home",
"func": "\nclient = flow.get(\"redisClient\")\nclient.del(\"state:\" + msg.ref.userId);\n\nmsg.payload = {\n richMenuId: flow.get(\"richMenuIds\")[\"home\"]\n}\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 910,
"y": 560,
"wires": [
[
"d25c737c.1cb1e"
]
]
},
{
"id": "d25c737c.1cb1e",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"ab0f6059.2461a"
],
"x": 1095,
"y": 560,
"wires": []
},
{
"id": "d4fc695b.3456b8",
"type": "change",
"z": "9295d104.785ef",
"name": "Messages (Video)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"video\",\"originalContentUrl\":\"https://line-objects-dev.com/line-api-playground/images/video.mp4\",\"previewImageUrl\":\"https://line-objects-dev.com/line-api-playground/images/video_preview.jpg\"},{\"type\":\"text\",\"text\":\"⬆️This is a sample of Video Message.\\nhttps://developers.line.me/en/docs/messaging-api/reference/#video-message\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1730,
"y": 180,
"wires": [
[
"ef6c9a9f.b8cd08"
]
]
},
{
"id": "d3f30156.e6d4d",
"type": "function",
"z": "9295d104.785ef",
"name": "Set Rich Menu/State to Webhook Tester",
"func": "\nclient = flow.get(\"redisClient\")\nclient.set(\"state:\" + msg.ref.userId, \"webhook_tester\");\n\nmsg.payload = {\n richMenuId: flow.get(\"richMenuIds\")[\"webhook_tester\"]\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1800,
"y": 861,
"wires": [
[
"748e2467.b160cc"
]
]
},
{
"id": "6e51bda8.fb47e4",
"type": "function",
"z": "9295d104.785ef",
"name": "Check Return to Home",
"func": "if(msg.payload.postback && (msg.payload.postback.data.action == \"home\")){\n return msg;\n}\n",
"outputs": 1,
"noerr": 0,
"x": 583.5,
"y": 550,
"wires": [
[
"c3d132e4.c0aff"
]
]
},
{
"id": "748e2467.b160cc",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"ab0f6059.2461a"
],
"x": 1995,
"y": 861,
"wires": []
},
{
"id": "355ea04.46c376",
"type": "http request",
"z": "9295d104.785ef",
"name": "",
"method": "GET",
"ret": "obj",
"url": "",
"tls": "",
"x": 2050,
"y": 1021,
"wires": [
[
"fb789bd4.0d0108",
"9e53537.f7784b"
]
]
},
{
"id": "ba1b616c.c7a98",
"type": "function",
"z": "9295d104.785ef",
"name": "set URL",
"func": "msg.url = \"https://api.line.me/v2/bot/profile/\" + msg.ref.userId;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1700,
"y": 1021,
"wires": [
[
"d73e3dda.0ca05"
]
]
},
{
"id": "d73e3dda.0ca05",
"type": "change",
"z": "9295d104.785ef",
"name": "Append Header**",
"rules": [
{
"t": "set",
"p": "headers",
"pt": "msg",
"to": "{\"Authorization\":\"Bearer XXXX\"}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1890,
"y": 1021,
"wires": [
[
"355ea04.46c376"
]
]
},
{
"id": "fb789bd4.0d0108",
"type": "debug",
"z": "9295d104.785ef",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"complete": "true",
"x": 2210,
"y": 1021,
"wires": []
},
{
"id": "9ba39b99.a742b8",
"type": "function",
"z": "9295d104.785ef",
"name": "Send Response from Profile API ",
"func": "msg.payload = {messages:[{\n type:\"text\",\n text: msg.payload\n}]}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 2510,
"y": 1060,
"wires": [
[
"e22a22f0.4baf6"
]
]
},
{
"id": "e22a22f0.4baf6",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"9fac0d93.391a1"
],
"x": 2695,
"y": 1060,
"wires": []
},
{
"id": "9e53537.f7784b",
"type": "template",
"z": "9295d104.785ef",
"name": "Message Template",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Response from Profile API:\n\n▶️userId: {{{payload.userId}}}\n\n▶️displayName: {{{payload.displayName}}}\n\n▶️pictureUrl: {{{payload.pictureUrl}}}\n\n▶️statusMessage: {{{payload.statusMessage}}}\n\nReference: \nhttps://developers.line.me/en/docs/messaging-api/reference/#get-profile",
"output": "str",
"x": 2250,
"y": 1061,
"wires": [
[
"9ba39b99.a742b8"
]
]
},
{
"id": "74048eaf.9dcf1",
"type": "change",
"z": "9295d104.785ef",
"name": "Send Messages Demo Mode Message",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"text\",\"text\":\"⬇️ You are now in Messages Demo Mode.\\nClick on a message type on Rich Menu to see how Messaging API sends these messages to users.\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1790,
"y": 681,
"wires": [
[
"665e173a.990ad8"
]
]
},
{
"id": "665e173a.990ad8",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"9fac0d93.391a1"
],
"x": 1995,
"y": 681,
"wires": []
},
{
"id": "e6bc098c.390068",
"type": "comment",
"z": "9295d104.785ef",
"name": "Home",
"info": "",
"x": 1330,
"y": 681,
"wires": []
},
{
"id": "971e0e86.c6da4",
"type": "comment",
"z": "9295d104.785ef",
"name": "Messages Demo",
"info": "",
"x": 1360,
"y": 69,
"wires": []
},
{
"id": "4f2093fb.5eb9dc",
"type": "comment",
"z": "9295d104.785ef",
"name": "Message Demo Mode",
"info": "",
"x": 1740,
"y": 641,
"wires": []
},
{
"id": "7f49049b.63f66c",
"type": "comment",
"z": "9295d104.785ef",
"name": "Actions Demo Mode",
"info": "",
"x": 1730,
"y": 503,
"wires": []
},
{
"id": "aa0eeb5b.1d90f8",
"type": "comment",
"z": "9295d104.785ef",
"name": "Webhooks Tester Mode",
"info": "",
"x": 1740,
"y": 821,
"wires": []
},
{
"id": "ef727bcd.0b4c08",
"type": "comment",
"z": "9295d104.785ef",
"name": "Profile API Demo Mode",
"info": "",
"x": 1740,
"y": 981,
"wires": []
},
{
"id": "a74851c8.4222a",
"type": "change",
"z": "9295d104.785ef",
"name": "Send Webhooks Tester Mode Message",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"text\",\"text\":\"⬇️ You are now in Webhook Tester Mode\\nAll messages you send to bot will be displayed back by the bot in JSON format\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1800,
"y": 901,
"wires": [
[
"b2d62af1.3b0988"
]
]
},
{
"id": "b2d62af1.3b0988",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"9fac0d93.391a1"
],
"x": 1995,
"y": 901,
"wires": []
},
{
"id": "9ab5e124.14773",
"type": "function",
"z": "9295d104.785ef",
"name": "When User Follows",
"func": "if(msg.payload.type == \"follow\"){\n return msg;\n}\n",
"outputs": 1,
"noerr": 0,
"x": 570,
"y": 620,
"wires": [
[
"c3d132e4.c0aff"
]
]
},
{
"id": "55ef5f08.54ace",
"type": "function",
"z": "9295d104.785ef",
"name": "Set Rich Menu to Messages Demo",
"func": "msg.payload = {\n richMenuId: flow.get(\"richMenuIds\")[\"rich_menu_demo\"]\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1780,
"y": 1161,
"wires": [
[
"bfb64617.2531b8"
]
]
},
{
"id": "bfb64617.2531b8",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"ab0f6059.2461a"
],
"x": 1975,
"y": 1161,
"wires": []
},
{
"id": "1fdd538d.9ab2cc",
"type": "change",
"z": "9295d104.785ef",
"name": "Send Rich Menu Demo Mode Message",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"text\",\"text\":\"⬇️ You are now in Rich Menu Demo Mode\\nClick on a button on Rich Menu to see how it works\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1800,
"y": 1121,
"wires": [
[
"3df16bc8.3852d4"
]
]
},
{
"id": "3df16bc8.3852d4",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"9fac0d93.391a1"
],
"x": 1995,
"y": 1121,
"wires": []
},
{
"id": "8fb16b24.dae2c8",
"type": "comment",
"z": "9295d104.785ef",
"name": "Rich Menu Demo Mode",
"info": "",
"x": 1740,
"y": 1081,
"wires": []
},
{
"id": "555f9460.f0f7cc",
"type": "function",
"z": "9295d104.785ef",
"name": "Preprocess Postback (Params2Object)",
"func": "if(msg.payload.postback){\n params = JSON.parse('{\"' + decodeURI(msg.payload.postback.data.replace(/&/g, \"\\\",\\\"\").replace(/=/g,\"\\\":\\\"\")) + '\"}')\n msg.payload.postback.data = params\n return msg;\n}\nelse{\n return msg;\n}\n",
"outputs": 1,
"noerr": 0,
"x": 417,
"y": 309,
"wires": [
[
"2f6d1147.612f0e"
]
]
},
{
"id": "2f6d1147.612f0e",
"type": "function",
"z": "9295d104.785ef",
"name": "Retrieve User State",
"func": "var client = flow.get(\"redisClient\");\nclient.get(\"state:\" + msg.ref.userId, function(err, reply){\n msg.ref.state = reply\n node.send(msg);\n});",
"outputs": "1",
"noerr": 0,
"x": 356,
"y": 351,
"wires": [
[
"eaad2c75.e7c43",
"8bae30b1.22752",
"6e51bda8.fb47e4",
"9ab5e124.14773"
]
],
"outputLabels": [
"webhook_tester"
]
},
{
"id": "eaad2c75.e7c43",
"type": "switch",
"z": "9295d104.785ef",
"name": "State Switcher",
"property": "ref.state",
"propertyType": "msg",
"rules": [
{
"t": "null"
},
{
"t": "eq",
"v": "webhook_tester",
"vt": "str"
}
],
"checkall": "true",
"outputs": 2,
"x": 559.5,
"y": 433,
"wires": [
[
"273e46a1.85624a"
],
[
"9e0c95a9.1c2468"
]
]
},
{
"id": "8bae30b1.22752",
"type": "debug",
"z": "9295d104.785ef",
"name": "Debug User State",
"active": false,
"tosidebar": true,
"console": false,
"complete": "ref.state",
"x": 569.5,
"y": 392,
"wires": []
},
{
"id": "da113af6.7c9198",
"type": "change",
"z": "9295d104.785ef",
"name": "Messages (ImageMap)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"imagemap\",\"baseUrl\":\"https://d31ldq0v27bzil.cloudfront.net/bcrm/uploads/1557538784/default_template/image/1518172930/74\",\"altText\":\"This is an imagemap\",\"baseSize\":{\"width\":1040,\"height\":1599},\"actions\":[{\"type\":\"message\",\"area\":{\"x\":5,\"y\":868,\"width\":510,\"height\":361},\"text\":\"ความรัก\"},{\"type\":\"message\",\"area\":{\"x\":528,\"y\":870,\"width\":512,\"height\":358},\"text\":\"การเงิน\"},{\"type\":\"message\",\"area\":{\"x\":9,\"y\":1237,\"width\":506,\"height\":356},\"text\":\"การงาน\"},{\"type\":\"message\",\"area\":{\"x\":529,\"y\":1237,\"width\":506,\"height\":361},\"text\":\"สุขภาพ\"}]},{\"type\":\"text\",\"text\":\"⬆️This is a sample of Imagemap Message.\\nSee Documentation here: https://developers.line.me/en/docs/messaging-api/reference/#imagemap-message\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1740,
"y": 100,
"wires": [
[
"ef6c9a9f.b8cd08"
]
]
},
{
"id": "2c2eceda.f442a2",
"type": "change",
"z": "9295d104.785ef",
"name": "Messages (Text)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"text\",\"text\":\"This is a sample of Text Message.\\nSee Documentation here: https://developers.line.me/en/docs/messaging-api/reference/#text-message\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1720,
"y": 60,
"wires": [
[
"ef6c9a9f.b8cd08"
]
]
},
{
"id": "d12332b6.b1f0c",
"type": "function",
"z": "9295d104.785ef",
"name": "Move/Update Position",
"func": "rows = flow.get(\"richMenuGameConfig\").rows\ncolumns = flow.get(\"richMenuGameConfig\").columns\nswitch(msg.payload.postback.data.action) {\ncase \"up\":\n msg.payload.position.y = (msg.payload.position.y + rows -1) % rows;\n break;\ncase \"down\":\n msg.payload.position.y = (msg.payload.position.y + 1) % rows;\n break;\ncase \"left\":\n msg.payload.position.x = (msg.payload.position.x + columns -1) % columns;\n break;\ncase \"right\":\n msg.payload.position.x = (msg.payload.position.x + 1) % columns;\n break;\n}\n\n\nclient = flow.get(\"redisClient\")\nclient.set(\"position:\" + msg.ref.userId, msg.payload.position.x + \",\" + msg.payload.position.y);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1380,
"y": 380,
"wires": [
[
"92940766.ff26e8"
]
]
},
{
"id": "834ffabf.918fa8",
"type": "function",
"z": "9295d104.785ef",
"name": "Get Current Position",
"func": "var client = flow.get(\"redisClient\");\nclient.get(\"position:\" + msg.ref.userId, function(err, reply){\n if(reply){\n position_str = reply.split(\",\")\n msg.payload.position = {\n x: parseInt(position_str[0]),\n y: parseInt(position_str[1])\n }\n }\n else{\n msg.payload.position = {\n x:0,\n y:0\n }\n }\n \n node.send(msg);\n});",
"outputs": 1,
"noerr": 0,
"x": 1380,
"y": 340,
"wires": [
[
"d12332b6.b1f0c"
]
]
},
{
"id": "92940766.ff26e8",
"type": "function",
"z": "9295d104.785ef",
"name": "Draw Message",
"func": "rows = flow.get(\"richMenuGameConfig\").rows;\ncolumns = flow.get(\"richMenuGameConfig\").columns;\nlist = [];\nfor(i = 0; i < rows; i ++){\n for(j = 0; j < columns; j ++){\n \n if((i == msg.payload.position.y) && (j == msg.payload.position.x)){\n list.push(\"􀂄\")\n }\n else{\n list.push(\"􀂝\")\n }\n if(j == (columns -1)){\n list.push(\"\\n\")\n }\n }\n}\n\nmsg.payload = {\n \"messages\": [\n {\n \"type\": \"text\",\n \"text\": list.join('')\n }\n ]\n}\nreturn msg",
"outputs": 1,
"noerr": 0,
"x": 1360,
"y": 420,
"wires": [
[
"c629cc42.6068b"
]
]
},
{
"id": "c629cc42.6068b",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"9fac0d93.391a1"
],
"x": 1295,
"y": 460,
"wires": []
},
{
"id": "21afa6d8.ae66fa",
"type": "function",
"z": "9295d104.785ef",
"name": "Set Game Config",
"func": "var richMenuGameConfig = {\n \"rows\": 10,\n \"columns\": 6\n}\n\nflow.set(\"richMenuGameConfig\", richMenuGameConfig);",
"outputs": 1,
"noerr": 0,
"x": 290,
"y": 100,
"wires": [
[]
]
},
{
"id": "12651fd1.148e4",
"type": "comment",
"z": "9295d104.785ef",
"name": "Rich Menu Game Demo",
"info": "",
"x": 1380,
"y": 300,
"wires": []
},
{
"id": "593822da.8d3ffc",
"type": "function",
"z": "9295d104.785ef",
"name": "Set Channel Config**",
"func": "var config = {\n \"channel_access_token\": 'XXXX'\n}\n\nflow.set(\"config\", config);",
"outputs": 1,
"noerr": 0,
"x": 300,
"y": 140,
"wires": [
[]
]
},
{
"id": "b5ef2481.2bb5a8",
"type": "change",
"z": "9295d104.785ef",
"name": "Send Messages Flex Demo Mode",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"text\",\"text\":\"⬇️ You are now in Flex Messages Demo Mode.\\nClick on a message type on Rich Menu to see how Messaging API sends these Flex messages to users.\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1760,
"y": 1460,
"wires": [
[
"fb16f936.9e0678"
]
]
},
{
"id": "fb16f936.9e0678",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"9fac0d93.391a1"
],
"x": 1955,
"y": 1460,
"wires": []
},
{
"id": "a222c102.6bc85",
"type": "change",
"z": "9295d104.785ef",
"name": "Send Messages LIFF Demo Mode Message",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"text\",\"text\":\"⬇️ You are now in LIFF Demo Mode.\\nClick on each application on Rich Menu to see how LIFF works.\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1810,
"y": 1280,
"wires": [
[
"7936ab7e.2e4134"
]
]
},
{
"id": "2f030f51.145e6",
"type": "debug",
"z": "9295d104.785ef",
"name": "Rich menu",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 2060,
"y": 1900,
"wires": []
},
{
"id": "d9aa48d1.b70da8",
"type": "comment",
"z": "9295d104.785ef",
"name": "Flex Demo Mode",
"info": "",
"x": 1700,
"y": 1420,
"wires": []
},
{
"id": "fc87b8bf.6cd1d8",
"type": "comment",
"z": "9295d104.785ef",
"name": "LIFF Demo Mode",
"info": "",
"x": 1720,
"y": 1240,
"wires": []
},
{
"id": "6b136907.4d41c8",
"type": "function",
"z": "9295d104.785ef",
"name": "Set Rich Menu to LIFF Demo",
"func": "msg.payload = {\n richMenuId: flow.get(\"richMenuIds\")[\"liff_demo\"]\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1760,
"y": 1320,
"wires": [
[
"84ebd0eb.91e27"
]
]
},
{
"id": "84ebd0eb.91e27",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"ab0f6059.2461a"
],
"x": 1975,
"y": 1320,
"wires": []
},
{
"id": "7936ab7e.2e4134",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"9fac0d93.391a1"
],
"x": 2035,
"y": 1280,
"wires": []
},
{
"id": "9f671005.14b07",
"type": "function",
"z": "9295d104.785ef",
"name": "Set Rich Menu to Flex Demo",
"func": "msg.payload = {\n richMenuId: flow.get(\"richMenuIds\")[\"flex_demo\"]\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1740,
"y": 1500,
"wires": [
[
"94742966.1f2c58"
]
]
},
{
"id": "94742966.1f2c58",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"ab0f6059.2461a"
],
"x": 1915,
"y": 1500,
"wires": []
},
{
"id": "2f3eebf8.0235d4",
"type": "switch",
"z": "9295d104.785ef",
"name": "Flex Messages Demo Action Switch",
"property": "payload.postback.data.action",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "restaurant",
"vt": "str"
},
{
"t": "eq",
"v": "menu",
"vt": "str"
},
{
"t": "eq",
"v": "receipt",
"vt": "str"
},
{
"t": "eq",
"v": "news",
"vt": "str"
},
{
"t": "eq",
"v": "ticket",
"vt": "str"
},
{
"t": "eq",
"v": "catalogue",
"vt": "str"
},
{
"t": "eq",
"v": "home",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 7,
"x": 870,
"y": 1020,
"wires": [
[
"e08e7d1e.46ae8"
],
[
"e8af11e2.b9446"
],
[
"d51de39b.1f416"
],
[
"9af447b7.f07338"
],
[
"9fcea7c2.102318"
],
[
"c75d9a27.b0c988"
],
[]
]
},
{
"id": "9c467f8c.bc7b5",
"type": "comment",
"z": "9295d104.785ef",
"name": "Flex Demo Mode",
"info": "",
"x": 820,
"y": 940,
"wires": []
},
{
"id": "e08e7d1e.46ae8",
"type": "change",
"z": "9295d104.785ef",
"name": "Flex (Restaurant)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"flex\",\"altText\":\"Flex Message Restaurant\",\"contents\":{\"type\":\"bubble\",\"hero\":{\"type\":\"image\",\"url\":\"https://line-objects-dev.com/flex/unsplash/01_1_cafe.png\",\"size\":\"full\",\"aspectRatio\":\"20:13\",\"aspectMode\":\"cover\",\"action\":{\"type\":\"uri\",\"uri\":\"http://linecorp.com/\"}},\"body\":{\"type\":\"box\",\"layout\":\"vertical\",\"contents\":[{\"type\":\"text\",\"text\":\"Brown Cafe\",\"weight\":\"bold\",\"size\":\"xl\"},{\"type\":\"box\",\"layout\":\"baseline\",\"margin\":\"md\",\"contents\":[{\"type\":\"icon\",\"size\":\"sm\",\"url\":\"https://line-objects-dev.com/flex/icon/png/guide_star.png\"},{\"type\":\"icon\",\"size\":\"sm\",\"url\":\"https://line-objects-dev.com/flex/icon/png/guide_star.png\"},{\"type\":\"icon\",\"size\":\"sm\",\"url\":\"https://line-objects-dev.com/flex/icon/png/guide_star.png\"},{\"type\":\"icon\",\"size\":\"sm\",\"url\":\"https://line-objects-dev.com/flex/icon/png/guide_star.png\"},{\"type\":\"icon\",\"size\":\"sm\",\"url\":\"https://line-objects-dev.com/flex/icon/png/guide_star_2.png\"},{\"type\":\"text\",\"text\":\"4.0\",\"size\":\"sm\",\"color\":\"#999999\",\"margin\":\"md\",\"flex\":0}]},{\"type\":\"box\",\"layout\":\"vertical\",\"margin\":\"lg\",\"spacing\":\"sm\",\"contents\":[{\"type\":\"box\",\"layout\":\"baseline\",\"spacing\":\"sm\",\"contents\":[{\"type\":\"text\",\"text\":\"Place\",\"color\":\"#aaaaaa\",\"size\":\"sm\",\"flex\":1},{\"type\":\"text\",\"text\":\"Miraina Tower, 4-1-6 Shinjuku, Tokyo\",\"wrap\":true,\"color\":\"#666666\",\"size\":\"sm\",\"flex\":5}]},{\"type\":\"box\",\"layout\":\"baseline\",\"spacing\":\"sm\",\"contents\":[{\"type\":\"text\",\"text\":\"Time\",\"color\":\"#aaaaaa\",\"size\":\"sm\",\"flex\":1},{\"type\":\"text\",\"text\":\"10:00 - 23:00\",\"wrap\":true,\"color\":\"#666666\",\"size\":\"sm\",\"flex\":5}]}]}]},\"footer\":{\"type\":\"box\",\"layout\":\"vertical\",\"spacing\":\"sm\",\"contents\":[{\"type\":\"button\",\"style\":\"link\",\"height\":\"sm\",\"action\":{\"type\":\"uri\",\"label\":\"CALL\",\"uri\":\"https://linecorp.com\"}},{\"type\":\"button\",\"style\":\"link\",\"height\":\"sm\",\"action\":{\"type\":\"uri\",\"label\":\"WEBSITE\",\"uri\":\"https://linecorp.com\"}},{\"type\":\"spacer\",\"size\":\"sm\"}],\"flex\":0}}}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1290,
"y": 980,
"wires": [
[
"6d895bad.6fe2c4"
]
]
},
{
"id": "6d895bad.6fe2c4",
"type": "link out",
"z": "9295d104.785ef",
"name": "",
"links": [
"9fac0d93.391a1"
],
"x": 1475,
"y": 1080,
"wires": []
},
{
"id": "e8af11e2.b9446",
"type": "change",
"z": "9295d104.785ef",
"name": "Flex (Menu)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"flex\",\"altText\":\"Flex Message Menu\",\"contents\":{\"type\":\"bubble\",\"hero\":{\"type\":\"image\",\"url\":\"https://line-objects-dev.com/flex/unsplash/01_2_restaurant.png\",\"size\":\"full\",\"aspectRatio\":\"20:13\",\"aspectMode\":\"cover\",\"action\":{\"type\":\"uri\",\"uri\":\"https://linecorp.com\"}},\"body\":{\"type\":\"box\",\"layout\":\"vertical\",\"spacing\":\"md\",\"action\":{\"type\":\"uri\",\"uri\":\"https://linecorp.com\"},\"contents\":[{\"type\":\"text\",\"text\":\"Brown's Burger\",\"size\":\"xl\",\"weight\":\"bold\"},{\"type\":\"box\",\"layout\":\"vertical\",\"spacing\":\"sm\",\"contents\":[{\"type\":\"box\",\"layout\":\"baseline\",\"contents\":[{\"type\":\"icon\",\"url\":\"https://line-objects-dev.com/flex/icon/png/guide_regular.png\"},{\"type\":\"text\",\"text\":\"$10.5\",\"weight\":\"bold\",\"margin\":\"sm\",\"flex\":0},{\"type\":\"text\",\"text\":\"400kcl\",\"size\":\"sm\",\"align\":\"end\",\"color\":\"#aaaaaa\"}]},{\"type\":\"box\",\"layout\":\"baseline\",\"contents\":[{\"type\":\"icon\",\"url\":\"https://line-objects-dev.com/flex/icon/png/guide_large.png\"},{\"type\":\"text\",\"text\":\"$15.5\",\"weight\":\"bold\",\"margin\":\"sm\",\"flex\":0},{\"type\":\"text\",\"text\":\"550kcl\",\"size\":\"sm\",\"align\":\"end\",\"color\":\"#aaaaaa\"}]}]},{\"type\":\"text\",\"text\":\"Sauce, Onions, Pickles, Lettuce & Cheese\",\"wrap\":true,\"color\":\"#aaaaaa\",\"size\":\"xxs\"}]},\"footer\":{\"type\":\"box\",\"layout\":\"vertical\",\"contents\":[{\"type\":\"spacer\",\"size\":\"xxl\"},{\"type\":\"button\",\"style\":\"primary\",\"color\":\"#905c44\",\"action\":{\"type\":\"uri\",\"label\":\"Add to Cart\",\"uri\":\"https://linecorp.com\"}}]}}}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1270,
"y": 1020,
"wires": [
[
"6d895bad.6fe2c4"
]
]
},
{
"id": "d51de39b.1f416",
"type": "change",
"z": "9295d104.785ef",
"name": "Flex (Receipt)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"flex\",\"altText\":\"Flex Message Receipt\",\"contents\":{\"type\":\"bubble\",\"styles\":{\"footer\":{\"separator\":true}},\"body\":{\"type\":\"box\",\"layout\":\"vertical\",\"contents\":[{\"type\":\"text\",\"text\":\"RECEIPT\",\"weight\":\"bold\",\"color\":\"#1DB446\",\"size\":\"sm\"},{\"type\":\"text\",\"text\":\"Brown Store\",\"weight\":\"bold\",\"size\":\"xxl\",\"margin\":\"md\"},{\"type\":\"text\",\"text\":\"Miraina Tower, 4-1-6 Shinjuku, Tokyo\",\"size\":\"xs\",\"color\":\"#aaaaaa\",\"wrap\":true},{\"type\":\"separator\",\"margin\":\"xxl\"},{\"type\":\"box\",\"layout\":\"vertical\",\"margin\":\"xxl\",\"spacing\":\"sm\",\"contents\":[{\"type\":\"box\",\"layout\":\"horizontal\",\"contents\":[{\"type\":\"text\",\"text\":\"Energy Drink\",\"margin\":\"md\",\"size\":\"sm\",\"color\":\"#555555\",\"flex\":0},{\"type\":\"text\",\"text\":\"$2.99\",\"size\":\"sm\",\"color\":\"#111111\",\"align\":\"end\"}]},{\"type\":\"box\",\"layout\":\"horizontal\",\"contents\":[{\"type\":\"text\",\"text\":\"Chewing Gum\",\"size\":\"sm\",\"color\":\"#555555\",\"margin\":\"md\",\"flex\":0},{\"type\":\"text\",\"text\":\"$0.99\",\"size\":\"sm\",\"color\":\"#111111\",\"align\":\"end\"}]},{\"type\":\"box\",\"layout\":\"horizontal\",\"contents\":[{\"type\":\"text\",\"text\":\"Bottled Water\",\"size\":\"sm\",\"color\":\"#555555\",\"margin\":\"md\",\"flex\":0},{\"type\":\"text\",\"text\":\"$3.33\",\"size\":\"sm\",\"color\":\"#111111\",\"align\":\"end\"}]},{\"type\":\"separator\",\"margin\":\"xxl\"},{\"type\":\"box\",\"layout\":\"horizontal\",\"margin\":\"xxl\",\"contents\":[{\"type\":\"text\",\"text\":\"ITEMS\",\"size\":\"sm\",\"color\":\"#555555\"},{\"type\":\"text\",\"text\":\"3\",\"size\":\"sm\",\"color\":\"#111111\",\"align\":\"end\"}]},{\"type\":\"box\",\"layout\":\"horizontal\",\"contents\":[{\"type\":\"text\",\"text\":\"TOTAL\",\"size\":\"sm\",\"color\":\"#555555\"},{\"type\":\"text\",\"text\":\"$7.31\",\"size\":\"sm\",\"color\":\"#111111\",\"align\":\"end\"}]},{\"type\":\"box\",\"layout\":\"horizontal\",\"contents\":[{\"type\":\"text\",\"text\":\"CASH\",\"size\":\"sm\",\"color\":\"#555555\"},{\"type\":\"text\",\"text\":\"$8.0\",\"size\":\"sm\",\"color\":\"#111111\",\"align\":\"end\"}]},{\"type\":\"box\",\"layout\":\"horizontal\",\"contents\":[{\"type\":\"text\",\"text\":\"CHANGE\",\"size\":\"sm\",\"color\":\"#555555\"},{\"type\":\"text\",\"text\":\"$0.69\",\"size\":\"sm\",\"color\":\"#111111\",\"align\":\"end\"}]}]},{\"type\":\"separator\",\"margin\":\"xxl\"},{\"type\":\"box\",\"layout\":\"horizontal\",\"margin\":\"md\",\"contents\":[{\"type\":\"text\",\"text\":\"PAYMENT ID\",\"size\":\"xs\",\"color\":\"#aaaaaa\",\"flex\":0},{\"type\":\"text\",\"text\":\"#743289384279\",\"color\":\"#aaaaaa\",\"size\":\"xs\",\"align\":\"end\"}]}]}}}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1280,
"y": 1060,
"wires": [
[
"6d895bad.6fe2c4"
]
]
},
{
"id": "9af447b7.f07338",
"type": "change",
"z": "9295d104.785ef",
"name": "Flex (News)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"flex\",\"altText\":\"Flex Message News\",\"contents\":{\"type\":\"bubble\",\"header\":{\"type\":\"box\",\"layout\":\"horizontal\",\"contents\":[{\"type\":\"text\",\"text\":\"NEWS DIGEST\",\"weight\":\"bold\",\"color\":\"#aaaaaa\",\"size\":\"sm\"}]},\"hero\":{\"type\":\"image\",\"url\":\"https://line-objects-dev.com/flex/unsplash/01_4_news.png\",\"size\":\"full\",\"aspectRatio\":\"20:13\",\"aspectMode\":\"cover\",\"action\":{\"type\":\"uri\",\"uri\":\"http://linecorp.com/\"}},\"body\":{\"type\":\"box\",\"layout\":\"horizontal\",\"spacing\":\"md\",\"contents\":[{\"type\":\"box\",\"layout\":\"vertical\",\"flex\":1,\"contents\":[{\"type\":\"image\",\"url\":\"https://line-objects-dev.com/flex/unsplash/02_1_news_thumbnail_1.png\",\"aspectMode\":\"cover\",\"aspectRatio\":\"4:3\",\"size\":\"sm\",\"gravity\":\"bottom\"},{\"type\":\"image\",\"url\":\"https://line-objects-dev.com/flex/unsplash/02_1_news_thumbnail_2.png\",\"aspectMode\":\"cover\",\"aspectRatio\":\"4:3\",\"margin\":\"md\",\"size\":\"sm\"}]},{\"type\":\"box\",\"layout\":\"vertical\",\"flex\":2,\"contents\":[{\"type\":\"text\",\"text\":\"7 Things to Know for Today\",\"gravity\":\"top\",\"size\":\"xs\",\"flex\":1},{\"type\":\"separator\"},{\"type\":\"text\",\"text\":\"Hay fever goes wild\",\"gravity\":\"center\",\"size\":\"xs\",\"flex\":2},{\"type\":\"separator\"},{\"type\":\"text\",\"text\":\"LINE Pay Begins Barcode Payment Service\",\"gravity\":\"center\",\"size\":\"xs\",\"flex\":2},{\"type\":\"separator\"},{\"type\":\"text\",\"text\":\"LINE Adds LINE Wallet\",\"gravity\":\"bottom\",\"size\":\"xs\",\"flex\":1}]}]},\"footer\":{\"type\":\"box\",\"layout\":\"horizontal\",\"contents\":[{\"type\":\"button\",\"action\":{\"type\":\"uri\",\"label\":\"More\",\"uri\":\"https://linecorp.com\"}}]}}}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1270,
"y": 1100,
"wires": [
[
"6d895bad.6fe2c4"
]
]
},
{
"id": "9fcea7c2.102318",
"type": "change",
"z": "9295d104.785ef",
"name": "Flex (Ticket)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"flex\",\"altText\":\"Flex Message Ticket\",\"contents\":{\"type\":\"bubble\",\"hero\":{\"type\":\"image\",\"url\":\"https://line-objects-dev.com/flex/unsplash/01_3_movie.png\",\"size\":\"full\",\"aspectRatio\":\"20:13\",\"aspectMode\":\"cover\",\"action\":{\"type\":\"uri\",\"uri\":\"http://linecorp.com/\"}},\"body\":{\"type\":\"box\",\"layout\":\"vertical\",\"spacing\":\"md\",\"contents\":[{\"type\":\"text\",\"text\":\"BROWN'S ADVENTURE\\nIN MOVIE\",\"wrap\":true,\"weight\":\"bold\",\"gravity\":\"center\",\"size\":\"xl\"},{\"type\":\"box\",\"layout\":\"baseline\",\"margin\":\"md\",\"contents\":[{\"type\":\"icon\",\"size\":\"sm\",\"url\":\"https://line-objects-dev.com/flex/icon/png/guide_star.png\"},{\"type\":\"icon\",\"size\":\"sm\",\"url\":\"https://line-objects-dev.com/flex/icon/png/guide_star.png\"},{\"type\":\"icon\",\"size\":\"sm\",\"url\":\"https://line-objects-dev.com/flex/icon/png/guide_star.png\"},{\"type\":\"icon\",\"size\":\"sm\",\"url\":\"https://line-objects-dev.com/flex/icon/png/guide_star.png\"},{\"type\":\"icon\",\"size\":\"sm\",\"url\":\"https://line-objects-dev.com/flex/icon/png/guide_star_2.png\"},{\"type\":\"text\",\"text\":\"4.0\",\"size\":\"sm\",\"color\":\"#999999\",\"margin\":\"md\",\"flex\":0}]},{\"type\":\"box\",\"layout\":\"vertical\",\"margin\":\"lg\",\"spacing\":\"sm\",\"contents\":[{\"type\":\"box\",\"layout\":\"baseline\",\"spacing\":\"sm\",\"contents\":[{\"type\":\"text\",\"text\":\"Date\",\"color\":\"#aaaaaa\",\"size\":\"sm\",\"flex\":1},{\"type\":\"text\",\"text\":\"Monday 25, 9:00PM\",\"wrap\":true,\"size\":\"sm\",\"color\":\"#666666\",\"flex\":4}]},{\"type\":\"box\",\"layout\":\"baseline\",\"spacing\":\"sm\",\"contents\":[{\"type\":\"text\",\"text\":\"Place\",\"color\":\"#aaaaaa\",\"size\":\"sm\",\"flex\":1},{\"type\":\"text\",\"text\":\"7 Floor, No.3\",\"wrap\":true,\"color\":\"#666666\",\"size\":\"sm\",\"flex\":4}]},{\"type\":\"box\",\"layout\":\"baseline\",\"spacing\":\"sm\",\"contents\":[{\"type\":\"text\",\"text\":\"Seats\",\"color\":\"#aaaaaa\",\"size\":\"sm\",\"flex\":1},{\"type\":\"text\",\"text\":\"C Row, 18 Seat\",\"wrap\":true,\"color\":\"#666666\",\"size\":\"sm\",\"flex\":4}]}]},{\"type\":\"box\",\"layout\":\"vertical\",\"margin\":\"xxl\",\"contents\":[{\"type\":\"spacer\"},{\"type\":\"image\",\"url\":\"https://line-objects-dev.com/flex/images/linecorp_code_withborder.png\",\"aspectMode\":\"cover\",\"size\":\"xl\"},{\"type\":\"text\",\"text\":\"You can enter the theater by using this code instead of a ticket\",\"color\":\"#aaaaaa\",\"wrap\":true,\"margin\":\"xxl\",\"size\":\"xs\"}]}]}}}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1270,
"y": 1140,
"wires": [
[
"6d895bad.6fe2c4"
]
]
},
{
"id": "c75d9a27.b0c988",
"type": "change",
"z": "9295d104.785ef",
"name": "Flex (Catalogue)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"messages\":[{\"type\":\"flex\",\"altText\":\"Flex Message Catalogue\",\"contents\":{\"type\":\"carousel\",\"contents\":[{\"type\":\"bubble\",\"hero\":{\"type\":\"image\",\"size\":\"full\",\"aspectRatio\":\"20:13\",\"aspectMode\":\"cover\",\"url\":\"https://line-objects-dev.com/flex/unsplash/01_5_carousel.png\"},\"body\":{\"type\":\"box\",\"layout\":\"vertical\",\"spacing\":\"sm\",\"contents\":[{\"type\":\"text\",\"text\":\"Arm Chair, White\",\"wrap\":true,\"weight\":\"bold\",\"size\":\"xl\"},{\"type\":\"box\",\"layout\":\"baseline\",\"contents\":[{\"type\":\"text\",\"text\":\"$49\",\"wrap\":true,\"weight\":\"bold\",\"size\":\"xl\",\"flex\":0},{\"type\":\"text\",\"text\":\".99\",\"wrap\":true,\"weight\":\"bold\",\"size\":\"sm\",\"flex\":0}]}]},\"footer\":{\"type\":\"box\",\"layout\":\"vertical\",\"spacing\":\"sm\",\"contents\":[{\"type\":\"button\",\"style\":\"primary\",\"action\":{\"type\":\"uri\",\"label\":\"Add to Cart\",\"uri\":\"https://linecorp.com\"}},{\"type\":\"button\",\"action\":{\"type\":\"uri\",\"label\":\"Add to wishlist\",\"uri\":\"https://linecorp.com\"}}]}},{\"type\":\"bubble\",\"hero\":{\"type\":\"image\",\"size\":\"full\",\"aspectRatio\":\"20:13\",\"aspectMode\":\"cover\",\"url\":\"https://line-objects-dev.com/flex/unsplash/01_6_carousel.png\"},\"body\":{\"type\":\"box\",\"layout\":\"vertical\",\"spacing\":\"sm\",\"contents\":[{\"type\":\"text\",\"text\":\"Metal Desk Lamp\",\"wrap\":true,\"weight\":\"bold\",\"size\":\"xl\"},{\"type\":\"box\",\"layout\":\"baseline\",\"flex\":1,\"contents\":[{\"type\":\"text\",\"text\":\"$11\",\"wrap\":true,\"weight\":\"bold\",\"size\":\"xl\",\"flex\":0},{\"type\":\"text\",\"text\":\".99\",\"wrap\":true,\"weight\":\"bold\",\"size\":\"sm\",\"flex\":0}]},{\"type\":\"box\",\"layout\":\"baseline\",\"contents\":[{\"type\":\"text\",\"text\":\"Temporarily out of stock\",\"wrap\":true,\"size\":\"xxs\",\"margin\":\"md\",\"color\":\"#ff5551\",\"flex\":0}]}]},\"footer\":{\"type\":\"box\",\"layout\":\"vertical\",\"spacing\":\"sm\",\"contents\":[{\"type\":\"button\",\"flex\":2,\"style\":\"primary\",\"color\":\"#aaaaaa\",\"action\":{\"type\":\"uri\",\"label\":\"Add to Cart\",\"uri\":\"https://linecorp.com\"}},{\"type\":\"button\",\"action\":{\"type\":\"uri\",\"label\":\"Add to wish list\",\"uri\":\"https://linecorp.com\"}}]}},{\"type\":\"bubble\",\"body\":{\"type\":\"box\",\"layout\":\"vertical\",\"spacing\":\"sm\",\"contents\":[{\"type\":\"button\",\"flex\":1,\"gravity\":\"center\",\"action\":{\"type\":\"uri\",\"label\":\"See more\",\"uri\":\"https://linecorp.com\"}}]}}]}}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1289,
"y": 1194,
"wires": [
[
"6d895bad.6fe2c4"
]
]
},
{
"id": "f58362ec.596d3",
"type": "comment",
"z": "9295d104.785ef",
"name": "** = Need to update channel Access Token",
"info": "",
"x": 2350,
"y": 1320,
"wires": []
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment