Watson Conversation with Twitter

Combines Twitter input and output with Watson Conversation. Use Twitter with your chatbot.

[
    {
        "id": "46d9cb.778d1634",
        "type": "watson-conversation-v1",
        "z": "f1222972.dba8d8",
        "name": "",
        "workspaceid": "",
        "multiuser": false,
        "context": true,
        "x": 640,
        "y": 227,
        "wires": [
            [
                "5775b1a4.cd812",
                "10317b1a.994a25"
            ]
        ]
    },
    {
        "id": "7f769d7f.f923e4",
        "type": "twitter in",
        "z": "f1222972.dba8d8",
        "twitter": "",
        "tags": "",
        "user": "false",
        "name": "Twitter Input",
        "topic": "tweets",
        "inputs": 1,
        "x": 220,
        "y": 227,
        "wires": [
            [
                "c3488e5.a85f27",
                "92c4a2af.308ec"
            ]
        ]
    },
    {
        "id": "c3488e5.a85f27",
        "type": "function",
        "z": "f1222972.dba8d8",
        "name": "Prepare input",
        "func": "if (typeof msg.tweet.retweeted_status == 'undefined')\n{\n\tif (typeof msg.tweet.lang != 'undefined')\n    {\n        lang=msg.tweet.lang;\n    }\n\t\n\tvar msg = {\n\t\tuser: msg.tweet.user.screen_name,\n\t\tlang: lang,\n\t\ttweet: msg.tweet.text,\n\t\tpayload: msg.tweet.text\n\t};\n\tflow.set('tweet',msg);\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 451,
        "y": 225,
        "wires": [
            [
                "46d9cb.778d1634"
            ]
        ]
    },
    {
        "id": "8be44abc.899b88",
        "type": "twitter out",
        "z": "f1222972.dba8d8",
        "twitter": "",
        "name": "Twitter output",
        "x": 1101,
        "y": 217,
        "wires": []
    },
    {
        "id": "92c4a2af.308ec",
        "type": "debug",
        "z": "f1222972.dba8d8",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 454,
        "y": 139,
        "wires": []
    },
    {
        "id": "5775b1a4.cd812",
        "type": "debug",
        "z": "f1222972.dba8d8",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 913,
        "y": 299,
        "wires": []
    },
    {
        "id": "10317b1a.994a25",
        "type": "function",
        "z": "f1222972.dba8d8",
        "name": "process result",
        "func": "var tweet=flow.get('tweet');\nmsg.payload=\"@\"+tweet.user+\" \"+msg.payload.output.text+\"    \"+tweet.lang+\" \"+Date.now();\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 869,
        "y": 212,
        "wires": [
            [
                "8be44abc.899b88",
                "94f1ab71.a8fe28"
            ]
        ]
    },
    {
        "id": "94f1ab71.a8fe28",
        "type": "debug",
        "z": "f1222972.dba8d8",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 1055,
        "y": 147,
        "wires": []
    }
]
data-henrik

Flow Info

created 4 months, 1 week ago

Node Types

Core
  • debug (x3)
  • function (x2)
  • twitter in (x1)
  • twitter out (x1)
Other

Tags

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