Viber REST api - receiving attachments / using keyboards

384 Views Asked by At

As per documentation, files sent by users should come in the form of a url in the "media" field of the "message" object. Instead, this here comes when I'm sending any kind of file:

{
    "event": "message",
    "timestamp": 1590699124661,
    "chat_hostname": "SN-CHAT-02_",
    "message_token": 5446896602817120687,
    "sender": {
        "id": "",
        "name": "Subscriber",
        "avatar": "http://dl-media.viber.com/1/share/2/long/bots/generic-avatar%402x.png",
        "language": "en",
        "country": "GE",
        "api_version": 8
    },
    "message": {
        "type": "picture",
        "file_name": "IMG-82b0117ba385360f5821ac0b875a6322-V.jpg",
        "size": 92033
    },
    "silent": false
}

Any advice? It was working a while back but now something has changed and I can't understand what exactly. Doesn't look like a change on my side, since that JSON there is the exact event I'm receiving. I think it depends on the API version, but I wasn't able to find any info regarding that.

And while I'm at it, keyboards function differently depending on the platform the message I receive comes from. I used the "share-phone" keyboard button type and while it works on the phone, correctly returning me the user's phone number as a "contact" object, when pressed on PC the "contact" object is null and the keyboard's text comes back instead.

0

There are 0 best solutions below