4

I am trying to create a Viber Bot and looking for the method that can run through all subscribers I have in the specific Public account

I checked out all methods from Documentation but haven't found anything like "get_all_subscribers" or "get_all_users". So as far as I understood I have to set up callbacks for subscriptions. And to work around this data

{
    "event": "subscribed",
    "timestamp": 1457764197627,
    "user": {
        "id": "01234567890A=",
        "name": "John McClane",
        "avatar": "http://avatar.example.com",
        "country": "UK",
        "language": "en",
        "api_version": 1
    },
    "message_token": 4912661846655238145
}

So am I missing some methods and it's possible or I should work around callbacks only?

wowkin2
  • 5,895
  • 5
  • 23
  • 66
Sigmund
  • 748
  • 1
  • 8
  • 28

2 Answers2

1

According to viber documenation Viber API

We recommend that you record the subscriber ID of each subscriber, as there’s no API for fetching all subscriber IDs for your bot. You can find the subscriber ID in the sender.id property of the Message callback, or the user.id property of the Subscribed callback. You can see whether a user is subscribed in the subscribed parameter of the conversation_started callback. Note that users’ first message to the bot will make them subscribed, but will not result in a Subscribed callback.

Chris
  • 35
  • 5
1

You can get information about your subscribers using Get Account Info endpoint.

Its response contains subscribers_count and members (list with fields: id, name, avatar and role).

P.S. the only thing that you need to check is if the public account subscribers are chat bot subscribers too.

wowkin2
  • 5,895
  • 5
  • 23
  • 66