[Resolvido] API retornando somente Tickets

O serviço https://docs.blip.ai/#get-last-messages está retornando somente tickets, mesmo quando contém historico de mensagens, ao utilizar a requisição com o body abaixo, não retorna as mensagens trocadas com o atendente. Porém ao consultar pelo número do ticket, consigo visualizar o histórico de mensagens. Por que a API não retorna esse histórico?

{
“id”: “0094447a-2581-4597-be6a-a5dff33af156”,
“method”: “get”,
“uri”: “/threads/f02e3772-4dea-4194-83d4-0113a627993f@tunnel.msging.net?$take=500&direction=asc”
}

@rafaelpa por favor, consegue dizer o que ocorre?

@fernando você pode postar a resposta da requsição?

Fiz um teste aqui para um bot meu e estou recebendo as mensagens normalmente.

Somente o Ticket, sem as mensagens.

{
"type": "application/vnd.lime.collection+json",
"resource": {
    "total": 11,
    "itemType": "application/vnd.iris.thread-message+json",
    "items": [
        {
            "id": "c9ad56b2-f653-41c8-88c9-f07172014a84",
            "direction": "received",
            "type": "application/vnd.iris.ticket+json",
            "content": {
                "id": "730dc07e-3466-412d-b0ec-016b9eda1927",
                "sequentialId": 22357,
                "ownerIdentity": "conciergedesk@msging.net",
                "customerIdentity": "f02e3772-4dea-4194-83d4-0113a627993f@tunnel.msging.net",
                "customerDomain": "tunnel.msging.net",
                "provider": "Lime",
                "status": "Waiting",
                "storageDate": "2019-06-28T16:10:21.863Z",
                "externalId": "730dc07e-3466-412d-b0ec-016b9eda1927",
                "rating": 0,
                "team": "Default",
                "unreadMessages": 0,
                "closed": false
            },
            "date": "2019-06-28T16:10:21.949Z"
        },
        {
            "id": "0e67cdbd-8109-4987-932b-dd0a132f7bd0",
            "direction": "received",
            "type": "application/vnd.iris.ticket+json",
            "content": {
                "id": "5d6da9c9-b8b2-42fd-b5b3-016b8a8e5a6b",
                "sequentialId": 21571,
                "ownerIdentity": "conciergedesk@msging.net",
                "customerIdentity": "f02e3772-4dea-4194-83d4-0113a627993f@tunnel.msging.net",
                "customerDomain": "tunnel.msging.net",
                "provider": "Lime",
                "status": "Waiting",
                "storageDate": "2019-06-24T17:35:13.515Z",
                "externalId": "5d6da9c9-b8b2-42fd-b5b3-016b8a8e5a6b",
                "rating": 0,
                "team": "Default",
                "unreadMessages": 0,
                "closed": false
            },
            "date": "2019-06-24T17:35:13.645Z"
        },
        {
            "id": "907c0f99-3b04-4941-8c36-fe8e74af159c",
            "direction": "received",
            "type": "application/vnd.iris.ticket+json",
            "content": {
                "id": "2a388dd2-5f91-4ca7-b22e-016b8a653a54",
                "sequentialId": 21557,
                "ownerIdentity": "conciergedesk@msging.net",
                "customerIdentity": "f02e3772-4dea-4194-83d4-0113a627993f@tunnel.msging.net",
                "customerDomain": "tunnel.msging.net",
                "provider": "Lime",
                "status": "Waiting",
                "storageDate": "2019-06-24T16:50:18.324Z",
                "externalId": "2a388dd2-5f91-4ca7-b22e-016b8a653a54",
                "rating": 0,
                "team": "Default",
                "unreadMessages": 0,
                "closed": false
            },
            "date": "2019-06-24T16:50:18.519Z"
        },
        {
            "id": "afcf1847-cd2c-445a-ae36-4a216345db61",
            "direction": "received",
            "type": "application/vnd.iris.ticket+json",
            "content": {
                "id": "63d253ec-a998-428f-8127-016b6baeb7c9",
                "sequentialId": 20960,
                "ownerIdentity": "conciergedesk@msging.net",
                "customerIdentity": "f02e3772-4dea-4194-83d4-0113a627993f@tunnel.msging.net",
                "customerDomain": "tunnel.msging.net",
                "provider": "Lime",
                "status": "Waiting",
                "storageDate": "2019-06-18T17:42:20.873Z",
                "externalId": "63d253ec-a998-428f-8127-016b6baeb7c9",
                "rating": 0,
                "team": "Default",
                "unreadMessages": 0,
                "closed": false
            },
            "date": "2019-06-18T17:42:20.993Z"
        },
        {
            "id": "391b9eb5-ac3c-4efc-84bd-7e4b37cb7347",
            "direction": "received",
            "type": "application/vnd.iris.ticket+json",
            "content": {
                "id": "ebd88b66-d3ed-4700-bf36-016b5107c36c",
                "sequentialId": 20185,
                "ownerIdentity": "conciergedesk@msging.net",
                "customerIdentity": "f02e3772-4dea-4194-83d4-0113a627993f@tunnel.msging.net",
                "customerDomain": "tunnel.msging.net",
                "provider": "Lime",
                "status": "Waiting",
                "storageDate": "2019-06-13T13:29:51.724Z",
                "externalId": "ebd88b66-d3ed-4700-bf36-016b5107c36c",
                "rating": 0,
                "team": "Default",
                "unreadMessages": 0,
                "closed": false
            },
            "date": "2019-06-13T13:29:51.945Z"
        },
        {
            "id": "be4a32a8-97cb-4930-bde1-7857f59fbb58",
            "direction": "received",
            "type": "application/vnd.iris.ticket+json",
            "content": {
                "id": "7de447c9-6319-44f8-af26-016b42d8ad4d",
                "sequentialId": 19644,
                "ownerIdentity": "conciergedesk@msging.net",
                "customerIdentity": "f02e3772-4dea-4194-83d4-0113a627993f@tunnel.msging.net",
                "customerDomain": "tunnel.msging.net",
                "provider": "Lime",
                "status": "Waiting",
                "storageDate": "2019-06-10T19:23:44.845Z",
                "externalId": "7de447c9-6319-44f8-af26-016b42d8ad4d",
                "rating": 0,
                "team": "Default",
                "unreadMessages": 0,
                "closed": false
            },
            "date": "2019-06-10T19:23:44.961Z"
        },
        {
            "id": "66020c9d-6e27-4370-9dc8-3b1eba0ead1d",
            "direction": "received",
            "type": "application/vnd.iris.ticket+json",
            "content": {
                "id": "776c09b4-f4cf-48ce-ae42-016b2dd3e86e",
                "sequentialId": 19068,
                "ownerIdentity": "conciergedesk@msging.net",
                "customerIdentity": "f02e3772-4dea-4194-83d4-0113a627993f@tunnel.msging.net",
                "customerDomain": "tunnel.msging.net",
                "provider": "Lime",
                "status": "Waiting",
                "storageDate": "2019-06-06T17:26:30.766Z",
                "externalId": "776c09b4-f4cf-48ce-ae42-016b2dd3e86e",
                "rating": 0,
                "team": "Default",
                "unreadMessages": 0,
                "closed": false
            },
            "date": "2019-06-06T17:26:30.941Z"
        },
        {
            "id": "dc4fb52b-4d07-4180-97ea-1ff8105e640c",
            "direction": "received",
            "type": "application/vnd.iris.ticket+json",
            "content": {
                "id": "d99b85b0-a021-4f51-8626-016adbadfa5d",
                "sequentialId": 16714,
                "ownerIdentity": "conciergedesk@msging.net",
                "customerIdentity": "f02e3772-4dea-4194-83d4-0113a627993f@tunnel.msging.net",
                "customerDomain": "tunnel.msging.net",
                "provider": "Lime",
                "status": "Waiting",
                "storageDate": "2019-05-21T18:36:13.277Z",
                "externalId": "d99b85b0-a021-4f51-8626-016adbadfa5d",
                "rating": 0,
                "team": "Default",
                "unreadMessages": 0,
                "closed": false
            },
            "date": "2019-05-21T18:36:13.381Z"
        },
        {
            "id": "a19dcdca-bd80-4f90-bcb0-c7f8e91eb28c",
            "direction": "received",
            "type": "application/vnd.iris.ticket+json",
            "content": {
                "id": "c848872e-a16e-43f4-a441-016a4a562bd7",
                "sequentialId": 12747,
                "ownerIdentity": "conciergedesk@msging.net",
                "customerIdentity": "f02e3772-4dea-4194-83d4-0113a627993f@tunnel.msging.net",
                "customerDomain": "tunnel.msging.net",
                "provider": "Lime",
                "status": "Waiting",
                "storageDate": "2019-04-23T13:15:22.455Z",
                "externalId": "c848872e-a16e-43f4-a441-016a4a562bd7",
                "rating": 0,
                "team": "Default",
                "unreadMessages": 0,
                "closed": false
            },
            "date": "2019-04-23T13:15:22.625Z"
        },
        {
            "id": "c0984560-8039-4823-a41a-de57ce399d22",
            "direction": "received",
            "type": "application/vnd.iris.ticket+json",
            "content": {
                "id": "fc09b538-7d13-4a96-9478-016a315f6826",
                "sequentialId": 12314,
                "ownerIdentity": "conciergedesk@msging.net",
                "customerIdentity": "f02e3772-4dea-4194-83d4-0113a627993f@tunnel.msging.net",
                "customerDomain": "tunnel.msging.net",
                "provider": "Lime",
                "status": "Waiting",
                "storageDate": "2019-04-18T16:54:57.318Z",
                "externalId": "fc09b538-7d13-4a96-9478-016a315f6826",
                "rating": 0,
                "team": "Default",
                "unreadMessages": 0,
                "closed": false
            },
            "date": "2019-04-18T16:54:57.573Z"
        },
        {
            "id": "e11c7804-186e-4b0b-81c6-d46e56d2f78e",
            "direction": "received",
            "type": "application/vnd.iris.ticket+json",
            "content": {
                "id": "0e553b00-d59b-4520-93b2-016a03990d8d",
                "sequentialId": 11120,
                "ownerIdentity": "conciergedesk@msging.net",
                "customerIdentity": "f02e3772-4dea-4194-83d4-0113a627993f@tunnel.msging.net",
                "customerDomain": "tunnel.msging.net",
                "provider": "Lime",
                "status": "Waiting",
                "storageDate": "2019-04-09T19:35:23.277Z",
                "externalId": "0e553b00-d59b-4520-93b2-016a03990d8d",
                "rating": 0,
                "team": "Default",
                "unreadMessages": 0,
                "closed": false
            },
            "date": "2019-04-09T19:35:23.426Z"
        }
    ]
},
"method": "get",
"status": "success",
"id": "0094447a-2581-4597-be6a-a5dff33af156",
"from": "postmaster@msging.net/#az-iris1",
"to": "conciergedesk@msging.net",
"metadata": {
    "#command.uri": "lime://conciergedesk@msging.net/threads/f02e3772-4dea-4194-83d4-0113a627993f@tunnel.msging.net"
}

}

