Skip to content

Instantly share code, notes, and snippets.

@tomsato
Last active March 7, 2018 14:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomsato/855f23d57a689743bbd0336cf467087d to your computer and use it in GitHub Desktop.
Save tomsato/855f23d57a689743bbd0336cf467087d to your computer and use it in GitHub Desktop.
[
{
"id": "4bbe1766.c798e8",
"type": "http in",
"z": "ad5c5270.4dd64",
"name": "POST sample ",
"url": "/sample",
"method": "post",
"upload": false,
"swaggerDoc": "",
"x": 80.75,
"y": 46.5,
"wires": [
[
"3cf75f58.91db7"
]
]
},
{
"id": "3cf75f58.91db7",
"type": "function",
"z": "ad5c5270.4dd64",
"name": "Watson Conversationを使うための準備",
"func": "var event = msg.payload[\"events\"][0];\n\nmsg.replyToken = event[\"replyToken\"];\nmsg.payload = event[\"message\"][\"text\"];\nmsg.params = {};\nmsg.params.workspace_id =\"XXXXXXXXX\"\nmsg.params.username = \"XXXXXXXXX\"\nmsg.params.password = \"XXXXXXXXX\"\nmsg.params.endpoint = \"https://gateway.watsonplatform.net/conversation/api\"\n\nreturn msg",
"outputs": 1,
"noerr": 0,
"x": 342.75,
"y": 46.5,
"wires": [
[
"15a5fee8.344aa1"
]
]
},
{
"id": "3f3dbe5c.1fb842",
"type": "http request",
"z": "ad5c5270.4dd64",
"name": "LINE REPLY API実行",
"method": "POST",
"ret": "txt",
"url": "https://api.line.me/v2/bot/message/reply",
"tls": "",
"x": 147.75,
"y": 259.5,
"wires": [
[
"f38c051a.28ed38"
]
]
},
{
"id": "f38c051a.28ed38",
"type": "debug",
"z": "ad5c5270.4dd64",
"name": "APIリクエスト結果表示",
"active": true,
"console": "false",
"complete": "payload",
"x": 415.75,
"y": 259.5,
"wires": []
},
{
"id": "15a5fee8.344aa1",
"type": "watson-conversation-v1",
"z": "ad5c5270.4dd64",
"name": "Watson Conversation",
"workspaceid": "",
"multiuser": false,
"context": true,
"default-endpoint": true,
"service-endpoint": "https://gateway.watsonplatform.net/conversation/api",
"x": 145.5,
"y": 154,
"wires": [
[
"1ab36cb.4ac2a93"
]
]
},
{
"id": "1ab36cb.4ac2a93",
"type": "function",
"z": "ad5c5270.4dd64",
"name": "LINE Messaging APIを叩いて返信するための準備",
"func": "var messageText = msg.payload.output.text[0];\n\nmsg.payload = {\"messages\": [{\"type\": \"text\", \"text\": messageText}], \"replyToken\": msg.replyToken};\nmsg.headers ={ \"Content-Type\": \"application/json\", \"Authorization\": \"Bearer XXXXXXXXXX\"};\nreturn msg",
"outputs": 1,
"noerr": 0,
"x": 494,
"y": 154,
"wires": [
[
"3f3dbe5c.1fb842"
]
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment