Skip to content

feat(integrations): extend Telegram, Outlook, and Notion tool depth#5265

Merged
waleedlatif1 merged 13 commits into
stagingfrom
feat/integration-tool-depth-wave2
Jun 29, 2026
Merged

feat(integrations): extend Telegram, Outlook, and Notion tool depth#5265
waleedlatif1 merged 13 commits into
stagingfrom
feat/integration-tool-depth-wave2

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Wave 2 of integration tool-depth: deepens three high-adoption blocks that were shallow relative to their APIs. Every operation reuses the integration's existing auth — no new OAuth scopes, so connected users don't re-consent. lib/oauth/oauth.ts is untouched.

What's added (36 new tools)

Telegram (bot token, no scopes) — outbound was send-only; adds interactivity

  • telegram_edit_message_text, telegram_forward_message, telegram_copy_message, telegram_send_location, telegram_send_contact, telegram_send_poll, telegram_pin_message, telegram_unpin_message, telegram_set_message_reaction, telegram_send_chat_action, telegram_get_chat, telegram_get_chat_member

Outlook (reuses Mail.ReadWrite + Mail.Send) — was much thinner than Gmail

  • outlook_reply, outlook_reply_all, outlook_list_folders, outlook_create_folder, outlook_list_attachments, outlook_get_attachment, outlook_search, outlook_update_message (categories/flag/importance)

Notion (capability-based, scopes: []) — could create pages but not edit page content

  • block children CRUD (append_blocks, retrieve_block_children, update_block, delete_block), create_comment, list_comments, list_users, retrieve_user — added to both the notion and notion_v2 blocks

Notes

  • Each tool is wired into its block's operation dropdown with conditioned subBlocks; type coercions live in tools.config.params (execution-time), never in tools.config.tool.
  • Request/response shapes verified against each provider's live API docs.
  • No new canonical-param groups (canonical-pair block test passes).
  • Docs + integrations.json catalog regenerated from the block registry.

Validation

  • bunx tsc --noEmit: clean across changed files
  • bunx biome check: clean (39 files)
  • blocks/blocks.test.ts: 83/83 pass (incl. canonical-param test)
  • bun run check:api-validation: passed

@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jun 29, 2026 7:49pm

Request Review

@cursor

cursor Bot commented Jun 29, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Large surface area of new external API write paths (mail replies, Notion block deletes, Telegram message edits) increases regression and misuse risk, though existing credentials and scopes are reused.

Overview
Adds 36 new workflow tools across three integrations, each wired into block operation dropdowns, the tool registry (including Notion _v2 variants), regenerated docs, and integrations.json—without changing OAuth scopes.

Notion gains block-child CRUD (append_blocks, retrieve_block_children, update_block, delete_block), comments (create_comment, list_comments), and user lookup (list_users, retrieve_user), with new subBlocks, JSON/pageSize coercion in params, and expanded v2 outputs.

Outlook adds search, reply/reply-all, folder list/create, attachment list/get (with file output), message metadata updates (categories, flag, importance), and reorders copy alongside the new operations in the block UI.

Telegram adds edit/forward/copy, location/contact/poll/chat-action sends, pin/unpin/reactions, and get_chat / get_chat_member, with shared numeric/boolean coercion in the block params mapper.

Integration copy and usage instructions are updated to reflect the broader capability sets; Telegram docs add example templates for polls and pin/reaction flows.

Reviewed by Cursor Bugbot for commit 628f5cd. Configure here.

Comment thread apps/sim/tools/outlook/search.ts
Comment thread apps/sim/blocks/blocks/notion.ts
@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR is Wave 2 of integration tool-depth, adding 36 new tools across Telegram (12), Outlook (8), and Notion (16 including v1/v2 pairs) — all reusing existing auth without new OAuth scopes. Prior review threads raised JSON-coercion and error-masking issues; all have been addressed in follow-up commits (normalizePollOptions, normalizeCategories, framework-level error handling).

  • Telegram: Adds edit, forward, copy, pin/unpin, reaction, send-location/contact/poll/chat-action, and get-chat/member; the tool dispatch function is simplified from a switch to params.operation || 'telegram_message' since operation IDs now directly match tool IDs.
  • Outlook: Adds reply, reply-all, search, folder CRUD, attachment list/get, and update-message (categories/flag/importance); the block reuses the shared actionMessageId subBlock across all single-message operations, and a normalizeCategories helper handles the JSON-typed categories param.
  • Notion: Adds block-children CRUD (append_blocks, retrieve_block_children, update_block, delete_block), comment CRUD, and user list/retrieve — each shipped as v1/v2 tool pairs consistent with the existing Notion pattern.

Confidence Score: 5/5

Safe to merge — all 36 new tools reuse existing auth flows, JSON-coercion edge cases raised in prior reviews have been fixed, and the block routing changes are additive and isolated.

