forked from Ilhasoft/goflow
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from weni-ai/fix/brain-only-send-attachments-w…
…hen-defaults [FLOWS-3006] Fix: brain only send attachments when defaults
- Loading branch information
Showing
4 changed files
with
164 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,128 @@ | ||
[] | ||
[ | ||
{ | ||
"description": "Entry is replaced with default value (@input.text) if empty and attachments are sent", | ||
"action": { | ||
"type": "call_brain", | ||
"uuid": "bd154980-7bf7-4ab8-8728-545fd6378912", | ||
"entry": "" | ||
}, | ||
"http_mocks": { | ||
"http://127.0.0.1:49994/messages?token=token": [ | ||
{ | ||
"status": 200 | ||
} | ||
] | ||
}, | ||
"events": [ | ||
{ | ||
"type": "webhook_called", | ||
"created_on": "2018-10-18T14:20:30.000123456Z", | ||
"step_uuid": "59d74b86-3e2f-4a93-aece-b05d2fdcde0c", | ||
"url": "http://127.0.0.1:49994/messages?token=token", | ||
"status_code": 200, | ||
"status": "success", | ||
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 253\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Hi everybody\",\"contact_urn\":\"tel:+12065551212?channel=57f1078f-88aa-46f4-a59a-948a5739c03d\\u0026id=123\",\"attachments\":[\"image/jpeg:http://http://s3.amazon.com/bucket/test.jpg\",\"audio/mp3:http://s3.amazon.com/bucket/test.mp3\"]}", | ||
"response": "HTTP/1.0 200 OK\r\nContent-Length: 0\r\n\r\n", | ||
"elapsed_ms": 0, | ||
"retries": 0, | ||
"extraction": "none" | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "Attachments are not included if entry is not @input.text", | ||
"action": { | ||
"type": "call_brain", | ||
"uuid": "bd154980-7bf7-4ab8-8728-545fd6378912", | ||
"entry": "Different entry" | ||
}, | ||
"http_mocks": { | ||
"http://127.0.0.1:49994/messages?token=token": [ | ||
{ | ||
"status": 200 | ||
} | ||
] | ||
}, | ||
"events": [ | ||
{ | ||
"type": "webhook_called", | ||
"created_on": "2018-10-18T14:20:30.000123456Z", | ||
"step_uuid": "59d74b86-3e2f-4a93-aece-b05d2fdcde0c", | ||
"url": "http://127.0.0.1:49994/messages?token=token", | ||
"status_code": 200, | ||
"status": "success", | ||
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 151\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Different entry\",\"contact_urn\":\"tel:+12065551212?channel=57f1078f-88aa-46f4-a59a-948a5739c03d\\u0026id=123\",\"attachments\":[]}", | ||
"response": "HTTP/1.0 200 OK\r\nContent-Length: 0\r\n\r\n", | ||
"elapsed_ms": 0, | ||
"retries": 0, | ||
"extraction": "none" | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "Creates error events if service call fails", | ||
"action": { | ||
"type": "call_brain", | ||
"uuid": "bd154980-7bf7-4ab8-8728-545fd6378912", | ||
"entry": "" | ||
}, | ||
"http_mocks": { | ||
"http://127.0.0.1:49994/messages?token=token": [ | ||
{ | ||
"status": 0, | ||
"body": "" | ||
} | ||
] | ||
}, | ||
"events": [ | ||
{ | ||
"created_on": "2018-10-18T14:20:30.000123456Z", | ||
"step_uuid": "59d74b86-3e2f-4a93-aece-b05d2fdcde0c", | ||
"text": "unable to connect to server", | ||
"type": "error" | ||
}, | ||
{ | ||
"type": "webhook_called", | ||
"created_on": "2018-10-18T14:20:30.000123456Z", | ||
"step_uuid": "59d74b86-3e2f-4a93-aece-b05d2fdcde0c", | ||
"url": "http://127.0.0.1:49994/messages?token=token", | ||
"status": "connection_error", | ||
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 253\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Hi everybody\",\"contact_urn\":\"tel:+12065551212?channel=57f1078f-88aa-46f4-a59a-948a5739c03d\\u0026id=123\",\"attachments\":[\"image/jpeg:http://http://s3.amazon.com/bucket/test.jpg\",\"audio/mp3:http://s3.amazon.com/bucket/test.mp3\"]}", | ||
"elapsed_ms": 0, | ||
"retries": 0, | ||
"extraction": "none" | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "Create the webhook event for bad request response", | ||
"action": { | ||
"type": "call_brain", | ||
"uuid": "bd154980-7bf7-4ab8-8728-545fd6378912", | ||
"entry": "" | ||
}, | ||
"http_mocks": { | ||
"http://127.0.0.1:49994/messages?token=token": [ | ||
{ | ||
"status": 400, | ||
"body": "{ \"errors\": [\"bad_request\"] }" | ||
} | ||
] | ||
}, | ||
"events": [ | ||
{ | ||
"type": "webhook_called", | ||
"created_on": "2018-10-18T14:20:30.000123456Z", | ||
"step_uuid": "59d74b86-3e2f-4a93-aece-b05d2fdcde0c", | ||
"url": "http://127.0.0.1:49994/messages?token=token", | ||
"status_code": 400, | ||
"status": "response_error", | ||
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 253\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Hi everybody\",\"contact_urn\":\"tel:+12065551212?channel=57f1078f-88aa-46f4-a59a-948a5739c03d\\u0026id=123\",\"attachments\":[\"image/jpeg:http://http://s3.amazon.com/bucket/test.jpg\",\"audio/mp3:http://s3.amazon.com/bucket/test.mp3\"]}", | ||
"response": "HTTP/1.0 400 Bad Request\r\nContent-Length: 29\r\n\r\n{ \"errors\": [\"bad_request\"] }", | ||
"elapsed_ms": 0, | ||
"retries": 0, | ||
"extraction": "valid" | ||
} | ||
] | ||
} | ||
] |