Skip to content

How to receive other notifications#


Before you begin, you need to install the library and configure the bot; this process is described in detail here: How to import the library and configure your bot.

How to receive other notifications#

You can receive not only incoming messages, but also outgoing ones, as well as their statuses and any other types of web hooks. To do this, simply override the method you need.

In this scene, the bot receives all incoming messages and outputs them to the console. Other types of web hooks are ignored, they handlers have been added for clarity.

Link to example: event.

public class EventStartScene extends Scene {

     // To process incoming messages.
     public State processIncomingMessage(MessageWebhook incomingMessage, State currentState) {; // Display messages

         return currentState;

     // To process outgoing messages
     public State processOutgoingMessage(MessageWebhook outgoingMessage, State currentState) {
         return super.processOutgoingMessage(outgoingMessage, currentState);

     // To process the statuses of outgoing messages
     public State processOutgoingMessageStatus(OutgoingMessageStatus outgoingMessageStatus, State currentState) {
         return super.processOutgoingMessageStatus(outgoingMessageStatus, currentState);

     // To process incoming calls
     public State processIncomingCall(IncomingCall incomingCall, State currentState) {
         return super.processIncomingCall(incomingCall, currentState);

     // To handle chat blocking
     public State processIncomingBlock(IncomingBlock incomingBlock, State currentState) {
         return super.processIncomingBlock(incomingBlock, currentState);

List of examples#

Description Example link
How to initialize an object
Scene "Hello"
Scene "Echo"
How to receive other types of notifications
How to filter incoming messages
How to handle notification body
How to work with bot state state
Example of a ready-made chat-bot full