Skip to content

Commit 76c22e9

Browse files
aadamgoughAdam Goughgreptile-apps[bot]
authored
feat(docs): added tutorial videos & telegram logic added for user-agent (#348)
* telegram logic added for user-agent * telegram and clay updated * added more tool videos and descriptions * Update apps/docs/content/docs/tools/google_search.mdx Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Update apps/docs/content/docs/tools/google_drive.mdx Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Update apps/docs/content/docs/tools/google_docs.mdx Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Update apps/docs/content/docs/tools/google_docs.mdx Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Update apps/docs/content/docs/tools/google_docs.mdx Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * docs update * added new google docs youtube vid --------- Co-authored-by: Adam Gough <adamgough@Adams-MacBook-Pro.local> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
1 parent 626dafa commit 76c22e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+394
-7
lines changed

apps/docs/content/docs/tools/clay.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ import { BlockInfoCard } from '@/components/ui/block-info-card'
174174
{/* MANUAL-CONTENT-START:intro */}
175175
[Clay](https://www.clay.com/) is a data enrichment and workflow automation platform that helps teams streamline lead generation, research, and data operations through powerful integrations and flexible inputs.
176176

177+
Learn how to use the Clay Tool in Sim Studio to seamlessly insert data into a Clay workbook through webhook triggers. This tutorial walks you through setting up a webhook, configuring data mapping, and automating real-time updates to your Clay workbooks. Perfect for streamlining lead generation and data enrichment directly from your workflow!
178+
177179
<iframe
178180
width="100%"
179181
height="400"

apps/docs/content/docs/tools/google_docs.mdx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,42 @@ import { BlockInfoCard } from '@/components/ui/block-info-card'
2929
{/* MANUAL-CONTENT-START:intro */}
3030
[Google Docs](https://docs.google.com) is a powerful cloud-based document creation and editing service that allows users to create, edit, and collaborate on documents in real-time. As part of Google's productivity suite, Google Docs offers a versatile platform for text documents with robust formatting, commenting, and sharing capabilities.
3131

32+
Learn how to integrate the Google Docs "Read" tool in Sim Studio to effortlessly fetch data from your docs and to integrate into your workflows. This tutorial walks you through connecting Google Docs, setting up data reads, and using that information to automate processes in real-time. Perfect for syncing live data with your agents.
33+
34+
<iframe
35+
width="100%"
36+
height="400"
37+
src="https://www.youtube.com/embed/f41gy9rBHhE"
38+
title="Use the Google Docs Read tool in Sim Studio"
39+
frameBorder="0"
40+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
41+
allowFullScreen
42+
></iframe>
43+
44+
Learn how to integrate the Google Docs "Update" tool in Sim Studio to effortlessly add content in your docs through your workflows. This tutorial walks you through connecting Google Docs, configuring data writes, and using that information to automate document updates seamlessly. Perfect for maintaining dynamic, real-time documentation with minimal effort.
45+
46+
<iframe
47+
width="100%"
48+
height="400"
49+
src="https://www.youtube.com/embed/L64ROHS2ivA"
50+
title="Use the Google Docs Update tool in Sim Studio"
51+
frameBorder="0"
52+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
53+
allowFullScreen
54+
></iframe>
55+
56+
Learn how to integrate the Google Docs "Create" tool in Sim Studio to effortlessly generate new documents through your workflows. This tutorial walks you through connecting Google Docs, setting up document creation, and using workflow data to populate content automatically. Perfect for streamlining document generation and enhancing productivity.
57+
58+
<iframe
59+
width="100%"
60+
height="400"
61+
src="https://www.youtube.com/embed/lWpHH4qddWk"
62+
title="Use the Google Docs Create tool in Sim Studio"
63+
frameBorder="0"
64+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
65+
allowFullScreen
66+
></iframe>
67+
3268
With Google Docs, you can:
3369

3470
- **Create and edit documents**: Develop text documents with comprehensive formatting options

apps/docs/content/docs/tools/google_drive.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ import { BlockInfoCard } from '@/components/ui/block-info-card'
4646
{/* MANUAL-CONTENT-START:intro */}
4747
[Google Drive](https://drive.google.com) is Google's cloud storage and file synchronization service that allows users to store files, synchronize files across devices, and share files with others. As a core component of Google's productivity ecosystem, Google Drive offers robust storage, organization, and collaboration capabilities.
4848

49+
Learn how to integrate the Google Drive tool in Sim Studio to effortlessly pull information from your Drive through your workflows. This tutorial walks you through connecting Google Drive, setting up data retrieval, and using stored documents and files to enhance automation. Perfect for syncing important data with your agents in real-time.
50+
51+
<iframe
52+
width="100%"
53+
height="400"
54+
src="https://www.youtube.com/embed/cRoRr4b-EAs"
55+
title="Use the Google Drive tool in Sim Studio"
56+
frameBorder="0"
57+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
58+
allowFullScreen
59+
></iframe>
60+
4961
With Google Drive, you can:
5062

5163
- **Store files in the cloud**: Upload and access your files from anywhere with internet access

apps/docs/content/docs/tools/google_search.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ import { BlockInfoCard } from '@/components/ui/block-info-card'
3232
{/* MANUAL-CONTENT-START:intro */}
3333
[Google Search](https://www.google.com) is the world's most widely used search engine, providing access to billions of web pages and information sources. Google Search uses sophisticated algorithms to deliver relevant search results based on user queries, making it an essential tool for finding information on the internet.
3434

35+
Learn how to integrate the Google Search tool in Sim Studio to effortlessly fetch real-time search results through your workflows. This tutorial walks you through connecting Google Search, configuring search queries, and using live data to enhance automation. Perfect for powering your agents with up-to-date information and smarter decision-making.
36+
37+
<iframe
38+
width="100%"
39+
height="400"
40+
src="https://www.youtube.com/embed/1B7hV9b5UMQ"
41+
title="Use the Google Search tool in Sim Studio"
42+
frameBorder="0"
43+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
44+
allowFullScreen
45+
></iframe>
46+
3547
With Google Search, you can:
3648

3749
- **Find relevant information**: Access billions of web pages with Google's powerful search algorithms

apps/docs/content/docs/tools/google_sheets.mdx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,54 @@ import { BlockInfoCard } from '@/components/ui/block-info-card'
3232
{/* MANUAL-CONTENT-START:intro */}
3333
[Google Sheets](https://sheets.google.com) is a powerful cloud-based spreadsheet application that allows users to create, edit, and collaborate on spreadsheets in real-time. As part of Google's productivity suite, Google Sheets offers a versatile platform for data organization, analysis, and visualization with robust formatting, formula, and sharing capabilities.
3434

35+
Learn how to integrate the Google Sheets "Read" tool in Sim Studio to effortlessly fetch data from your spreadsheets to integrate into your workflows. This tutorial walks you through connecting Google Sheets, setting up data reads, and using that information to automate processes in real-time. Perfect for syncing live data with your agents.
36+
37+
<iframe
38+
width="100%"
39+
height="400"
40+
src="https://www.youtube.com/embed/xxP7MZRuq_0"
41+
title="Use the Google Sheets Read tool in Sim Studio"
42+
frameBorder="0"
43+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
44+
allowFullScreen
45+
></iframe>
46+
47+
Discover how to use the Google Sheets "Write" tool in Sim Studio to automatically send data from your workflows to your Google Sheets. This tutorial covers setting up the integration, configuring write operations, and updating your sheets seamlessly as workflows execute. Perfect for maintaining real-time records without manual input.
48+
49+
<iframe
50+
width="100%"
51+
height="400"
52+
src="https://www.youtube.com/embed/cO86qTj7qeY"
53+
title="Use the Google Sheets Write tool in Sim Studio"
54+
frameBorder="0"
55+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
56+
allowFullScreen
57+
></iframe>
58+
59+
Explore how to leverage the Google Sheets "Update" tool in Sim Studio to modify existing entries in your spreadsheets based on workflow execution. This tutorial demonstrates setting up the update logic, mapping data fields, and synchronizing changes instantly. Perfect for keeping your data current and consistent.
60+
61+
<iframe
62+
width="100%"
63+
height="400"
64+
src="https://www.youtube.com/embed/95by2fL9yn4"
65+
title="Use the Google Sheets Update tool in Sim Studio"
66+
frameBorder="0"
67+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
68+
allowFullScreen
69+
></iframe>
70+
71+
Learn how to use the Google Sheets "Append" tool in Sim Studio to effortlessly add new rows of data to your spreadsheets during workflow execution. This tutorial walks you through setting up the integration, configuring append actions, and ensuring smooth data growth. Perfect for expanding records without manual effort!
72+
73+
<iframe
74+
width="100%"
75+
height="400"
76+
src="https://www.youtube.com/embed/8DgNvLBCsAo"
77+
title="Use the Google Sheets Append tool in Sim Studio"
78+
frameBorder="0"
79+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
80+
allowFullScreen
81+
></iframe>
82+
3583
With Google Sheets, you can:
3684

3785
- **Create and edit spreadsheets**: Develop data-driven documents with comprehensive formatting and calculation options

apps/docs/content/docs/tools/telegram.mdx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,31 @@ import { BlockInfoCard } from '@/components/ui/block-info-card'
4141
{/* MANUAL-CONTENT-START:intro */}
4242
[Telegram](https://telegram.org) is a secure, cloud-based messaging platform that enables fast and reliable communication across devices and platforms. With over 700 million monthly active users, Telegram has established itself as one of the world's leading messaging services, known for its security, speed, and powerful API capabilities.
4343

44+
Telegram's Bot API provides a robust framework for creating automated messaging solutions and integrating communication features into applications. With support for rich media, inline keyboards, and custom commands, Telegram bots can facilitate sophisticated interaction patterns and automated workflows.
45+
46+
Learn how to create a webhook trigger in Sim Studio that seamlessly initiates workflows from Telegram messages. This tutorial walks you through setting up a webhook, configuring it with Telegram's bot API, and triggering automated actions in real-time. Perfect for streamlining tasks directly from your chat!
47+
4448
<iframe
4549
width="100%"
4650
height="400"
47-
src="https://www.youtube.com/embed/nhq2Q8fndFg?start=62"
51+
src="https://www.youtube.com/embed/9oKcJtQ0_IM"
4852
title="Use Telegram with Sim Studio"
4953
frameBorder="0"
5054
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
5155
allowFullScreen
5256
></iframe>
5357

54-
Telegram's Bot API provides a robust framework for creating automated messaging solutions and integrating communication features into applications. With support for rich media, inline keyboards, and custom commands, Telegram bots can facilitate sophisticated interaction patterns and automated workflows.
58+
Learn how to use the Telegram Tool in Sim Studio to seamlessly automate message delivery to any Telegram group. This tutorial walks you through integrating the tool into your workflow, configuring group messaging, and triggering automated updates in real-time. Perfect for enhancing communication directly from your workspace!
59+
60+
<iframe
61+
width="100%"
62+
height="400"
63+
src="https://www.youtube.com/embed/AG55LpUreGI"
64+
title="Use Telegram with Sim Studio"
65+
frameBorder="0"
66+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
67+
allowFullScreen
68+
></iframe>
5569

5670
Key features of Telegram include:
5771

apps/sim/app/api/webhooks/route.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,12 @@ async function createTelegramWebhookSubscription(
385385
allowed_updates: ['message'],
386386
}
387387

388+
// Configure user-agent header to ensure Telegram can identify itself to our middleware
388389
const telegramResponse = await fetch(telegramApiUrl, {
389390
method: 'POST',
390391
headers: {
391392
'Content-Type': 'application/json',
393+
'User-Agent': 'TelegramBot/1.0'
392394
},
393395
body: JSON.stringify(requestBody),
394396
})
@@ -407,6 +409,29 @@ async function createTelegramWebhookSubscription(
407409
logger.info(
408410
`[${requestId}] Successfully created Telegram webhook for webhook ${webhookData.id}.`
409411
)
412+
413+
// Get webhook info to ensure it's properly set up
414+
try {
415+
const webhookInfoUrl = `https://api.telegram.org/bot${botToken}/getWebhookInfo`
416+
const webhookInfo = await fetch(webhookInfoUrl, {
417+
headers: {
418+
'User-Agent': 'TelegramBot/1.0'
419+
}
420+
});
421+
const webhookInfoJson = await webhookInfo.json();
422+
423+
if (webhookInfoJson.ok) {
424+
logger.info(`[${requestId}] Telegram webhook info:`, {
425+
url: webhookInfoJson.result.url,
426+
has_custom_certificate: webhookInfoJson.result.has_custom_certificate,
427+
pending_update_count: webhookInfoJson.result.pending_update_count,
428+
webhookId: webhookData.id
429+
});
430+
}
431+
} catch (error) {
432+
// Non-critical error, just log
433+
logger.warn(`[${requestId}] Failed to get webhook info`, error);
434+
}
410435
} catch (error: any) {
411436
logger.error(
412437
`[${requestId}] Exception during Telegram webhook creation for webhook ${webhookData.id}.`,

apps/sim/app/api/webhooks/test/route.ts

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,124 @@ export async function GET(request: NextRequest) {
127127
})
128128
}
129129

130+
case 'telegram': {
131+
const botToken = providerConfig.botToken
132+
const triggerPhrase = providerConfig.triggerPhrase
133+
134+
if (!botToken || !triggerPhrase) {
135+
logger.warn(`[${requestId}] Telegram webhook missing configuration: ${webhookId}`)
136+
return NextResponse.json(
137+
{ success: false, error: 'Webhook has incomplete configuration' },
138+
{ status: 400 }
139+
)
140+
}
141+
142+
// Test the webhook endpoint with a simple message to check if it's reachable
143+
const testMessage = {
144+
update_id: 12345,
145+
message: {
146+
message_id: 67890,
147+
from: {
148+
id: 123456789,
149+
first_name: "Test",
150+
username: "testbot"
151+
},
152+
chat: {
153+
id: 123456789,
154+
first_name: "Test",
155+
username: "testbot",
156+
type: "private"
157+
},
158+
date: Math.floor(Date.now() / 1000),
159+
text: "This is a test message"
160+
}
161+
}
162+
163+
logger.debug(`[${requestId}] Testing Telegram webhook connection`, {
164+
webhookId,
165+
url: webhookUrl
166+
})
167+
168+
// Make a test request to the webhook endpoint
169+
const response = await fetch(webhookUrl, {
170+
method: 'POST',
171+
headers: {
172+
'Content-Type': 'application/json',
173+
'User-Agent': 'TelegramBot/1.0'
174+
},
175+
body: JSON.stringify(testMessage)
176+
})
177+
178+
// Get the response details
179+
const status = response.status
180+
let responseText = '';
181+
try {
182+
responseText = await response.text();
183+
} catch (e) {
184+
// Ignore if we can't get response text
185+
}
186+
187+
// Consider success if we get a 2xx response
188+
const success = status >= 200 && status < 300
189+
190+
if (success) {
191+
logger.info(`[${requestId}] Telegram webhook test successful: ${webhookId}`)
192+
} else {
193+
logger.warn(`[${requestId}] Telegram webhook test failed: ${webhookId}`, {
194+
status,
195+
responseText
196+
})
197+
}
198+
199+
// Get webhook info from Telegram API
200+
let webhookInfo = null
201+
try {
202+
const webhookInfoUrl = `https://api.telegram.org/bot${botToken}/getWebhookInfo`
203+
const infoResponse = await fetch(webhookInfoUrl, {
204+
headers: {
205+
'User-Agent': 'TelegramBot/1.0'
206+
}
207+
})
208+
if (infoResponse.ok) {
209+
const infoJson = await infoResponse.json()
210+
if (infoJson.ok) {
211+
webhookInfo = infoJson.result
212+
}
213+
}
214+
} catch (e) {
215+
logger.warn(`[${requestId}] Failed to get Telegram webhook info`, e)
216+
}
217+
218+
// Format the curl command for testing
219+
const curlCommand = [
220+
`curl -X POST "${webhookUrl}"`,
221+
`-H "Content-Type: application/json"`,
222+
`-H "User-Agent: TelegramBot/1.0"`,
223+
`-d '${JSON.stringify(testMessage, null, 2)}'`
224+
].join(' \\\n')
225+
226+
return NextResponse.json({
227+
success,
228+
webhook: {
229+
id: foundWebhook.id,
230+
url: webhookUrl,
231+
botToken: `${botToken.substring(0, 5)}...${botToken.substring(botToken.length - 5)}`, // Show partial token for security
232+
triggerPhrase,
233+
isActive: foundWebhook.isActive
234+
},
235+
test: {
236+
status,
237+
responseText,
238+
webhookInfo
239+
},
240+
message: success
241+
? 'Telegram webhook appears to be working. Your bot should now receive messages.'
242+
: 'Telegram webhook test failed. Please check server logs for more details.',
243+
curlCommand,
244+
info: "To fix issues with Telegram webhooks getting 403 Forbidden responses, ensure the webhook request includes a User-Agent header."
245+
})
246+
}
247+
130248
case 'github': {
131249
const contentType = providerConfig.contentType || 'application/json'
132250

apps/sim/app/api/webhooks/trigger/[path]/route.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,26 @@ export async function POST(
189189
foundWebhook = webhooks[0].webhook
190190
foundWorkflow = webhooks[0].workflow
191191

192+
// Special handling for Telegram webhooks to work around middleware User-Agent checks
193+
if (foundWebhook.provider === 'telegram') {
194+
// Log detailed information about the request for debugging
195+
const userAgent = request.headers.get('user-agent') || 'empty'
196+
logger.info(`[${requestId}] Received Telegram webhook request:`, {
197+
userAgent,
198+
path,
199+
clientIp: request.headers.get('x-forwarded-for') || request.headers.get('x-real-ip') || 'unknown',
200+
method: request.method,
201+
contentType: request.headers.get('content-type'),
202+
hasUpdate: !!body?.update_id
203+
})
204+
205+
// Ensure User-Agent headers for Telegram in future requests from the bot
206+
// We can't modify the incoming request, but we can recommend adding it for future setup
207+
if (!userAgent || userAgent === 'empty') {
208+
logger.warn(`[${requestId}] Telegram webhook request missing User-Agent header. Recommend reconfiguring webhook with 'TelegramBot/1.0' User-Agent.`)
209+
}
210+
}
211+
192212
// Detect provider type
193213
const isAirtableWebhook = foundWebhook.provider === 'airtable'
194214
const isGmailWebhook = foundWebhook.provider === 'gmail'

apps/sim/app/w/[id]/components/workflow-block/components/sub-block/components/webhook/components/providers/telegram.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ export function TelegramConfig({
105105
in Telegram to create a bot and copy its token.
106106
</li>
107107
<li>Enter your Bot Token and a trigger phrase above.</li>
108-
<li>Ensure your webhook URL uses HTTPS with a valid SSL certificate.</li>
109108
<li>Save settings and send the trigger phrase to your bot to start the workflow.</li>
110109
</ol>
111110
</InstructionsSection>

0 commit comments

Comments
 (0)