💡 Tip
If you just want to send a message or call any API method, you can use bot.api.sendMessage(chat_id, text) and the like. This just requires you to have access to your bot object.
Did you know that you can even perform any Bot API call with grammY without creating a bot at all? This can be done with the Api class:
const api = new Api("token");
await api.sendMessage(chat_id, text);
It even supports plugins that are based on API transformers:
api.config.use(autoRetry())
The instance of Api will be completely isolated from the rest of your project, so you could have different sets of transformers installed for different parts of your project! Be sure to check out this.
If you just want to send a message or call any API method, you can use bot.api.sendMessage(chat_id, text) and the like. This just requires you to have access to your bot object.
Did you know that you can even perform any Bot API call with grammY without creating a bot at all? This can be done with the Api class:
const api = new Api("token");
await api.sendMessage(chat_id, text);
It even supports plugins that are based on API transformers:
api.config.use(autoRetry())
The instance of Api will be completely isolated from the rest of your project, so you could have different sets of transformers installed for different parts of your project! Be sure to check out this.