Skip to content

Conversation

@2manslkh
Copy link

Changes

  • Added telegramOptions to allow configuration of message_thread_id and parse_mode (Markdown, MarkdownV2, HTML) when sending messages.
  • Updated createSendAndWaitMessageBody to handle different parse modes for message formatting.
  • Enhanced tests to cover new functionality for sending messages with specified thread ID and HTML parse mode.

Summary

This PR enhances the Telegram "Send and Wait for Response" operation by adding options that were previously only available in other Telegram message operations:

  1. Message Thread ID: Allows the bot to reply to a specific forum topic/thread in supergroups with topics enabled
  2. Parse Mode: Allows choosing between Markdown (Legacy), MarkdownV2, or HTML formatting for the message

These options are consistent with the existing Telegram node operations and provide more flexibility when using the Send and Wait feature.

Related Linear tickets, Github issues, and Community forum posts

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

…rse mode support

- Added `telegramOptions` to allow configuration of `message_thread_id` and `parse_mode` (Markdown, MarkdownV2, HTML) when sending messages.
- Updated `createSendAndWaitMessageBody` to handle different parse modes for message formatting.
- Enhanced tests to cover new functionality for sending messages with specified thread ID and HTML parse mode.
@CLAassistant
Copy link

CLAassistant commented Dec 24, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/nodes-base/nodes/Telegram/GenericFunctions.ts">

<violation number="1" location="packages/nodes-base/nodes/Telegram/GenericFunctions.ts:275">
P2: MarkdownV2 parse mode falls through to the `else` branch which uses legacy Markdown syntax. MarkdownV2 requires escaping special characters (`.`, `-`, `(`, `)`) in URLs. Consider adding explicit handling for MarkdownV2 or documenting that attribution may not render correctly with this mode.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR


if (parseMode === 'HTML') {
text = `${text}\n\n<em>${attributionText}</em><a href="${link}" target="_blank">n8n</a>`;
} else {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: MarkdownV2 parse mode falls through to the else branch which uses legacy Markdown syntax. MarkdownV2 requires escaping special characters (., -, (, )) in URLs. Consider adding explicit handling for MarkdownV2 or documenting that attribution may not render correctly with this mode.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/nodes-base/nodes/Telegram/GenericFunctions.ts, line 275:

<comment>MarkdownV2 parse mode falls through to the `else` branch which uses legacy Markdown syntax. MarkdownV2 requires escaping special characters (`.`, `-`, `(`, `)`) in URLs. Consider adding explicit handling for MarkdownV2 or documenting that attribution may not render correctly with this mode.</comment>

<file context>
@@ -256,23 +256,32 @@ export function getSecretToken(this: IHookFunctions | IWebhookFunctions) {
+
+		if (parseMode === &#39;HTML&#39;) {
+			text = `${text}\n\n&lt;em&gt;${attributionText}&lt;/em&gt;&lt;a href=&quot;${link}&quot; target=&quot;_blank&quot;&gt;n8n&lt;/a&gt;`;
+		} else {
+			text = `${text}\n\n_${attributionText}_[n8n](${link})`;
+		}
</file context>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants