Consult messages¶
Retrieve messages¶
This endpoint allows the seller to retrieve a collection of messages per conversation using filters as a reference.
Scope required
Value | Description |
---|---|
services:conversations-seller:read |
Allows the use of the read APIs. |
URL parameters
Field | Type | Description | Required |
---|---|---|---|
conversation_id | String | Unique conversation identifier | Yes |
_limit | Integer | Determines the number of records to be returned. Default value 10. | No |
_offset | Integer | Reference record position, from which the next N records will be returned. Default value 0. | Nāo |
Request:
curl -X 'GET' \
'https://services.magalu.com/v0/conversations/{conversation_id}/messages?_offset=150&_limit=20' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <Access Token>' \
-H 'Content-Type: application/json' \
Response:
Domain: PaginatedResponse[Message]:¶
{
"meta": {
"page": {
"limit": 20,
"offset": 150,
"max_limit": 100
},
"links": {
"previous": "?_offset=130&_limit=20",
"next": "?_offset=170&_limit=20",
"self": "?_offset=150&_limit=20"
}
},
"results": [
{
"id": "630e3bbc950b052e8724491a",
"from_user": {
"id": "6628d7a3c01daebde56f5598",
"full_name": "John Doe",
"full_name_normalized": "johndoe",
"ref_key": "e8528120-fc36-43e9-bd01-fd453d938da7",
"type": "CUSTOMER"
},
"to_user": {
"id": "6628d7a3c01daebde56f5599",
"full_name": "Z Store",
"full_name_normalized": "zstore",
"ref_key": "zstore",
"type": "SELLER"
},
"content": "Como faz para montar ? Onde encontramos montador?",
"attachments": [
"https://docs.com/doc.pdf"
],
"read_by": [
"6628d7a3c01daebde56f5599"
],
"moderation": {
"status": "APPROVED",
"when_at": {
"$date": "2024-04-24T09:57:57.620Z"
},
"block_rules": []
},
"when_at": "2024-04-24T09:57:56.851Z",
"custom_fields": [
{
"name": "field name",
"value": "field value"
}
],
"metadata": {
"coupom": {
"id": "uuid",
"seller": "z",
"expires": "2099-01-01",
"client": {
"id": "uuid",
"name": "J. Climbler"
}
}
},
"integration": false
}
]
}
Return codes
Code | Description |
---|---|
200 | OK |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
500 | Internal Server Error |
Retrieve messages by ID¶
This endpoint allows the seller to retrieve a message from a conversation by conversation ID and message ID
Scope required
Value | Description |
---|---|
services:conversations-seller:read |
Allows use of the read APIs. |
URL parameters
Field | Type | Description | Required |
---|---|---|---|
conversation_id | String | Conversation identifier | Yes |
message_id | String | Message identifier | Yes |
Request:
curl -X 'GET' \
'https://services.magalu.com/v0/conversations/{conversation_id}/messages/{message_id}' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <Access Token>' \
-H 'Content-Type: application/json' \
Response:
Domain: Message:¶
{
"id": "630e3bbc950b052e8724491a",
"from_user": {
"id": "6628d7a3c01daebde56f5598",
"full_name": "John Doe",
"full_name_normalized": "johndoe",
"ref_key": "e8528120-fc36-43e9-bd01-fd453d938da7",
"type": "CUSTOMER"
},
"to_user": {
"id": "6628d7a3c01daebde56f5599",
"full_name": "Z Store",
"full_name_normalized": "zstore",
"ref_key": "zstore",
"type": "SELLER"
},
"content": "Como faz para montar ? Onde encontramos montador?",
"attachments": [
"https://docs.com/doc.pdf"
],
"read_by": [
"6628d7a3c01daebde56f5599"
],
"moderation": {
"status": "APPROVED",
"when_at": {
"$date": "2024-04-24T09:57:57.620Z"
},
"block_rules": []
},
"when_at": "2024-04-24T09:57:56.851Z",
"custom_fields": [
{
"name": "field name",
"value": "field value"
}
],
"metadata": {
"coupom": {
"id": "uuid",
"seller": "z",
"expires": "2099-01-01",
"client": {
"id": "uuid",
"name": "J. Climbler"
}
}
},
"integration": false
}
Return codes
Code | Description |
---|---|
200 | OK |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
500 | Internal Server Error |