Giter Site home page Giter Site logo

fauzaanu / viberchannelposter Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 66 KB

A simple setup guide for Viber Automated Channels.

Home Page: https://fauzaanu.com

Python 60.68% JavaScript 39.32%
viber viber-bot viber-chat cloudflare-workers flask bruno

viberchannelposter's Introduction

Before reading this, consider switching to telegram

  1. Viber Channels API allows you to impersonate others
  2. Viber deletes files for "privacy" reasons
  3. Telegram is so much better

Viber Channel Auto Poster

This guide will illustrate how to setup automated channel posts for viber. This guide uses the Viber Channel Post API

Creating a channel

Open Viber and create a channel. Go the right-side menu and click developer tools to get the Authentication Token

Setting up a webhook

We need to setup a webhook initially, its not clear whether viber does anything with this webhook later on.

In this repositiory I have included two ways to achieve this

  1. Flask Server (Bit Harder)
  2. Cloudflare Workers (Very Easy)

The only reason I am including the flask server is because I had already written it before I got to know cloudflare workers. I would recommend using cloudflare workers as it is much easier to setup and maintain. Ive also exluded the readme sections of Flask and Certbot because Viber requires a SSL certificate to be setup and we can skip this whole process by using cloudflare workers.

The Webservers Function

The webserver checks for a specific header ('X-Viber-Content-Signature') in the Post requests it recieves, and returns a response with status 200 if the header exists, and status 403 if it doesn't.

Flask or Cloudflare workers or any other webserver can be used to achieve this as long as it does the above. (with SSL ofcourse)

API Requests

In this very repo we have included a basic API Collection for Bruno which can be used to test the API endpoints. This does not include many other endpoints that the Viber Channel API provides. Please refer to the Viber Channel API Documentation for more information.

In our Bruno API Collection we have an environment with auth token, userid and webhook url. Please change these to your own values. The webhook url should be your cloudflare workers url or your flask server url.

The order of the requests should be:

  1. Setup webhook using the webhook url and auth token
  2. Make request to get user id
  3. Make request to send message to user id
  4. . . .
  5. any other requests you want to make

Clarification on the user id

The userid is the ID inside the members array of the response from the get user id request. The get user id request returns a list of all the members in the channel.

{
  "status": 0,
  "status_message": "ok",
  "id": "this_is_not_the_user_id",
  "chat_hostname": "SN-CHAT-10_",
  "name": "Automated Channel",
  "members": [
    {
      "id": "this_is_the_user_id",
      "name": "Fauzaan",
      "avatar": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "role": "superadmin"
    }
  ]
}

Impersonating other admins

Im not sure why this exists as a feature, but you can impersonate other super admins in the channel by using their user id in the send message request.

Developing Further

This is the basic implementation of the Viber Channel API. You can develop further by using the Viber Channel API Documentation and your own creativity.

VIBER IS BAD SWITCH TO TELEGRAM

viberchannelposter's People

Contributors

fauzaanu avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.