Skip to content

Commit

Permalink
Merge pull request #93 from weni-ai/fix/urn-brain
Browse files Browse the repository at this point in the history
Using URN identity for brain
  • Loading branch information
Robi9 authored Oct 23, 2024
2 parents 0378302 + 670a2a2 commit a5425f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions flows/actions/testdata/call_brain.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"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\"]}",
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 196\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Hi everybody\",\"contact_urn\":\"tel:+12065551212\",\"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,
Expand Down Expand Up @@ -51,7 +51,7 @@
"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\":[]}",
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 94\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Different entry\",\"contact_urn\":\"tel:+12065551212\",\"attachments\":[]}",
"response": "HTTP/1.0 200 OK\r\nContent-Length: 0\r\n\r\n",
"elapsed_ms": 0,
"retries": 0,
Expand Down Expand Up @@ -87,7 +87,7 @@
"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\"]}",
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 196\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Hi everybody\",\"contact_urn\":\"tel:+12065551212\",\"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"
Expand Down Expand Up @@ -117,7 +117,7 @@
"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\"]}",
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 196\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Hi everybody\",\"contact_urn\":\"tel:+12065551212\",\"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,
Expand Down
10 changes: 5 additions & 5 deletions services/brain/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ func NewService(httpClient *http.Client, httpRetries *httpx.RetryConfig, httpAcc
func (s *service) Call(session flows.Session, projectUUID uuids.UUID, text string, contactURN urns.URN, attachments []utils.Attachment) (*flows.BrainCall, error) {

body := struct {
ProjectUUID uuids.UUID `json:"project_uuid"`
Text string `json:"text"`
ContactURN urns.URN `json:"contact_urn"`
Attachments []utils.Attachment `json:"attachments"`
ProjectUUID uuids.UUID `json:"project_uuid"`
Text string `json:"text"`
ContactURN urns.URN `json:"contact_urn"`
Attachments []utils.Attachment `json:"attachments"`
}{
ProjectUUID: projectUUID,
Text: text,
ContactURN: contactURN,
ContactURN: contactURN.Identity(),
Attachments: attachments,
}

Expand Down

0 comments on commit a5425f0

Please sign in to comment.