Bom, @fernando vamos lá! Notei aqui que você está usando a extensão Tunnel também, certo?

Neste caso, é necessário fazer algumas modificações na URI da requisição para que funcione.

Atualmente você está usando:
/threads/{id do usuario no subbot}

O correto precisa ser:
lime://{id do master}/threads/{id do usuario no master}

No entanto, você vai precisar requisitar essas informações {id do master} e {id do usuário no master} para a extensão Tunnel através do método Querying Information. A resposta dessa requisição irá te retornar as propriedades alternativeAccount, que é o {id usuário no master} e, no Extras vai ter uma propriedade chamada tunnel.owner, que é o {id do master}

Faça os testes e veja se funcione. Caso contrário, por favor, nos avise.

Espero te ajudado! :relaxed:

Obrigado @Bcamarda, vou testar aqui. Estava fazendo a chamada conforme a documentação.
Com certeza já ajudou muito respondendo!

1 Curtida

@fernando certo! Vou ficar aguardando seu retorno.

Ps.: quanto à documentação, vamos dar um jeitinho de atualizar ela com essas informações lá :wink:

1 Curtida

@Bcamarda
Ocorreu um erro:

{
"method": "get",
"status": "failure",
"reason": {
    "code": 62,
    "description": "There's no processor available for requested resource type"
},
"id": "0094447a-2581-4597-be6a-a5dff33af156",
"from": "postmaster@msging.net/#az-iris3",
"to": "conciergedesk@msging.net",
"metadata": {
    "#command.uri": "lime://conciergedesk@msging.net/concierge1@msging.net/threads/5511995022408@wa.gw.msging.net"
}

}Texto pré-formatado

