Skip to content

Feat/telegram#314

Merged
waleedlatif1 merged 20 commits intosimstudioai:mainfrom
aadamgough:feat/telegram
May 2, 2025
Merged

Feat/telegram#314
waleedlatif1 merged 20 commits intosimstudioai:mainfrom
aadamgough:feat/telegram

Conversation

@aadamgough
Copy link
Copy Markdown
Contributor

@aadamgough aadamgough commented Apr 30, 2025

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Fixes #242

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

I created my own telegram bot, tested the send message tool by having the bot send a message to me using the chat ID and bot token. For the Webhook, I configured the Webhook using the bot token and trigger phrase, sent my bot the trigger phrase message, and saw that the workflow executed by reviewing the logs. I created clear instructions in the Webhook instruction for users to follow. Configuring the Telegram API with the chatID is the more reliable than using the @username for Telegram.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally and in CI (npm test)
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • I have updated version numbers as needed (if needed)
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Security Considerations:

  • My changes do not introduce any new security vulnerabilities
  • I have considered the security implications of my changes

Additional Information:

Any additional information, configuration or data that might be necessary to reproduce the issue or use the feature.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 2, 2025 3:38am

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2025

Someone is attempting to deploy a commit to the Sim Studio Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2025

Deployment failed with the following error:

The provided GitHub repository does not contain the requested branch or commit reference. Please ensure the repository is not empty.

Comment thread docs/content/docs/tools/jira.mdx Outdated
Comment thread docs/content/docs/tools/telegram.mdx Outdated
Copy link
Copy Markdown

@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.

mrge found 19 issues across 17 files. View them in mrge.io

// For Telegram, provide more specific error messages
if (webhookProvider === 'telegram') {
const errorMessage = data.message || data.error || 'Webhook test failed'
if (errorMessage.includes('SSL')) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Brittle error detection using string matching

airtableBaseId,
airtableTableId,
airtableIncludeCellValues,
telegramBotToken,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sensitive data stored in component state

text: string
}

export interface TelegramMessageResponse extends ToolResponse {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Inconsistent indentation. This interface has 2 extra spaces compared to the TelegramMessageParams interface above it.

botToken: string
chatId: string
text: string
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing newline at end of file which is a common coding standard.

@@ -0,0 +1,120 @@
import React, { useEffect } from 'react'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The useEffect hook is imported but never used in the component

}
})

const responseBody = await telegramResponse.json()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing error handling for json parsing which could throw if response is not valid JSON

import { ToolConfig } from '../types'
import { TelegramMessageParams, TelegramMessageResponse } from './types'

export const telegramMessageTool: ToolConfig<TelegramMessageParams, TelegramMessageResponse> = {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The return type TelegramMessageResponse doesn't match the actual return structure in transformResponse

Comment thread sim/components/icons.tsx
)
}

export function TelegramIcon(props: SVGProps<SVGSVGElement>) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The TelegramIcon component is missing accessibility attributes

Comment thread sim/components/icons.tsx
return (
<svg
{...props}
width="40"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hardcoded width and height values may cause inconsistency with other icons

const [discordAvatarUrl, setDiscordAvatarUrl] = useState('')
const [slackSigningSecret, setSlackSigningSecret] = useState('')

const [telegramBotToken, setTelegramBotToken] = useState('')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Rule violated: Prevent Default Empty Values for Required Security Parameters

  Security parameter 'telegramBotToken' is initialized with an empty string default

@waleedlatif1 waleedlatif1 merged commit 47d3cbe into simstudioai:main May 2, 2025
4 of 5 checks passed
aadamgough added a commit to aadamgough/sim that referenced this pull request May 4, 2025
…ioai#314)

* jira and confluence token refresh

* telegram message tool

* webhook configured

* telegram requires permanent url

* webhook working

* telegram done

* test

* telegram webhook working

* package-lock.json

* style curl command

* added setWebhook logic

* added some documentation for chat ID

* styling changes

* added delete webhook logic

* adding docs

* updated docs for jira and telegram

* added links

* moved function to other route.ts

* logger

* mrge.io changes

---------

Co-authored-by: Adam Gough <adamgough@Adams-MacBook-Pro.local>
@aadamgough aadamgough deleted the feat/telegram branch June 14, 2025 23:11
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.

[REQUEST] Telegram block/tool/webhook

2 participants