Send Telegram Business msg in business mode

Telegram now allows to chat with users through regular chat, where bot is connected to business user with permissions to reply.

However, send string should contain business_connection_id.

This is what I have in Chat ID setting:
{{ $('Telegram Trigger').item.json.business_message.chat.id }}

And result is error: Forbidden: bot can’t initiate conversation with a user.

Maybe adding business_connection_id should help to avoid error as far as I’m googling.

Don’t know how to incorporate business_id into this expression.

hello @Sprchrgd

I suppose Telegram Node in n8n doesn’t have business API functionality. You can utilize the HTTP Requests Node, but that will be way more difficult :slight_smile:

And unfortunately this is not in the roadmap either.

Can’t even add custom field. Such an easy feature to add.

You can submit a feature request here :slight_smile:

To enable your bot to reply in private chats through a business connection in n8n, you must use the HTTP Request node to send requests to the Telegram API, specifying the business_connection_id parameter. This parameter is required to identify the business connection and facilitate sending messages in private chats.

Setup Steps:

  1. Extract Necessary Data:
  • From the JSON response received from Telegram, extract business_connection_id and chat.id.
  1. Configure the HTTP Request node in n8n:
  • Add the HTTP Request node to your workflow.
  • Set the request method to POST.
  • In the “URL” field, specify the Telegram API endpoint for sending messages:
https://api.telegram.org/bot<TOKEN>/sendMessage

replacing <TOKEN> with your bot’s actual token.

In the “Body Parameters” section, include these parameters:

chat_id: {{$json["business_message"]["chat"]["id"]}}
text: Your response message
business_connection_id: {{$json["business_message"]["business_connection_id"]}}

Example configuration of the HTTP Request node:
Method: POST
Body Parameters:

chat_id: {{$json["business_message"]["chat"]["id"]}}
text: Your reply to the incoming message
business_connection_id: {{$json["business_message"]["business_connection_id"]}}
4 Likes

Works flawlessly. Thank you Dimapo!

Hello.
I can’t replicate this with my parameters.
I’m not a coding expert. Could you please point out what I did wrong?
Error code 400
Bussines Mode - turn on
Privacy Mode - turn off


hello @Vladyslav_Nechyporen

  • Body Content Type: JSON
  • Specify Body: Using Fields Below

2 Likes

This is because you put your body content in the field called “Body Content Type”. Delete all this, select JSON in that field and then create 3 pairs of name/value parameters with the data (e.g. name=chat_id and value=your expression).

1 Like

Спасибо Михаил. Заработало.
Thank you. Now it works as it should.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.