Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegram Node: sendChatAction supports topics in supergroups #9382

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

neoromantic
Copy link

@neoromantic neoromantic commented May 13, 2024

Summary

Currently, in sendChatAction there's no method to send chat action into a topic in group.

This PR adds "additional fields" option with "message thread id" field, that allows specifying topic to send chat action to.

image

Review / Merge checklist

  • PR title and summary are descriptive.
  • Docs updated or follow-up ticket created.

@CLAassistant
Copy link

CLAassistant commented May 13, 2024

CLA assistant check
All committers have signed the CLA.

@n8n-assistant n8n-assistant bot added community Authored by a community member node/improvement New feature or request labels May 13, 2024
@neoromantic
Copy link
Author

Is there a way I can help with considering this PR to be merged?

@Joffcom
Copy link
Member

Joffcom commented May 20, 2024

Hey @neoromantic,

I will take a quick look now, I am still working through the backlog of PRs. We do consider all PRs but sometimes we don't have a chance to reply to them all.

@Joffcom
Copy link
Member

Joffcom commented May 20, 2024

Hey @neoromantic,

I have taken a look at your change, what that function does and what options the node has available and this change doesn't actually add anything to the sendChatAction API call.

Send Chat Action has 2 inputs the Chat ID and the Action, Both of these values look to be set and sent as part of the request. The addAdditionalFields function adds specifc fields to the request if there are any to add.

What is it that this PR is meant to achieve and did you test it before raising it?

@neoromantic
Copy link
Author

neoromantic commented May 21, 2024

Hey, thank you for investing your time. I have to come clean: I did not do it properly, did not test, just made an assumption that this is one-liner, and wasted some of your time. For that, I am sorry.

I've spent some time and done it properly now.

The purpose of change: support sending chat action in topics in Telegram. It comes down to adding one parameter to a query. It was almost done in existing code, but had not been enabled properly.

Currently there is no option to specify Message Thread ID (which is usually shown in Additional fields in other operations), there are not "additional fields" for sendChatAction.

My change:

  • added "Additional fields" with "Message Thread ID" to sendChatAction operation
  • fixed logic in addAdditionalFields to skip over replyMarkup logic if operation is sendChatAction

I've tested it in production settings in real telegram groups and it works.

Relevant Telegram docs: https://core.telegram.org/bots/api#sendchataction

@Joffcom
Copy link
Member

Joffcom commented May 22, 2024

@neoromantic perfect, I will take a look at this on my next review session.

@neoromantic
Copy link
Author

@Joffcom I've added another PR too: https://github.com/n8n-io/n8n/pull/9531/files

Appreciate if you check that out as well, when you have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Authored by a community member node/improvement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants