Skip to content

feat(linq): add Linq iMessage/SMS/RCS integration#4831

Merged
waleedlatif1 merged 1 commit into
stagingfrom
waleedlatif1/add-integration-v1
Jun 1, 2026
Merged

feat(linq): add Linq iMessage/SMS/RCS integration#4831
waleedlatif1 merged 1 commit into
stagingfrom
waleedlatif1/add-integration-v1

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Add a complete Linq integration (iMessage / SMS / RCS messaging) with 34 tools spanning chats, messages, attachments, phone numbers, capability checks, contact cards, and webhook subscriptions
  • Single linq block (API-key auth, Communication) with an operation dropdown, conditional fields, and full param wiring
  • Attachments use the canonical Sim file-upload pattern: a file-upload subBlock → internal /api/tools/linq/upload route (withRouteHandler + contract + downloadFileFromStorage) that performs Linq's two-step pre-upload + presigned PUT
  • Official Linq icon on a black background; generated docs with a hand-written intro section
  • Verified every tool, request/response shape, and field name against Linq's live API docs (https://docs.linqapp.com/api)

Type of Change

  • New feature (integration)

Testing

Tested manually. bun run lint clean; bun run check:api-validation:strict passes (route baseline bumped 758→759 for the new upload route, counted as Zod-backed via contract). Each tool independently re-audited against live docs via parallel review.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jun 1, 2026 8:03pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented Jun 1, 2026

PR Summary

Medium Risk
Large additive surface area and external messaging API calls; attachment upload handles user files and API keys but follows existing integration patterns with auth on the upload route.

Overview
Adds a Linq integration so workflows can send and manage iMessage, SMS, and RCS via API key.

The PR introduces 34 linq_* tools (chats, messages, attachments, phone numbers, iMessage/RCS checks, contact cards, webhooks) wired through a single linq workflow block with an operation dropdown and conditional fields. Attachment uploads go through a new authenticated /api/tools/linq/upload route (Zod contract, storage download, Linq pre-upload + presigned PUT) instead of calling Linq directly from the client.

Docs and discovery get a new linq.mdx page, LinqIcon in icon maps, a landing integrations.json entry, and block/tool registry entries. The API validation script baseline is bumped by one route for the upload endpoint.

Reviewed by Cursor Bugbot for commit 88bf28c. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 1, 2026

Greptile Summary

This PR adds a complete Linq iMessage/SMS/RCS integration to Sim — 34 tools covering chats, messages, attachments, phone numbers, capability checks, contact cards, and webhook subscriptions — all wired through a single linq block with API-key auth and an operation dropdown.

  • The file-upload flow (create_attachment) correctly proxies through an internal /api/tools/linq/upload route that enforces internal auth, file-access authorization, and Linq's 100 MB cap before executing the two-step presigned-PUT protocol.
  • buildMessageContent and the send_voice_memo body builder both include runtime guards that surface clear errors when no content is supplied, addressing concerns raised in prior review rounds.
  • The block's field-remapping layer (e.g. webhookTargetUrltargetUrl, contactPhoneNumberphoneNumber) is consistent with tool param names across all 34 operations.

Confidence Score: 5/5

This PR is safe to merge; the new Linq integration is well-scoped, follows established patterns, and carries no changes to existing functionality.

All 34 tools follow the same auth, error-handling, and response-mapping conventions as existing integrations. The file-upload proxy route correctly chains auth, access authorization, size validation, and the two-step Linq presigned-PUT flow. Prior review concerns around empty-body messages and voice-memo double-dereference were resolved in the earlier commit. The one remaining suggestion (guarding against empty PUT bodies in update_chat and update_webhook_subscription) is a defensive-coding improvement, not a current defect.

apps/sim/tools/linq/update_chat.ts and apps/sim/tools/linq/update_webhook_subscription.ts — both PUT endpoints can receive an empty body when all optional fields are omitted.

Important Files Changed

Filename Overview
apps/sim/app/api/tools/linq/upload/route.ts New internal route implementing Linq's two-step pre-upload flow; validates auth, size limit, and file presence; correctly uses assertToolFileAccess and downloadFileFromStorage.
apps/sim/blocks/blocks/linq.ts Single block with 34 operations and complex params-mapping function; field remapping is consistent with tool param names; update_chat and update_webhook_subscription can produce empty PUT bodies when all optional fields are omitted.
apps/sim/tools/linq/utils.ts Shared utilities; buildMessageContent correctly throws when no content parts are assembled; error extraction handles both nested and flat response shapes.
apps/sim/tools/linq/create_attachment.ts Delegates to the internal /api/tools/linq/upload route; correctly unwraps data.output.
apps/sim/tools/linq/update_webhook_subscription.ts Uses PUT with all-optional body fields; empty body possible when no optional fields are provided.
apps/sim/tools/linq/types.ts Comprehensive type definitions for all 34 tools.
apps/sim/lib/api/contracts/tools/communication/messaging.ts Adds linqUploadAttachmentBodySchema and contract correctly.
apps/sim/tools/registry.ts All 34 Linq tools correctly registered under linq_* keys.

Sequence Diagram

sequenceDiagram
    participant Block as Linq Block (UI)
    participant Tool as linq_create_attachment tool
    participant Route as /api/tools/linq/upload
    participant Auth as checkInternalAuth
    participant Storage as File Storage
    participant LinqReg as Linq POST /attachments
    participant S3 as Presigned PUT URL

    Block->>Tool: "params { apiKey, file, filename, contentType }"
    Tool->>Route: POST /api/tools/linq/upload (JSON body)
    Route->>Auth: checkInternalAuth(request)
    Auth-->>Route: "{ success, userId }"
    Route->>Route: parseRequest(linqUploadAttachmentContract)
    alt file provided (UserFile reference)
        Route->>Storage: downloadFileFromStorage(userFile)
        Storage-->>Route: buffer
    else fileContent provided (base64)
        Route->>Route: Buffer.from(fileContent, 'base64')
    end
    Route->>Route: validate size ≤ 100MB
    Route->>LinqReg: "POST /attachments { filename, content_type, size_bytes }"
    LinqReg-->>Route: "{ attachment_id, upload_url, required_headers, http_method }"
    Route->>S3: PUT upload_url (file bytes, required_headers)
    S3-->>Route: 200 OK
    Route-->>Tool: "{ success: true, output: { attachmentId, downloadUrl, … } }"
    Tool-->>Block: output.attachmentId
Loading

Reviews (4): Last reviewed commit: "feat(linq): add Linq iMessage/SMS/RCS in..." | Re-trigger Greptile

Comment thread apps/sim/tools/linq/send_voice_memo.ts
Comment thread apps/sim/tools/linq/send_voice_memo.ts
Comment thread apps/sim/tools/linq/send_message.ts
Comment thread apps/sim/blocks/blocks/linq.ts
@waleedlatif1 waleedlatif1 force-pushed the waleedlatif1/add-integration-v1 branch 2 times, most recently from 5d63850 to cc22eb1 Compare June 1, 2026 19:18
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/tools/linq/types.ts Outdated
@waleedlatif1 waleedlatif1 force-pushed the waleedlatif1/add-integration-v1 branch from cc22eb1 to 21534a1 Compare June 1, 2026 19:26
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/blocks/blocks/linq.ts
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 88bf28c. Configure here.

@waleedlatif1 waleedlatif1 force-pushed the waleedlatif1/add-integration-v1 branch from 88bf28c to 1fdf75f Compare June 1, 2026 19:59
@waleedlatif1 waleedlatif1 merged commit e5a46d7 into staging Jun 1, 2026
13 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/add-integration-v1 branch June 1, 2026 20:44
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