Hi All!
Sorry, my english is bad but i try it.
I just met node-red yesterday. Do not swear too much.
Flow -
Task:
- AsteriskServer - curl request to NodeRedServer (curl http://192.168.71.126:1880/nrdtest?phone=7987654321)
- NodeRed - accepted the request and is executing requests to the external system. The result of the requests must be returned in http response node
In my NodeRed query doesn't work. Interrupted by timeout. Tell me what I did wrong or how I can fix it.
[
{
"id": "603351f9.74315",
"type": "tab",
"label": "Поток 1",
"disabled": false,
"info": ""
},
{
"id": "358d891c.696346",
"type": "http in",
"z": "603351f9.74315",
"name": "",
"url": "/nrdtest",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 170,
"y": 1200,
"wires": [
[
"5a4b7e9c.c2a87",
"6ccf5d26.4f5e44"
]
]
},
{
"id": "6ccf5d26.4f5e44",
"type": "template",
"z": "603351f9.74315",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Hi man!\n{{managernum}}",
"output": "str",
"x": 960,
"y": 1200,
"wires": [
[
"1a357b22.244235",
"d6aef389.f5059"
]
]
},
{
"id": "1a357b22.244235",
"type": "http response",
"z": "603351f9.74315",
"name": "",
"statusCode": "",
"headers": {},
"x": 1210,
"y": 1200,
"wires": []
},
{
"id": "5a4b7e9c.c2a87",
"type": "debug",
"z": "603351f9.74315",
"name": "",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 560,
"y": 1140,
"wires": []
},
{
"id": "e76cc0ae.f0b8e",
"type": "change",
"z": "603351f9.74315",
"name": "->$inboundnumber",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "inboundnumber",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 350,
"y": 1440,
"wires": [
[
"198a3811.912ea8",
"b46d2a1b.2f76f8"
]
]
},
{
"id": "198a3811.912ea8",
"type": "http request",
"z": "603351f9.74315",
"name": "Client id?",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "https://site.org/rest/1/AUTHTOKEN/crm.duplicate.findbycomm.json?type=PHONE&values[]={{inboundnumber}}&entity_type=CONTACT",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 540,
"y": 1440,
"wires": [
[
"a096bcbd.3fe02"
]
]
},
{
"id": "a096bcbd.3fe02",
"type": "json",
"z": "603351f9.74315",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 690,
"y": 1440,
"wires": [
[
"fde954d.b2c2fa8"
]
]
},
{
"id": "b46d2a1b.2f76f8",
"type": "template",
"z": "603351f9.74315",
"name": "",
"field": "inboundnumber",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Inbound number is: {{inboundnumber}}",
"output": "str",
"x": 540,
"y": 1400,
"wires": [
[
"a7430d67.c9e01"
]
]
},
{
"id": "a7430d67.c9e01",
"type": "debug",
"z": "603351f9.74315",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "inboundnumber",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 740,
"y": 1400,
"wires": []
},
{
"id": "efc9c3c.966954",
"type": "debug",
"z": "603351f9.74315",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "clientid",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 810,
"y": 1520,
"wires": []
},
{
"id": "fde954d.b2c2fa8",
"type": "function",
"z": "603351f9.74315",
"name": "$clientid",
"func": "var clientid = msg.payload.result.CONTACT[0];\nmsg = { payload:clientid };\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 840,
"y": 1440,
"wires": [
[
"6bba056e.e6738c"
]
]
},
{
"id": "3be46e78.671202",
"type": "http request",
"z": "603351f9.74315",
"name": "Отвественный?",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "https://site.org/rest/1/AUTHTOKEN/crm.contact.get.json?ID={{clientid}}",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 740,
"y": 1560,
"wires": [
[
"e77713a7.0a587"
]
]
},
{
"id": "e77713a7.0a587",
"type": "json",
"z": "603351f9.74315",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 910,
"y": 1560,
"wires": [
[
"99b6cc2b.5d826"
]
]
},
{
"id": "6bba056e.e6738c",
"type": "change",
"z": "603351f9.74315",
"name": "->$clientid",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "clientid",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 310,
"y": 1560,
"wires": [
[
"4358bec6.26588"
]
]
},
{
"id": "99b6cc2b.5d826",
"type": "function",
"z": "603351f9.74315",
"name": "$managerid",
"func": "var managerid = msg.payload.result.ASSIGNED_BY_ID;\nmsg = { payload:managerid };\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 290,
"y": 1720,
"wires": [
[
"b85aba94.f3bb28"
]
]
},
{
"id": "b85aba94.f3bb28",
"type": "change",
"z": "603351f9.74315",
"name": "->$managerid",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "managerid",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 480,
"y": 1720,
"wires": [
[
"c5890abc.0edf68",
"dc067daa.6bbe1"
]
]
},
{
"id": "4358bec6.26588",
"type": "switch",
"z": "603351f9.74315",
"name": "",
"property": "clientid",
"propertyType": "msg",
"rules": [
{
"t": "gt",
"v": "0",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 490,
"y": 1560,
"wires": [
[
"db3bcc40.982f3",
"3be46e78.671202"
],
[]
]
},
{
"id": "db3bcc40.982f3",
"type": "template",
"z": "603351f9.74315",
"name": "",
"field": "clientid",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Client ID is: {{clientid}}",
"output": "str",
"x": 660,
"y": 1520,
"wires": [
[
"efc9c3c.966954"
]
]
},
{
"id": "c5890abc.0edf68",
"type": "http request",
"z": "603351f9.74315",
"name": "Отвественный?",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "https://site.org/rest/1/AUTHTOKEN/user.search.json?ID=1",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 680,
"y": 1720,
"wires": [
[
"d40fcd95.a5f83"
]
]
},
{
"id": "d40fcd95.a5f83",
"type": "json",
"z": "603351f9.74315",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 850,
"y": 1720,
"wires": [
[
"2259f068.9c258"
]
]
},
{
"id": "2259f068.9c258",
"type": "function",
"z": "603351f9.74315",
"name": "$managerinnum",
"func": "var managerinnum = msg.payload.result[0].UF_PHONE_INNER;\nmsg = { payload:managerinnum };\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1020,
"y": 1720,
"wires": [
[
"634b2c57.9552e4"
]
]
},
{
"id": "634b2c57.9552e4",
"type": "change",
"z": "603351f9.74315",
"name": "->$managernum",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "managernum",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1220,
"y": 1720,
"wires": [
[
"6ccf5d26.4f5e44"
]
]
},
{
"id": "dc067daa.6bbe1",
"type": "template",
"z": "603351f9.74315",
"name": "",
"field": "managerid",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Manager ID is: {{managerid}}",
"output": "str",
"x": 660,
"y": 1680,
"wires": [
[
"572cb7d1.6c46b8"
]
]
},
{
"id": "572cb7d1.6c46b8",
"type": "debug",
"z": "603351f9.74315",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "managerid",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 820,
"y": 1680,
"wires": []
},
{
"id": "986bf19d.bea15",
"type": "function",
"z": "603351f9.74315",
"name": "$inboundnumber",
"func": "var inboundnumber = msg.payload.phone;\nmsg = { payload:inboundnumber };\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 310,
"y": 1340,
"wires": [
[
"e76cc0ae.f0b8e"
]
]
},
{
"id": "d6aef389.f5059",
"type": "debug",
"z": "603351f9.74315",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "managernum",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 1270,
"y": 1080,
"wires": []
},
{
"id": "a751e00e.c8c1d",
"type": "http request",
"z": "603351f9.74315",
"name": "",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "http://192.168.71.126:1880/nrdtest/?phone=79253444462",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 950,
"y": 960,
"wires": [
[]
]
},
{
"id": "f9861130.07e0d",
"type": "inject",
"z": "603351f9.74315",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 760,
"y": 960,
"wires": [
[
"a751e00e.c8c1d"
]
]
}
]