The tool implementations follow established patterns throughout the codebase: transformResponse is reached only after the framework validates HTTP success, JSON-typed params are normalized before use, and the Telegram tool-dispatch simplification is correct because operation IDs now directly match tool registry keys. No changed path introduces incorrect data flow, broken auth, or silent failure.

No files require special attention. The telegram/index.ts re-export of all types (export * from './types') is an unusual addition but does not cause conflicts or runtime issues.

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/telegram.ts Adds 12 new Telegram operations; simplifies tool dispatch to `params.operation
apps/sim/blocks/blocks/outlook.ts Adds 8 new Outlook operations (search, reply, reply-all, folder CRUD, attachment fetch, update-message); correctly reuses shared subBlocks like actionMessageId across new operations and maps block inputs to canonical tool params.
apps/sim/blocks/blocks/notion.ts Adds 8 new Notion operations (block CRUD, comments, users); subBlocks and params routing are consistent with the existing pattern; v1/v2 switch correctly routes both block versions.
apps/sim/tools/telegram/send_poll.ts New tool to send Telegram polls; includes normalizePollOptions helper to safely coerce JSON-typed input delivered as array, JSON string, or newline-separated text, with a min-2 guard.
apps/sim/tools/outlook/update_message.ts New PATCH tool for Outlook message categories/flag/importance; normalizeCategories accepts array, JSON-array string, or comma/newline-delimited string — fixes previously flagged silent-drop issue.
apps/sim/tools/outlook/search.ts New Graph $search tool; strips double-quotes from user query before wrapping it in the outer quotes required by Graph — works for simple keyword searches but silently drops advanced KQL quoting.
apps/sim/tools/notion/append_blocks.ts New tool to append Notion block children; parseChildren coerces JSON-typed param from agent calls; ships both v1 and v2 tool objects to match existing Notion pattern.
apps/sim/tools/notion/update_block.ts New PATCH block tool; parseBlock normalizes JSON-typed block param and merges the archived field safely; body spread pattern matches Notion's PATCH spec.
apps/sim/tools/notion/create_comment.ts New tool to post Notion comments; validates that at least one of pageId/discussionId is present in the body builder; ships v1 and v2 variants.
apps/sim/tools/outlook/get_attachment.ts Fetches a single attachment and returns base64 contentBytes for file-type attachments; correctly checks @odata.type before populating the attachments array; non-file attachment types yield an empty attachments list.
apps/sim/tools/telegram/index.ts Registers all 12 new Telegram tools; adds export * from './types' at the bottom, which re-exports all Telegram types from the index — unusual for this codebase but not harmful.
apps/sim/tools/registry.ts Imports and registers all 36 new tools under their canonical string keys; alphabetical grouping and key naming patterns are consistent with existing registry entries.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph Telegram["Telegram Block (12 new tools)"]
        TG_OP[operation param] --> TG_TOOL["tool = params.operation"]
        TG_TOOL --> TG_EDIT[telegram_edit_message_text]
        TG_TOOL --> TG_FWD[telegram_forward_message]
        TG_TOOL --> TG_COPY[telegram_copy_message]
        TG_TOOL --> TG_LOC[telegram_send_location]
        TG_TOOL --> TG_CONTACT[telegram_send_contact]
        TG_TOOL --> TG_POLL[telegram_send_poll
normalizePollOptions]
        TG_TOOL --> TG_PIN[telegram_pin_message]
        TG_TOOL --> TG_UNPIN[telegram_unpin_message]
        TG_TOOL --> TG_REACT[telegram_set_message_reaction]
        TG_TOOL --> TG_ACTION[telegram_send_chat_action]
        TG_TOOL --> TG_CHAT[telegram_get_chat]
        TG_TOOL --> TG_MEMBER[telegram_get_chat_member]
    end

    subgraph Outlook["Outlook Block (8 new tools)"]
        OL_OP[operation param] --> OL_TOOL[tool switch]
        OL_TOOL --> OL_REPLY[outlook_reply
outlook_reply_all]
        OL_TOOL --> OL_SEARCH[outlook_search
$search param]
        OL_TOOL --> OL_FOLDERS[outlook_list_folders
outlook_create_folder]
        OL_TOOL --> OL_ATTACH[outlook_list_attachments
outlook_get_attachment]
        OL_TOOL --> OL_UPDATE[outlook_update_message
normalizeCategories]
    end

    subgraph Notion["Notion Block (8 new tools × v1+v2)"]
        NO_OP[operation param] --> NO_TOOL[tool switch]
        NO_TOOL --> NO_BLOCK[append_blocks
retrieve_block_children
update_block
delete_block]
        NO_TOOL --> NO_COMMENT[create_comment
list_comments]
        NO_TOOL --> NO_USER[list_users
retrieve_user]
        NO_BLOCK -->|JSON-typed params| PARSE["parseChildren / parseBlock
(coerce string → object/array)"]
    end
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    subgraph Telegram["Telegram Block (12 new tools)"]
        TG_OP[operation param] --> TG_TOOL["tool = params.operation"]
        TG_TOOL --> TG_EDIT[telegram_edit_message_text]
        TG_TOOL --> TG_FWD[telegram_forward_message]
        TG_TOOL --> TG_COPY[telegram_copy_message]
        TG_TOOL --> TG_LOC[telegram_send_location]
        TG_TOOL --> TG_CONTACT[telegram_send_contact]
        TG_TOOL --> TG_POLL[telegram_send_poll
normalizePollOptions]
        TG_TOOL --> TG_PIN[telegram_pin_message]
        TG_TOOL --> TG_UNPIN[telegram_unpin_message]
        TG_TOOL --> TG_REACT[telegram_set_message_reaction]
        TG_TOOL --> TG_ACTION[telegram_send_chat_action]
        TG_TOOL --> TG_CHAT[telegram_get_chat]
        TG_TOOL --> TG_MEMBER[telegram_get_chat_member]
    end

    subgraph Outlook["Outlook Block (8 new tools)"]
        OL_OP[operation param] --> OL_TOOL[tool switch]
        OL_TOOL --> OL_REPLY[outlook_reply
outlook_reply_all]
        OL_TOOL --> OL_SEARCH[outlook_search
$search param]
        OL_TOOL --> OL_FOLDERS[outlook_list_folders
outlook_create_folder]
        OL_TOOL --> OL_ATTACH[outlook_list_attachments
outlook_get_attachment]
        OL_TOOL --> OL_UPDATE[outlook_update_message
normalizeCategories]
    end

    subgraph Notion["Notion Block (8 new tools × v1+v2)"]
        NO_OP[operation param] --> NO_TOOL[tool switch]
        NO_TOOL --> NO_BLOCK[append_blocks
retrieve_block_children
update_block
delete_block]
        NO_TOOL --> NO_COMMENT[create_comment
list_comments]
        NO_TOOL --> NO_USER[list_users
retrieve_user]
        NO_BLOCK -->|JSON-typed params| PARSE["parseChildren / parseBlock
(coerce string → object/array)"]
    end
Loading

Reviews (10): Last reviewed commit: "fix(outlook): use consistent set/replace..." | Re-trigger Greptile

Comment thread apps/sim/tools/outlook/reply.ts
Comment thread apps/sim/tools/notion/append_blocks.ts
Comment thread apps/sim/tools/telegram/send_poll.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/blocks/blocks/notion.ts
Comment thread apps/sim/tools/outlook/search.ts
…wlines) so json-typed input can't crash on .map
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/blocks/blocks/telegram.ts Outdated
Comment thread apps/sim/tools/outlook/update_message.ts
…ult, and telegram poll options

- outlook: strip embedded double quotes from the $search term so they can't break the quoted KQL query
- notion: default the update_block Archive dropdown to 'Leave unchanged' so updates don't send an unintended archived:false restore flag
- telegram: pass raw poll options through to the tool's normalizePollOptions (handles array/JSON-string/newlines) so the block layer no longer mishandles JSON-string input
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/blocks/blocks/notion.ts
…n pageSize

- outlook: normalize update_message categories (array, JSON string, or comma/newline) so a JSON-string value isn't silently dropped
- notion: clamp pageSize to Notion's 1-100 range (truncated) so out-of-range values don't hit an API error
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/blocks/blocks/outlook.ts
Comment thread apps/sim/tools/outlook/list_attachments.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/tools/outlook/update_message.ts
…rray

An explicit empty array now sends categories:[] to clear all labels, a non-empty value replaces, and an absent/empty value leaves them untouched — matching the documented replace semantics.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/tools/outlook/update_message.ts
… delimiter-only string

A string that normalizes to no categories (e.g. just commas) is now a no-op rather than clearing all labels; clearing requires an explicit empty array.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/tools/notion/list_comments.ts Outdated
…ents/users and block children

Adds a shared clampNotionPageSize helper so the agent-direct path is bounded to Notion's range, not just the block path.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/blocks/blocks/outlook.ts
…ries

Categories are replaced with the provided non-empty list and left unchanged when empty, consistent across the block and agent paths. Drops the ambiguous empty-array clear (clearing all categories isn't expressible unambiguously from the comma-separated field) and updates the description to match.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 628f5cd. Configure here.

@waleedlatif1 waleedlatif1 merged commit 69e3550 into staging Jun 29, 2026
16 checks passed
@waleedlatif1 waleedlatif1 deleted the feat/integration-tool-depth-wave2 branch June 29, 2026 20:02
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.

1 participant