Update chat requests

This commit is contained in:
2026-03-11 08:38:48 -06:00
parent 8cb80d8ada
commit 26ba6e3695

View File

@@ -2363,7 +2363,12 @@
], ],
"body": { "body": {
"mode": "raw", "mode": "raw",
"raw": "{\n \"message\": \"I need help\"\n}" "raw": "{\n \"message\": \"I need help\"\n}",
"options": {
"raw": {
"language": "json"
}
}
} }
}, },
"event": [ "event": [
@@ -2376,14 +2381,46 @@
" pm.response.to.have.status(201);", " pm.response.to.have.status(201);",
"});", "});",
"var jsonData = pm.response.json();", "var jsonData = pm.response.json();",
"if (jsonData.id !== undefined) pm.collectionVariables.set('conversationId', jsonData.id);" "pm.expect(jsonData.id).to.exist;",
"pm.collectionVariables.set('conversationId', jsonData.id);"
] ]
} }
} }
] ]
}, },
{ {
"name": "List Conversations", "name": "Customer List Conversations",
"request": {
"method": "GET",
"url": "{{baseUrl}}/api/v1/chat/conversations",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{customerToken}}",
"type": "text"
}
]
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status code is 200', function () {",
" pm.response.to.have.status(200);",
"});"
]
}
}
]
},
{
"name": "Staff List Conversations",
"request": { "request": {
"method": "GET", "method": "GET",
"url": "{{baseUrl}}/api/v1/chat/conversations", "url": "{{baseUrl}}/api/v1/chat/conversations",
@@ -2445,7 +2482,80 @@
] ]
}, },
{ {
"name": "Send Message", "name": "Customer Request Human",
"request": {
"method": "POST",
"url": "{{baseUrl}}/api/v1/chat/conversations/{{conversationId}}/request-human",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{customerToken}}",
"type": "text"
}
]
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status code is 200', function () {",
" pm.response.to.have.status(200);",
"});",
"var jsonData = pm.response.json();",
"pm.expect(jsonData.mode).to.eql('AUTOMATED');"
]
}
}
]
},
{
"name": "Customer Send Message",
"request": {
"method": "POST",
"url": "{{baseUrl}}/api/v1/chat/conversations/{{conversationId}}/messages",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{customerToken}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"content\": \"Customer follow-up from Postman\"\n}",
"options": {
"raw": {
"language": "json"
}
}
}
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status code is 201', function () {",
" pm.response.to.have.status(201);",
"});"
]
}
}
]
},
{
"name": "Staff Send Message",
"request": { "request": {
"method": "POST", "method": "POST",
"url": "{{baseUrl}}/api/v1/chat/conversations/{{conversationId}}/messages", "url": "{{baseUrl}}/api/v1/chat/conversations/{{conversationId}}/messages",
@@ -2478,14 +2588,16 @@
"exec": [ "exec": [
"pm.test('Status code is 201', function () {", "pm.test('Status code is 201', function () {",
" pm.response.to.have.status(201);", " pm.response.to.have.status(201);",
"});" "});",
"var jsonData = pm.response.json();",
"pm.expect(jsonData.senderRole).to.eql('STAFF');"
] ]
} }
} }
] ]
}, },
{ {
"name": "Get Messages", "name": "Customer Get Messages",
"request": { "request": {
"method": "GET", "method": "GET",
"url": "{{baseUrl}}/api/v1/chat/conversations/{{conversationId}}/messages", "url": "{{baseUrl}}/api/v1/chat/conversations/{{conversationId}}/messages",
@@ -2509,7 +2621,42 @@
"exec": [ "exec": [
"pm.test('Status code is 200', function () {", "pm.test('Status code is 200', function () {",
" pm.response.to.have.status(200);", " pm.response.to.have.status(200);",
"});" "});",
"var jsonData = pm.response.json();",
"pm.expect(jsonData.length).to.be.above(0);"
]
}
}
]
},
{
"name": "Staff Get Messages",
"request": {
"method": "GET",
"url": "{{baseUrl}}/api/v1/chat/conversations/{{conversationId}}/messages",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{staffToken}}",
"type": "text"
}
]
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status code is 200', function () {",
" pm.response.to.have.status(200);",
"});",
"var jsonData = pm.response.json();",
"pm.expect(jsonData.length).to.be.above(0);"
] ]
} }
} }