Ir para o conteúdo

Consultar conversas

Recuperar conversas

Este endpoint permite que o vendedor (seller) recupere uma coleção de conversas abertas por clientes utilizando filtros como referência.

Escopo requerido

Valor Descrição
services:conversations-seller:read Permite a utilização das APIs de leitura.

Parâmetros da URL

Campo Tipo Descrição Obrigatorio
_limit Inteiro Determina a quantidade de registros a serem retornados. Valor padrão 10. Nāo
_offset Inteiro Posição de registro de referência, a partir dele serão retornados os próximos N registros. Valor padrão 0. Nāo
status String Status da mensagem, pode ser o seguintes valores:


WAITING_RESPONSE - aguardando resposta
REJECTED_RESPONSE - resposta rejeitada
APPROVED - resposta aprovada

Não
from_user_ref_key String Identificador do cliente que criou a conversa. Não
last_interaction_at_start String (datetime ISO 8601) Filtra interações a partir da data informada (ex.: "2023-06-27T12:15:37.729Z") Não
last_interaction_at_end String (datetime ISO 8601) Filtra interações até a data informada (ex.: "2023-06-27T12:15:37.729Z") Não

Chamada:

curl -X 'GET' \
  'https://services.magalu.com/v0/conversations?status=WAITING_RESPONSE&_offset=150&_limit=20' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <Access Token>' \
  -H 'Content-Type: application/json' \

Resposta:

Domínio: PaginatedResponse[Conversation]:

{
    "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": "6628da4c11696b6967daf96c",
            "display_name": "Conversation Name",
            "owner": {
                "name": "Z Store",
                "ref_key": "zstore"
            },
            "from_user": {
                "id": "6628d7a3c01daebde56f5598",
                "full_name": "John Doe",
                "full_name_normalized": "johndoe",
                "external_id": "e8528120-fc36-43e9-bd01-fd453d938da7",
                "type": "CUSTOMER"
            },
            "to_user": {
                "id": "6628d7a3c01daebde56f5599",
                "full_name": "Z Store",
                "full_name_normalized": "zstore",
                "external_id": "zstore",
                "type": "SELLER"
            },
            "unread_from_count": 6,
            "unread_to_count": 0,
            "last_interaction_at": "2023-11-01T14:09:51.600Z",
            "status": "OPENED",
            "last_message": {
                "id": "6628da6211696b6967daf96f",
                "from_user": {
                    "full_name": "John Doe",
                    "full_name_normalized": "johndoe",
                    "external_id": "e8528120-fc36-43e9-bd01-fd453d938da7",
                    "type": "CUSTOMER"
                },
                "content": "Hello world",
                "when_at": "2023-11-01T13:36:15.935Z"
            },
            "is_new_to": false,
            "tags": [
                {
                    "name": "productId",
                    "value": "kb3cghh1ge"
                },
                {
                    "name": "productTitle",
                    "value": "Guarda Roupa Casal Grande 6 Portas 4 Gavetas Marrom Next"
                },
                {
                    "name": "productImage",
                    "value": "https://a-static.mlcdn.com.br/{w}x{h}/guarda-roupa-casal-grande-6-portas-4-gavetas-marrom-next-caemmun/caemmun/7899630657530/85f19946fa851fda2a2fee973273b940.jpeg"
                },
                {
                    "name": "productUrl",
                    "value": "https://www.magazineluiza.com.br/guarda-roupa-casal-grande-6-portas-4-gavetas-marrom-next-caemmun/p/kb3cghh1ge/mo/guro/"
                }
            ],
            "created_at": "2023-10-24T16:58:02.312Z",
            "updated_at": "2023-11-23T16:57:10.353Z"
        }
    ]
}

Códigos de retorno

Código Descrição
200 OK
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error

Recuperar conversa pelo ID

Este endpoint permite que o vendedor (seller) recupere uma conversa pelo ID

Escopo requerido

Valor Descrição
services:conversations-seller:read Permite a utilização das APIs de leitura.

Parâmetros da URL

Campo Tipo Descrição Obrigatorio
conversation_id String Identificador da conversa Sim

Chamada:

curl -X 'GET' \
  'https://services.magalu.com/v0/conversations/{conversation_id}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <Access Token>' \
  -H 'Content-Type: application/json' \

Resposta:

Domínio: Conversation:

{
    "id": "6628da4c11696b6967daf96c",
    "display_name": "Conversation Name",
    "owner": {
        "name": "Z Store",
        "ref_key": "zstore"
    },
    "from_user": {
        "id": "6628d7a3c01daebde56f5598",
        "full_name": "John Doe",
        "full_name_normalized": "johndoe",
        "external_id": "e8528120-fc36-43e9-bd01-fd453d938da7",
        "type": "CUSTOMER"
    },
    "to_user": {
        "id": "6628d7a3c01daebde56f5599",
        "full_name": "Z Store",
        "full_name_normalized": "zstore",
        "external_id": "zstore",
        "type": "SELLER"
    },
    "unread_from_count": 6,
    "unread_to_count": 0,
    "last_interaction_at": "2023-11-01T14:09:51.600Z",
    "status": "OPENED",
    "last_message": {
        "id": "6628da6211696b6967daf96f",
        "from_user": {
            "full_name": "John Doe",
            "full_name_normalized": "johndoe",
            "external_id": "e8528120-fc36-43e9-bd01-fd453d938da7",
            "type": "CUSTOMER"
        },
        "content": "Hello world",
        "when_at": "2023-11-01T13:36:15.935Z"
    },
    "is_new_to": false,
    "tags": [
        {
            "name": "productId",
            "value": "kb3cghh1ge"
        },
        {
            "name": "productTitle",
            "value": "Guarda Roupa Casal Grande 6 Portas 4 Gavetas Marrom Next"
        },
        {
            "name": "productImage",
            "value": "https://a-static.mlcdn.com.br/{w}x{h}/guarda-roupa-casal-grande-6-portas-4-gavetas-marrom-next-caemmun/caemmun/7899630657530/85f19946fa851fda2a2fee973273b940.jpeg"
        },
        {
            "name": "productUrl",
            "value": "https://www.magazineluiza.com.br/guarda-roupa-casal-grande-6-portas-4-gavetas-marrom-next-caemmun/p/kb3cghh1ge/mo/guro/"
        }
    ],
    "created_at": "2023-10-24T16:58:02.312Z",
    "updated_at": "2023-11-23T16:57:10.353Z"
}

Códigos de retorno

Código Descrição
200 OK
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error