[{
    "id": "cf492588.74abd",
    "type": "http in",
    "z": "55373bdd.c98a64",
    "name": "LINE_Webhook[post]",
    "url": "/v1/linewebhook",
    "method": "post",
    "swaggerDoc": "",
    "x": 120,
    "y": 100,
    "wires": [
        ["bf598b84.fcc4f8", "6e6bdc49.b100f4", "1f3bf806.b39c48"]
    ]
}, {
    "id": "51948e01.425df8",
    "type": "http response",
    "z": "55373bdd.c98a64",
    "name": "response_webhook_api",
    "x": 550,
    "y": 100,
    "wires": []
}, {
    "id": "bf598b84.fcc4f8",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "response_none",
    "func": "msg.payload =undefined;\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 340,
    "y": 100,
    "wires": [
        ["51948e01.425df8"]
    ]
}, {
    "id": "6e6bdc49.b100f4",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": false,
    "console": "false",
    "complete": "payload",
    "x": 330,
    "y": 60,
    "wires": []
}, {
    "id": "71768e84.ddd1",
    "type": "comment",
    "z": "55373bdd.c98a64",
    "name": "LINE MSG受信",
    "info": "",
    "x": 100,
    "y": 60,
    "wires": []
}, {
    "id": "1f3bf806.b39c48",
    "type": "switch",
    "z": "55373bdd.c98a64",
    "name": "Talk Type",
    "property": "payload.events[0].source.type",
    "propertyType": "msg",
    "rules": [{
        "t": "eq",
        "v": "user",
        "vt": "str"
    }, {
        "t": "else"
    }],
    "checkall": "false",
    "outputs": 2,
    "x": 120,
    "y": 260,
    "wires": [
        ["3377c219.a94f26"],
        ["6ba06877.71e7f8"]
    ]
}, {
    "id": "6ba06877.71e7f8",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": false,
    "console": "false",
    "complete": "payload",
    "x": 290,
    "y": 280,
    "wires": []
}, {
    "id": "3377c219.a94f26",
    "type": "switch",
    "z": "55373bdd.c98a64",
    "name": "MSG Type",
    "property": "payload.events[0].message.type",
    "propertyType": "msg",
    "rules": [{
        "t": "eq",
        "v": "text",
        "vt": "str"
    }, {
        "t": "else"
    }],
    "checkall": "false",
    "outputs": 2,
    "x": 290,
    "y": 240,
    "wires": [
        ["2d81ee97.9fd0f2"],
        ["58678cb5.6b11f4"]
    ]
}, {
    "id": "58678cb5.6b11f4",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": false,
    "console": "false",
    "complete": "payload",
    "x": 470,
    "y": 260,
    "wires": []
}, {
    "id": "822ed4e.93c4fa8",
    "type": "comment",
    "z": "55373bdd.c98a64",
    "name": "User, Textのみを対象とする",
    "info": "",
    "x": 180,
    "y": 320,
    "wires": []
}, {
    "id": "8453b5fe.b32b7",
    "type": "http request",
    "z": "55373bdd.c98a64",
    "name": "SendMSG",
    "method": "POST",
    "ret": "txt",
    "url": "https://api.line.me/v2/bot/message/multicast",
    "tls": "",
    "x": 1730,
    "y": 500,
    "wires": [
        ["df1695d2.070a9"]
    ]
}, {
    "id": "1c99f3e0.9531bc",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "CreateSendingMSG",
    "func": "var messages =  {\n    \"type\" : \"text\",\n    \"text\" : msg.process.convmessage\n};\n\nvar payload =  {\n    \"to\" : [msg.process._id],\n    \"messages\" : [messages]\n};\n\nmsg.payload = payload;\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 960,
    "y": 500,
    "wires": [
        ["912c5e32.28b528", "96904e54.828ef8"]
    ]
}, {
    "id": "df1695d2.070a9",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": false,
    "console": "false",
    "complete": "payload",
    "x": 1890,
    "y": 500,
    "wires": []
}, {
    "id": "912c5e32.28b528",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": false,
    "console": "false",
    "complete": "payload",
    "x": 1190,
    "y": 440,
    "wires": []
}, {
    "id": "2428bab7.ae02fe",
    "type": "comment",
    "z": "55373bdd.c98a64",
    "name": "LINEへMSGを送信する",
    "info": "",
    "x": 1640,
    "y": 460,
    "wires": []
}, {
    "id": "c1931d01.998f3",
    "type": "comment",
    "z": "55373bdd.c98a64",
    "name": "Conv呼び出し用MSGを作成し呼び出す",
    "info": "",
    "x": 610,
    "y": 400,
    "wires": []
}, {
    "id": "8ec0fb97.81a7a8",
    "type": "watson-conversation-v1",
    "z": "55373bdd.c98a64",
    "name": "",
    "workspaceid": "",
    "multiuser": false,
    "context": false,
    "x": 530,
    "y": 440,
    "wires": [
        ["4e9f8447.98d3b4", "f41a4a02.1c9808", "bc4c0874.89c74"]
    ]
}, {
    "id": "4e9f8447.98d3b4",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": false,
    "console": "false",
    "complete": "payload",
    "x": 710,
    "y": 480,
    "wires": []
}, {
    "id": "41b708a.cee5a78",
    "type": "comment",
    "z": "55373bdd.c98a64",
    "name": "LINE返信MSGを作成する",
    "info": "",
    "x": 970,
    "y": 540,
    "wires": []
}, {
    "id": "96904e54.828ef8",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "CreateSendingHeader",
    "func": "msg.headers = {\n    \"Authorization\":\"Bearer '<<LINE Messaging API の Channel Access Token を入力>>'\",\n    \"Content-type\": \"application/json\",\n};\n\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 1540,
    "y": 500,
    "wires": [
        ["8453b5fe.b32b7"]
    ]
}, {
    "id": "966398c0.3b2a98",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "Set Context",
    "func": "msg.process.convver = msg.payload;\n\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 1130,
    "y": 240,
    "wires": [
        ["8d3ad582.668c5"]
    ]
}, {
    "id": "22afac49.bdc714",
    "type": "comment",
    "z": "55373bdd.c98a64",
    "name": "その他の場合",
    "info": "",
    "x": 1190,
    "y": 200,
    "wires": []
}, {
    "id": "e13b6c5b.4b7578",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "NonContext",
    "func": "var context;\n\nvar payload =  {\n    \"_id\" : msg.process._id,\n    \"context\" : context\n};\n\nmsg.payload = payload;\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 1090,
    "y": 140,
    "wires": [
        ["966398c0.3b2a98"]
    ]
}, {
    "id": "50b96d0a.7a9874",
    "type": "comment",
    "z": "55373bdd.c98a64",
    "name": "ConvのContextがない場合",
    "info": "",
    "x": 1130,
    "y": 100,
    "wires": []
}, {
    "id": "81f07f8.644b58",
    "type": "switch",
    "z": "55373bdd.c98a64",
    "name": "",
    "property": "payload",
    "propertyType": "msg",
    "rules": [{
        "t": "null"
    }, {
        "t": "else"
    }],
    "checkall": "true",
    "outputs": 2,
    "x": 950,
    "y": 220,
    "wires": [
        ["e13b6c5b.4b7578"],
        ["966398c0.3b2a98"]
    ]
}, {
    "id": "f6cd4517.45e9a8",
    "type": "cloudant in",
    "z": "55373bdd.c98a64",
    "name": "SelectVar",
    "cloudant": "",
    "database": "shbdb",
    "service": "KSWatsonSummitLine-cloudantNoSQLDB",
    "search": "_id_",
    "design": "",
    "index": "",
    "x": 820,
    "y": 220,
    "wires": [
        ["81f07f8.644b58"]
    ]
}, {
    "id": "97187a69.ed3d88",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "CreateSelectMSG",
    "func": "var payload =  {\n    \"_id\" : msg.process._id\n};\n\nmsg.payload = payload;\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 650,
    "y": 220,
    "wires": [
        ["f6cd4517.45e9a8"]
    ]
}, {
    "id": "2d81ee97.9fd0f2",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "initProcMSG",
    "func": "var convver;\n\nmsg.process =  {\n    \"inputpayload\" :  msg.payload.events[0],\n    \"_id\" : msg.payload.events[0].source.userId,\n    \"convver\" : convver,\n    \"convmessage\" : \"\"\n};\n\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 470,
    "y": 220,
    "wires": [
        ["97187a69.ed3d88"]
    ]
}, {
    "id": "50152d25.4f2fcc",
    "type": "comment",
    "z": "55373bdd.c98a64",
    "name": "ConvのContextが保持されているか確認する",
    "info": "",
    "x": 750,
    "y": 260,
    "wires": []
}, {
    "id": "8d3ad582.668c5",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "CreateConvMSG",
    "func": "var params = {\n    \"context\" : msg.process.convver.context\n};\n\nvar message = msg.process.inputpayload.message.text;\n\nmsg.params = params;\nmsg.payload = message;\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 330,
    "y": 440,
    "wires": [
        ["8ec0fb97.81a7a8", "3155b0a.a8c94d"]
    ]
}, {
    "id": "f41a4a02.1c9808",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "CreateInsertMSG",
    "func": "msg.process.convmessage = msg.payload.output.text[0];\n\nmsg.process.convver.context = msg.payload.context;\nmsg.payload = msg.process.convver;\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 730,
    "y": 440,
    "wires": [
        ["2676461b.7583fa", "1c99f3e0.9531bc"]
    ]
}, {
    "id": "2676461b.7583fa",
    "type": "cloudant out",
    "z": "55373bdd.c98a64",
    "name": "StoreVar",
    "cloudant": "",
    "database": "shbdb",
    "service": "KSWatsonSummitLine-cloudantNoSQLDB",
    "payonly": true,
    "operation": "insert",
    "x": 920,
    "y": 440,
    "wires": []
}, {
    "id": "3280a089.3abfd",
    "type": "comment",
    "z": "55373bdd.c98a64",
    "name": "ConvのContextを保存する",
    "info": "",
    "x": 970,
    "y": 400,
    "wires": []
}, {
    "id": "b905c507.83125",
    "type": "cloudant in",
    "z": "55373bdd.c98a64",
    "name": "SelectALL",
    "cloudant": "",
    "database": "shbdb",
    "service": "KSWatsonSummitLine-cloudantNoSQLDB",
    "search": "_all_",
    "design": "",
    "index": "",
    "x": 550,
    "y": 1140,
    "wires": [
        ["6d3def3d.5d54c", "c7d73b24.67593"]
    ]
}, {
    "id": "c7d73b24.67593",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "Results",
    "func": "msg.process2 = {\n    \"i\" : -1,\n    \"responserows\" : msg.payload,\n    \"loopswich\" : 0,\n    \"userid\" : []\n};\n\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 700,
    "y": 1140,
    "wires": [
        ["10e79af3.01950d"]
    ]
}, {
    "id": "10e79af3.01950d",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "LoopCheck",
    "func": "if ((msg.process2.i + 1) < msg.process2.responserows.length) {\n    msg.process2.i = msg.process2.i + 1;\n} else {\n    msg.process2.loopswich = 1;\n}\n\nreturn msg;\n",
    "outputs": 1,
    "noerr": 0,
    "x": 870,
    "y": 1140,
    "wires": [
        ["f853f07e.0e41e"]
    ]
}, {
    "id": "f853f07e.0e41e",
    "type": "switch",
    "z": "55373bdd.c98a64",
    "name": "",
    "property": "process2.loopswich",
    "propertyType": "msg",
    "rules": [{
        "t": "eq",
        "v": "0",
        "vt": "str"
    }, {
        "t": "eq",
        "v": "1",
        "vt": "str"
    }],
    "checkall": "false",
    "outputs": 2,
    "x": 1010,
    "y": 1140,
    "wires": [
        ["70b963c3.4011cc"],
        ["217f553a.1bcf6a"]
    ]
}, {
    "id": "70b963c3.4011cc",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "GetResponseRow",
    "func": "msg.process =  {\n    \"pushflag\" : msg.process.pushflag,\n    \"_id\" : msg.process2.responserows[msg.process2.i]._id,\n    \"convver\" : {\n        \"_id\" : msg.process2.responserows[msg.process2.i]._id,\n        \"_rev\" : msg.process2.responserows[msg.process2.i]._rev,\n        \"context\" : {\n            \"pushflag\" : msg.process.pushflag\n        }\n    },\n    \"convmessage\" : \"\",\n    \"inputpayload\" : {\n        \"message\" : {\n            \"text\" : \"A\"\n        }\n    }\n};\n\n\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 930,
    "y": 1080,
    "wires": [
        ["10e79af3.01950d", "44e8783d.b8043", "8d3ad582.668c5"]
    ]
}, {
    "id": "6d3def3d.5d54c",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": false,
    "console": "false",
    "complete": "payload",
    "x": 710,
    "y": 1180,
    "wires": []
}, {
    "id": "e07818d4.8fc74",
    "type": "comment",
    "z": "55373bdd.c98a64",
    "name": "送信先を取得する",
    "info": "",
    "x": 570,
    "y": 1100,
    "wires": []
}, {
    "id": "787c1d4c.ade86c",
    "type": "inject",
    "z": "55373bdd.c98a64",
    "name": "出社",
    "topic": "",
    "payload": "",
    "payloadType": "date",
    "repeat": "",
    "crontab": "",
    "once": false,
    "x": 90,
    "y": 1100,
    "wires": [
        ["99ae9585.65c12"]
    ]
}, {
    "id": "3155b0a.a8c94d",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": false,
    "console": "false",
    "complete": "true",
    "x": 510,
    "y": 480,
    "wires": []
}, {
    "id": "217f553a.1bcf6a",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": false,
    "console": "false",
    "complete": "payload",
    "x": 1170,
    "y": 1140,
    "wires": []
}, {
    "id": "99ae9585.65c12",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "initProcMSG",
    "func": "msg.process =  {\n    \"pushflag\" : 1\n};\n\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 250,
    "y": 1100,
    "wires": [
        ["b905c507.83125"]
    ]
}, {
    "id": "44e8783d.b8043",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": false,
    "console": "false",
    "complete": "process",
    "x": 1170,
    "y": 1100,
    "wires": []
}, {
    "id": "645dd539.81d41c",
    "type": "inject",
    "z": "55373bdd.c98a64",
    "name": "退社",
    "topic": "",
    "payload": "",
    "payloadType": "date",
    "repeat": "",
    "crontab": "",
    "once": false,
    "x": 90,
    "y": 1160,
    "wires": [
        ["3dbec529.84333a"]
    ]
}, {
    "id": "3dbec529.84333a",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "initProcMSG",
    "func": "msg.process =  {\n    \"pushflag\" : 2\n};\n\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 250,
    "y": 1160,
    "wires": [
        ["b905c507.83125"]
    ]
}, {
    "id": "6db4a1cb.5da7c8",
    "type": "Aggregator",
    "z": "55373bdd.c98a64",
    "name": "",
    "aggregations": "4",
    "x": 1950,
    "y": 720,
    "wires": [
        ["a832133d.5ecf3"]
    ]
}, {
    "id": "d1fe346.8410e48",
    "type": "switch",
    "z": "55373bdd.c98a64",
    "name": "toneFlag",
    "property": "payload.context.tonefrag",
    "propertyType": "msg",
    "rules": [{
        "t": "true"
    }, {
        "t": "else"
    }],
    "checkall": "true",
    "outputs": 2,
    "x": 740,
    "y": 620,
    "wires": [
        ["a9ea6db5.9efe7"],
        ["fe814b55.f24428", "82a05d49.6c0fc"]
    ]
}, {
    "id": "bc4c0874.89c74",
    "type": "switch",
    "z": "55373bdd.c98a64",
    "name": "aggrFlag",
    "property": "payload.context.aggrfrag",
    "propertyType": "msg",
    "rules": [{
        "t": "true"
    }, {
        "t": "else"
    }],
    "checkall": "true",
    "outputs": 2,
    "x": 580,
    "y": 620,
    "wires": [
        ["d1fe346.8410e48"],
        ["188cdaa.68c9ea5"]
    ]
}, {
    "id": "188cdaa.68c9ea5",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": false,
    "console": "false",
    "complete": "payload",
    "x": 610,
    "y": 680,
    "wires": []
}, {
    "id": "7baa43a4.a0c06c",
    "type": "watson-translator",
    "z": "55373bdd.c98a64",
    "name": "",
    "action": "translate",
    "basemodel": "ar-en",
    "domain": "news",
    "srclang": "ja",
    "destlang": "en",
    "password": "4eoV7zHVunjf",
    "custom": "",
    "domainhidden": "news",
    "srclanghidden": "ja",
    "destlanghidden": "en",
    "basemodelhidden": "ar-en",
    "customhidden": "",
    "filetype": "forcedglossary",
    "trainid": "",
    "lgparams2": true,
    "ldparamshidden2": "true",
    "x": 1050,
    "y": 600,
    "wires": [
        ["55df10b1.43313"]
    ]
}, {
    "id": "55df10b1.43313",
    "type": "watson-tone-analyzer-v3",
    "z": "55373bdd.c98a64",
    "name": "",
    "tones": "emotion",
    "sentences": "true",
    "contentType": "false",
    "x": 1240,
    "y": 600,
    "wires": [
        ["29c17ba9.658ce4", "d59cd58d.574a"]
    ]
}, {
    "id": "a9ea6db5.9efe7",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "",
    "func": "var message = msg.process.inputpayload.message.text;\nmsg.payload = message;\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 890,
    "y": 600,
    "wires": [
        ["7baa43a4.a0c06c"]
    ]
}, {
    "id": "fe814b55.f24428",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": false,
    "console": "false",
    "complete": "payload",
    "x": 790,
    "y": 740,
    "wires": []
}, {
    "id": "29c17ba9.658ce4",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": false,
    "console": "false",
    "complete": "true",
    "x": 1410,
    "y": 560,
    "wires": []
}, {
    "id": "82a05d49.6c0fc",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "",
    "func": "var myPayload = {\n    \"message\" : msg.process.inputpayload.message.text,\n};\n\nmsg.payload = myPayload;\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 890,
    "y": 680,
    "wires": [
        ["1650cfb9.2641d8"]
    ]
}, {
    "id": "d59cd58d.574a",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "",
    "func": "var tempTones = msg.response.document_tone.tone_categories[0].tones;\n\nvar tones = {\n    \"anger\" : 0.0,\n    \"disgust\" : 0.0,\n    \"fear\" : 0.0,\n    \"joy\" : 0.0,\n    \"sadness\" : 0.0,\n    \"packageId\" : \"2\",\n    \"stickerId\" : \"143\"\n};\n\nvar myToneScore = 0;\n\nfor (var i = 0; i < tempTones.length; i++) {\n    if (tempTones[i].tone_id === \"anger\") {\n        tones.anger = tempTones[i].score;\n        if (myToneScore < tempTones[i].score) {\n            myToneScore = tempTones[i].score;\n            tones.packageId = \"2\";\n            tones.stickerId = \"19\";\n        }\n    } else if (tempTones[i].tone_id === \"disgust\") {\n        tones.disgust = tempTones[i].score;\n        if (myToneScore < tempTones[i].score) {\n            myToneScore = tempTones[i].score;\n            tones.packageId = \"2\";\n            tones.stickerId = \"152\";\n        }\n    } else if (tempTones[i].tone_id === \"fear\") {\n        tones.fear = tempTones[i].score;\n        if (myToneScore < tempTones[i].score) {\n            myToneScore = tempTones[i].score;\n            tones.packageId = \"2\";\n            tones.stickerId = \"515\";\n        }\n    } else if (tempTones[i].tone_id === \"joy\") {\n        tones.joy = tempTones[i].score;\n        if (myToneScore < tempTones[i].score) {\n            myToneScore = tempTones[i].score;\n            tones.packageId = \"2\";\n            tones.stickerId = \"144\";\n        }\n    } else if (tempTones[i].tone_id === \"sadness\") {\n        tones.sadness = tempTones[i].score;\n        if (myToneScore < tempTones[i].score) {\n            myToneScore = tempTones[i].score;\n            tones.packageId = \"2\";\n            tones.stickerId = \"174\";\n        }\n    }\n}\n\nvar myPayload = {\n    \"message\" : msg.process.inputpayload.message.text,\n    \"tones\" : tones\n};\n\nmsg.payload = myPayload;\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 1410,
    "y": 640,
    "wires": [
        ["1650cfb9.2641d8", "65a6b5f8.a510e4"]
    ]
}, {
    "id": "fe51bb37.e9a9f8",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "CorrelId発行",
    "func": "msg.CorrelId = \"1_\" + msg.process._id;\n\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 1790,
    "y": 720,
    "wires": [
        ["6db4a1cb.5da7c8"]
    ]
}, {
    "id": "f4867747.89a49",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": true,
    "console": "false",
    "complete": "payload",
    "x": 2250,
    "y": 640,
    "wires": []
}, {
    "id": "a832133d.5ecf3",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "",
    "func": "var myText = \"xxxさんの今日の予定\\n\";\nmyText = myText + \"予定：\";\nmyText = myText + msg.payload[3].message + \"\\n\";\nmyText = myText + \"出社時間：\";\nmyText = myText + msg.payload[2].message + \"\\n\";\nmyText = myText + \"退社予定時間：\";\nmyText = myText + msg.payload[1].message + \"\\n\";\nmyText = myText + \"言いたいこと：\";\nmyText = myText + msg.payload[0].message;\n\n\nvar myTones = \"xxxさんの今の感情\\n\";\nmyTones = myTones + \"怒り = \" + msg.payload[0].tones.anger + \"\\n\";\nmyTones = myTones + \"嫌悪 = \" + msg.payload[0].tones.disgust + \"\\n\";\nmyTones = myTones + \"恐れ = \" + msg.payload[0].tones.fear + \"\\n\";\nmyTones = myTones + \"喜び = \" + msg.payload[0].tones.joy + \"\\n\";\nmyTones = myTones + \"悲しみ = \" + msg.payload[0].tones.sadness;\n\nvar myPayload = {\n    \"message\" : myText,\n    \"tones\" : myTones,\n    \"packageId\" : msg.payload[0].tones.packageId,\n    \"stickerId\" : msg.payload[0].tones.stickerId\n};\n\nmsg.payload = myPayload;\n\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 2090,
    "y": 720,
    "wires": [
        ["f4867747.89a49", "787867d6.aed298"]
    ]
}, {
    "id": "1650cfb9.2641d8",
    "type": "switch",
    "z": "55373bdd.c98a64",
    "name": "",
    "property": "process.convver.context.pushflag",
    "propertyType": "msg",
    "rules": [{
        "t": "eq",
        "v": "1",
        "vt": "num"
    }, {
        "t": "eq",
        "v": "2",
        "vt": "num"
    }],
    "checkall": "true",
    "outputs": 2,
    "x": 1590,
    "y": 780,
    "wires": [
        ["fe51bb37.e9a9f8"],
        ["3ad69624.ba412a"]
    ]
}, {
    "id": "3f781cdb.b11a44",
    "type": "Aggregator",
    "z": "55373bdd.c98a64",
    "name": "",
    "aggregations": "5",
    "x": 1950,
    "y": 840,
    "wires": [
        ["9186b684.7e1ae8"]
    ]
}, {
    "id": "3ad69624.ba412a",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "CorrelId発行",
    "func": "msg.CorrelId = \"2_\" + msg.process._id;\n\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 1790,
    "y": 840,
    "wires": [
        ["3f781cdb.b11a44"]
    ]
}, {
    "id": "8ce0eba4.39fb68",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": true,
    "console": "false",
    "complete": "payload",
    "x": 2250,
    "y": 920,
    "wires": []
}, {
    "id": "9186b684.7e1ae8",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "",
    "func": "var myText = \"xxxさんは帰りました。\\n\";\nmyText = myText + \"楽しかったか：\";\nmyText = myText + msg.payload[4].message + \"\\n\";\nmyText = myText + \"出来なかったこと：\";\nmyText = myText + msg.payload[3].message + \"\\n\";\nmyText = myText + \"退社時間：\";\nmyText = myText + msg.payload[2].message + \"\\n\";\nmyText = myText + \"残業理由：\";\nmyText = myText + msg.payload[1].message + \"\\n\";\nmyText = myText + \"連絡事項：\";\nmyText = myText + msg.payload[0].message;\n\n\nvar myTones = \"xxxさんの今の感情\\n\";\nmyTones = myTones + \"怒り = \" + msg.payload[4].tones.anger + \"\\n\";\nmyTones = myTones + \"嫌悪 = \" + msg.payload[4].tones.disgust + \"\\n\";\nmyTones = myTones + \"恐れ = \" + msg.payload[4].tones.fear + \"\\n\";\nmyTones = myTones + \"喜び = \" + msg.payload[4].tones.joy + \"\\n\";\nmyTones = myTones + \"悲しみ = \" + msg.payload[4].tones.sadness;\n\nvar myPayload = {\n    \"message\" : myText,\n    \"tones\" : myTones,\n    \"packageId\" : msg.payload[4].tones.packageId,\n    \"stickerId\" : msg.payload[4].tones.stickerId\n};\n\nmsg.payload = myPayload;\n\nmsg.payload = myPayload;\n\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 2090,
    "y": 840,
    "wires": [
        ["8ce0eba4.39fb68", "787867d6.aed298"]
    ]
}, {
    "id": "43a99ad5.c3eb54",
    "type": "http request",
    "z": "55373bdd.c98a64",
    "name": "SendMSG",
    "method": "POST",
    "ret": "txt",
    "url": "https://api.line.me/v2/bot/message/push",
    "tls": "",
    "x": 2470,
    "y": 780,
    "wires": [
        ["e638039a.78aa"]
    ]
}, {
    "id": "e638039a.78aa",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": true,
    "console": "false",
    "complete": "payload",
    "x": 2630,
    "y": 780,
    "wires": []
}, {
    "id": "2abaf852.e3e58",
    "type": "comment",
    "z": "55373bdd.c98a64",
    "name": "LINEへMSGを送信する",
    "info": "",
    "x": 2380,
    "y": 740,
    "wires": []
}, {
    "id": "787867d6.aed298",
    "type": "function",
    "z": "55373bdd.c98a64",
    "name": "CreateSendingHeader",
    "func": "msg.headers = {\n    \"Authorization\":\"Bearer '<<LINE Messaging API の Channel Access Token を入力>>'\",\n    \"Content-type\": \"application/json\",\n};\n\nvar messages = [];\n\nvar msg1 =  {\n    \"type\" : \"text\",\n    \"text\" : msg.payload.message\n};\nmessages.push(msg1);\n\nvar msg2 =  {\n    \"type\" : \"text\",\n    \"text\" : msg.payload.tones\n};\nmessages.push(msg2);\n\nvar msg3 =  {\n    \"type\": \"sticker\",\n    \"packageId\": msg.payload.packageId,\n    \"stickerId\": msg.payload.stickerId\n};\nmessages.push(msg3);\n\nvar payload =  {\n    \"to\" : \"<<メッセージを投稿するグループのIDを入力>>\",\n    \"messages\" : messages\n};\n\nmsg.payload = payload;\n\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 2280,
    "y": 780,
    "wires": [
        ["43a99ad5.c3eb54"]
    ]
}, {
    "id": "65a6b5f8.a510e4",
    "type": "debug",
    "z": "55373bdd.c98a64",
    "name": "",
    "active": true,
    "console": "false",
    "complete": "payload",
    "x": 1590,
    "y": 560,
    "wires": []
}]
