I've written a webhook script for PipeDrive which converts the requests payload (json) into a valid rocket.chat message.
The problem I'm running into is the following:
As soon as there's an array in the json payload, the payload is missing half of it's content (cut of after the array).
Server Setup Information:
Version of Rocket.Chat Server: 0.64.1
Operating System: Ubuntu 16.04.3 LTS
Deployment Method(snap/docker/tar/etc): tar
Number of Running Instances: 4
DB Replicaset Oplog: yes
Node Version: 8.9.4
mongoDB Version: 3.6
Steps to Reproduce:
Paste Payload 1 into a file and call it whatever.json
Create a new webhook and use the pipedrive script as a custom script
Use CURL to send Payload 1 to the created webhook
Repeat step 1 and 3 with Payload 2 (works, without any arrays in it)
Expected behavior:
Payload (JSON) should be 1 to 1 in the requests content.
Description:
I've written a webhook script for PipeDrive which converts the requests payload (json) into a valid rocket.chat message.
The problem I'm running into is the following: As soon as there's an array in the json payload, the payload is missing half of it's content (cut of after the array).
Server Setup Information:
Steps to Reproduce:
Expected behavior:
Payload (JSON) should be 1 to 1 in the requests content.
Actual behavior:
Payload is cutted after the first array.
Console.log:
{"{\r\n\t\"v\": 1,\r\n\t\"meta\": {\r\n\t \"v\": 1,\r\n\t \"action\": \"updated\",\r\n\t \"object\": \"person\",\r\n\t \"id\": 9,\r\n\t \"company_id\": 9,\r\n\t \"user_id\": 9,\r\n\t \"host\": \"company.pipedrive.com\",\r\n\t \"timestamp\": 1525983674,\r\n\t \"timestamp_micro\": 1525983674999300,\r\n\t \"permitted_user_ids\": ":{"\r\n\t\t4754231\r\n\t ":{"\r\n\t\t{\r\n\t\t \"label\": \"work\",\r\n\t\t \"value\": \"666\",\r\n\t\t \"primary\": true\r\n\t\t}\r\n\t ":{"\r\n\t\t{\r\n\t\t \"label\": \"work\",\r\n\t\t \"value\": \"kaismail\",\r\n\t\t \"primary\": true\r\n\t\t}\r\n\t ":{"\r\n\t\t{\r\n\t\t \"label\": \"work\",\r\n\t\t \"value\": \"666\",\r\n\t\t \"primary\": true\r\n\t\t}\r\n\t ":{"\r\n\t\t{\r\n\t\t \"label\": \"work\",\r\n\t\t \"value\": \"kaismail\",\r\n\t\t \"primary\": true\r\n\t\t}\r\n\t ":""}}}}}}
Relevant logs:
Payload 1: https://gist.github.com/kaiiiiiiiii/c3b65ae5ab3363ad803e6c54fddf7f91
Payload 2 (works, without any arrays in it): https://gist.github.com/kaiiiiiiiii/a73c49236da2c0b73ad0b76a646c3af9
PipeDrive Script (I removed most of the logic for this test): https://gist.github.com/kaiiiiiiiii/d4ea07684d8e2445bf49c7090b95cce9
CURL Command:
curl -X POST -H 'Content-Type:application/json' --data-binary "@PATH_TO_FILE.json" https://url/hooks/...