Chat
info
For each Tickets, there will be a separate chat channel for it.
All APIs endpoints
Get a list of messages in thread
Get a list of threads
Parameter
- page: optional
- default: 1
- description: the current page
- perPage: optional
- default: 10
- description: the number of threads on each page
Request
curl --location --request GET 'https://chat-stg.lumyri.com/chat/threads?page=1&perPage=2' \
--header 'Authorization: Bearer $ACCESS_TOKEN'
Response
{
"page": 1,
"total": 10,
"perPage": 2,
"data": [
{
"id": "06c89e98-a60d-4bc5-8b61-490d97b19da9",
"createdAt": "2023-02-16T06:43:57.000Z",
"updatedAt": "2023-02-16T06:43:57.000Z",
"userIds": [
"7897990c-d118-4479-a58f-85b9d1297c8b",
"33f835f6-83f7-46ba-9655-2534e9c94e8e"
]
},
{
"id": "0fdb1402-5067-4bd2-9186-729d648afea5",
"createdAt": "2023-02-16T06:43:57.000Z",
"updatedAt": "2023-02-16T06:43:57.000Z",
"userIds": [
"7897990c-d118-4479-a58f-85b9d1297c8b",
"33f835f6-83f7-46ba-9655-2534e9c94e8e"
]
}
]
}
Get a list of messages in the thread
Parameter
- limit: optional
- default: 50
- description: get the number of messages in the thread
Request
curl --location --request GET 'https://chat-stg.lumyri.com/chat/threads/$THREAD_ID/messages?limit=10' \
--header 'Authorization: Bearer $ACCESS_TOKEN'
Response
{
"data": [
{
"id": "185b8c91-b770-493f-2187-413d96852416",
"createdAt": "2023-01-16T04:14:26.000Z",
"userId": "2eb60610-b79f-4445-81d5-6384a3a2de14",
"type": "text",
"content": "hi"
},
{
"id": "185b8c91-b770-493f-2187-413d96852416",
"createdAt": "2023-01-16T04:14:26.000Z",
"userId": "2eb60610-b79f-4445-81d5-6384a3a2de14",
"type": "text",
"content": "hello, how are you?"
}
]
}
Upload file/image
Presigned URL
curl --location --request GET 'https://chat-stg.lumyri.com/chat/presigned-url?filename=README.md' \
--header 'Authorization: Bearer $ACCESS_TOKEN'
Response
{
"data": {
"postURL": "https://minio-stg.lumyri.com/chat",
"formData": {
"bucket": "chat",
"key": "2023-02-16/README.md",
"x-amz-date": "20230216T075546Z",
"x-amz-algorithm": "AWS4-HMAC-SHA256",
"x-amz-credential": "user-service/20230216/us-east-1/s3/aws4_request",
"policy": "eyJjb25kaXRpb25zIjpbWyJlcSIsIiRidWNrZXQiLCJjaGF0Il0sWyJlcSIsIiRrZXkiLCIyMDIzLTAyLTE2L2hlbGxvLmpwZyJdLFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMTY3NzcyMTZdLFsiZXEiLCIkeC1hbXotZGF0ZSIsIjIwMjMwMjE2VDA3NTU0NloiXSxbImVxIiwiJHgtYW16LWFsZ29yaXRobSIsIkFXUzQtSE1BQy1TSEEyNTYiXSxbImVxIiwiJHgtYW16LWNyZWRlbnRpYWwiLCJ1c2VyLXNlcnZpY2UvMjAyMzAyMTYvdXMtZWFzdC0xL3MzL2F3czRfcmVxdWVzdCJdXSwiZXhwaXJhdGlvbiI6IjIwMjMtMDItMjNUMDc6NTU6MDAuMDIyWiJ9",
"x-amz-signature": "db54dae70c78f57c73525f65601618e8871c2fc57fd23924f9879441e03253cc"
}
}
}
And then send files/images with the above response data
curl --location --request POST 'https://minio-stg.lumyri.com/chat' \
--form 'bucket="chat"' \
--form 'key="2023-02-16/README.md"' \
--form 'x-amz-date="20230216T075546Z"' \
--form 'x-amz-algorithm="AWS4-HMAC-SHA256"' \
--form 'x-amz-credential="user-service/20230216/us-east-1/s3/aws4_request"' \
--form 'policy="eyJjb25kaXRpb25zIjpbWyJlcSIsIiRidWNrZXQiLCJjaGF0Il0sWyJlcSIsIiRrZXkiLCIyMDIzLTAyLTE2L2hlbGxvLmpwZyJdLFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMTY3NzcyMTZdLFsiZXEiLCIkeC1hbXotZGF0ZSIsIjIwMjMwMjE2VDA3NTU0NloiXSxbImVxIiwiJHgtYW16LWFsZ29yaXRobSIsIkFXUzQtSE1BQy1TSEEyNTYiXSxbImVxIiwiJHgtYW16LWNyZWRlbnRpYWwiLCJ1c2VyLXNlcnZpY2UvMjAyMzAyMTYvdXMtZWFzdC0xL3MzL2F3czRfcmVxdWVzdCJdXSwiZXhwaXJhdGlvbiI6IjIwMjMtMDItMjNUMDc6NTU6MDAuMDIyWiJ9"' \
--form 'x-amz-signature="db54dae70c78f57c73525f65601618e8871c2fc57fd23924f9879441e03253cc"' \
--form 'file=@"README.md"'
Response
status code 204: no content