how can I send a message as a self bot?
To send a message as a bot you whould do this:
from viberbot import Api
from viberbot.api.bot_configuration import BotConfiguration
from viberbot.api.messages import TextMessage
from viberbot.api.viber_requests import ViberMessageRequest
from flask import Flask, request, Response
app = Flask(__name__)
bot_configuration = BotConfiguration(
name='YourBotName',
avatar='http://avatar.example.com',
auth_token='YOUR_AUTH_TOKEN'
)
viber = Api(bot_configuration)
@app.route('/', methods=['POST'])
def incoming():
# Handle incoming messages
viber_request = ViberMessageRequest(request.get_data())
message = viber_request.message
sender = viber_request.sender
if isinstance(message, TextMessage):
# Echo the received message
viber.send_messages(sender.id, [
TextMessage(text=message.text)
])
return Response(status=200)
if __name__ == "__main__":
app.run(host='0.0.0.0', port=8080)
else:
print("Failed to send the message.")
But how whould you send a message as a self bot? Also, a self bot is a bot that runs under the user account
I searched the internet and inspected network activity with WireShark to reverse engineer the Viber API but to no avail