Chamada.

{  

“id”: “0094447a-2581-4597-be6a-a5dff33af156”,
“method”: “get”,
“uri”: “/concierge1@msging.net/threads/5511995022408@wa.gw.msging.net”
}

Dados do Querying information!

{
"type": "application/vnd.lime.account+json",
"resource": {
    "alternativeAccount": "5511995022408@wa.gw.msging.net",
    "identity": "f02e3772-4dea-4194-83d4-0113a627993f@tunnel.msging.net",
    "extras": {
        "tunnel.owner": "concierge1@msging.net"
    },
    "source": "WhatsApp"
},
"method": "get",
"status": "success",
"id": "3",
"from": "postmaster@tunnel.msging.net/#az-iris3",
"to": "conciergedesk@msging.net",
"metadata": {
    "#command.uri": "lime://tunnel.msging.net/accounts/f02e3772-4dea-4194-83d4-0113a627993f@tunnel.msging.net"
}

}

@Bcamarda alguma idéia do que pode ser?
já testei as chamadas de várias maneiras diferentes

1 Curtida

Olá @fernando,

adicione a URI no formato completo:

“lime://concierge1@msging.net/threads/5511995022408@wa.gw.msging.net”

1 Curtida

Deu certo! Muito obrigado!

2 Curtidas