Files
messengerapi/postman/endpoints.postman_collection.json
masiton 9edc579bfe
All checks were successful
Build and Push Docker Image / build (push) Successful in 55s
Build and Push Docker Image / docker (push) Successful in 36s
Documentation.
2025-07-05 00:54:59 +02:00

383 lines
7.1 KiB
JSON

{
"info": {
"_postman_id": "b8400b20-a16f-4c2a-a8ec-0eec25611319",
"name": "endpoints",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "248257"
},
"item": [
{
"name": "cors/send",
"request": {
"method": "OPTIONS",
"header": [
{
"key": "Access-Control-Request-Method",
"value": "POST",
"type": "text"
},
{
"key": "Access-Control-Request-Headers",
"value": "content-type",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "Origin",
"value": "{{FrontEndUrl}}",
"type": "text"
},
{
"key": "Referer",
"value": "{{FrontEndUrl}}",
"type": "text"
}
],
"url": {
"raw": "{{Url}}/send",
"host": [
"{{Url}}"
],
"path": [
"send"
]
}
},
"response": []
},
{
"name": "yellowpages",
"event": [
{
"listen": "test",
"script": {
"exec": [
"let response = pm.response.json();\r",
"pm.environment.set(\"User2IdFromYellowpages\", response.users[0].id);\r",
"\r",
"pm.test(\"User2 address returned should match our expectation.\", function () {\r",
" const u2id = pm.environment.get(\"User2Id\");\r",
" const u2idFromResponse = pm.environment.get(\"User2IdFromYellowpages\");\r",
" pm.expect(u2id, `Expected returned value (${u2idFromResponse}) to equal expected value (${u2id})`).to.eql(u2idFromResponse);\r",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{User1ApiKey}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "Origin",
"value": "www.google.com",
"type": "text"
}
],
"url": {
"raw": "{{Url}}/yellowpages",
"host": [
"{{Url}}"
],
"path": [
"yellowpages"
]
}
},
"response": []
},
{
"name": "send",
"event": [
{
"listen": "test",
"script": {
"exec": [
"let response = pm.response.json();\r",
"pm.environment.set(\"MessageId\", response);"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{User1ApiKey}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"payloadType\": \"Whatever\",\r\n \"payload\": \"This is a message.\",\r\n \"toUserId\": \"{{User2Id}}\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{Url}}/send",
"host": [
"{{Url}}"
],
"path": [
"send"
]
}
},
"response": []
},
{
"name": "verify",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{User1ApiKey}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{Url}}/verify?messageId={{MessageId}}",
"host": [
"{{Url}}"
],
"path": [
"verify"
],
"query": [
{
"key": "messageId",
"value": "{{MessageId}}"
}
]
}
},
"response": []
},
{
"name": "peek",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"We have expected 1 message during call.\", function () {\r",
" const count = parseInt(pm.response.text(), 10);\r",
" const expectedCount = 1;\r",
" pm.expect(count, `Expected returned value (${count}) to equal expected value (${expectedCount})`).to.eql(expectedCount);\r",
"});\r",
"\r",
"pm.test(\"Response status is 200 OK\", function () {\r",
" pm.response.to.have.status(200);\r",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{User2ApiKey}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"url": {
"raw": "{{Url}}/peek",
"host": [
"{{Url}}"
],
"path": [
"peek"
]
}
},
"response": []
},
{
"name": "receive",
"event": [
{
"listen": "test",
"script": {
"exec": [
"let response = pm.response.json();\r",
"\r",
"pm.test(\"MessageId returned should match MessageId from Send call.\", function () {\r",
" const idFromCall = response.messages[0].id;\r",
" const idFromSend = pm.environment.get(\"MessageId\");\r",
" pm.expect(idFromCall, `Expected returned value (${idFromCall}) to equal expected value (${idFromSend})`).to.eql(idFromSend);\r",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{User2ApiKey}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"url": {
"raw": "{{Url}}/receive",
"host": [
"{{Url}}"
],
"path": [
"receive"
]
}
},
"response": []
},
{
"name": "ack",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Response status is 200 OK\", function () {\r",
" pm.response.to.have.status(200);\r",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{User2ApiKey}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"messageId\": \"{{MessageId}}\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{Url}}/ack",
"host": [
"{{Url}}"
],
"path": [
"ack"
]
}
},
"response": []
}
],
"auth": {
"type": "bearer"
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"packages": {},
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"packages": {},
"exec": [
""
]
}
}
]
}