code: public function createEvent(Request $request): Event
      {
          if (empty($request->input())) {
              return new Unknown();
          }
  
          $update = new Update($request->input());
          $this->update = $update;
  
          if ($message = $update->message) {
              $chat = new Chat((string) $message->chat->id, $message->chat->title, $message->chat->type);
              $from = new User((string) $message->from->id, $message->from->first_name, $message->from->username);
  
              return new MessageReceived(
                  $chat,
                  $from,
                  $message->text,
                  $message->location,
                  null,
                  optional($update->callback_query)->data,
                  $update
              );
          }
  
          if ($callbackQuery = $update->callback_query) {
              $message = $callbackQuery->message;
  
              $chat = new Chat((string) $message->chat->id, $message->chat->title, $message->chat->type);
              $from = new User((string) $message->chat->id, $message->from->first_name, $message->from->username);
  
              return new MessageReceived(
                  $chat,
                  $from,
                  $message->text,
                  $message->location,
                  null,
                  $callbackQuery->data,
                  $update
              );
          }
  
          return new Unknown();
      }
docs: Create event based on incoming request.
  
  @param Request $request
  
  @return Event