You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have Premium Telegram account and created Business Telegram bot. So it is able to receive notifications from all my chats, but when I try to send message, it throws the following error
Fail RPCError: 400: PEER_ID_INVALID (caused by InvokeWithBusinessConnection)
at RPCMessageToError (/Users/alexeysh/dev/tg-api-no-bot/node_modules/telegram/errors/index.js:28:12)
at MTProtoSender._handleRPCResult (/Users/alexeysh/dev/tg-api-no-bot/node_modules/telegram/network/MTProtoSender.js:546:58)
at MTProtoSender._processMessage (/Users/alexeysh/dev/tg-api-no-bot/node_modules/telegram/network/MTProtoSender.js:476:15)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async MTProtoSender._recvLoop (/Users/alexeysh/dev/tg-api-no-bot/node_modules/telegram/network/MTProtoSender.js:424:17) {
code: 400,
errorMessage: 'PEER_ID_INVALID'
}
this is my code
console.log('started', await client.start({
botAuthToken: BOT_TOKEN,
}));
client.addEventHandler(async (update: Api.TypeUpdate) => {
if (update instanceof UpdateBotNewBusinessMessage) {
try {
const result = await client.invoke(new Api.InvokeWithBusinessConnection ({
connectionId: update.connectionId,
query: new Api.messages.SendMessage({
// @ts-ignore
peer: update.message.fromId,
message: "Hello there!",
// @ts-ignore
// sendAs: update.message.peerId, // does not help
})
}));
console.log('ok', result);
} catch (e) {
console.error('Fail', e);
}
}
});
Business users can connect Telegram bots that will process and answer messages on their behalf. This allows businesses to seamlessly integrate any existing tools and workflows, or add AI assistants that manage their chats.
The documentation says it is possible, but it seems not to be.
The text was updated successfully, but these errors were encountered:
I have Premium Telegram account and created Business Telegram bot. So it is able to receive notifications from all my chats, but when I try to send message, it throws the following error
this is my code
The documentation says it is possible, but it seems not to be.
The text was updated successfully, but these errors were encountered: