Skip to content

feat(linq): audit fixes + native auto-registering webhook trigger#5301

Merged
waleedlatif1 merged 6 commits into
stagingfrom
worktree-linq-audit
Jul 1, 2026
Merged

feat(linq): audit fixes + native auto-registering webhook trigger#5301
waleedlatif1 merged 6 commits into
stagingfrom
worktree-linq-audit

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Comprehensive audit of the Linq integration (34 tools + block) against the live Linq partner API and OpenAPI spec, with fixes:
    • create_chat: read the sent message from the top-level response.message (was nested under chat, so always null)
    • get_message/edit_message: expose canonical deliveryStatus; mark is_delivered/is_read deprecated
    • send_message: fall back to from_handle.service/preferred_service for the service output
    • list_phone_numbers: migrate deprecated health_statusreputation, add forwardingNumber, guard JSON parse
    • check_imessage/check_rcs: guard response.json() parse
    • mark_chat_read: document 1:1-only / group no-op behavior
  • New native webhook trigger with automatic subscription lifecycle:
    • 6 triggers — message received / delivered / failed / read, reaction added, and all-events
    • Standard Webhooks signature verification (HMAC-SHA256 over {id}.{timestamp}.{body}, whsec_ secret)
    • createSubscription/deleteSubscription register and deregister the Linq webhook automatically on deploy/undeploy — no manual setup
    • event_id-based idempotency; full 27-value WebhookEventType enum for the all-events trigger
  • Regenerated integration docs

Type of Change

  • Bug fix
  • New feature

Testing

Tested manually. Typecheck clean, biome clean, check:api-validation passes. Tools and trigger validated field-by-field against the live Linq OpenAPI spec; signature scheme and event enum verified verbatim.

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)

Tools/block audit (validated against the live Linq partner API + OpenAPI spec):
- create_chat: read the sent message from top-level response.message (was always null)
- get_message/edit_message: expose canonical deliveryStatus; mark is_delivered/is_read deprecated
- send_message: fall back to from_handle.service/preferred_service for service output
- list_phone_numbers: migrate deprecated health_status to reputation; add forwardingNumber; guard JSON parse
- check_imessage/check_rcs: guard response.json() parse
- mark_chat_read: note 1:1-only / group no-op behavior

Native webhook trigger (auto register + deregister):
- 6 triggers (message received/delivered/failed/read, reaction added, all-events)
- Standard Webhooks signature verification (HMAC-SHA256, whsec_ secret)
- createSubscription/deleteSubscription manage the Linq subscription lifecycle
- event_id idempotency; full 27-value WebhookEventType enum for all-events
- regenerated docs
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 1, 2026 12:13am

Request Review

@cursor

cursor Bot commented Jun 30, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
New inbound webhook path with signature verification and stored signing secrets is security-sensitive; subscription lifecycle also depends on user-supplied API keys. Tool output shape changes (deliveryStatus, phone number fields) may affect existing workflows that relied on older fields.

Overview
Adds six Linq workflow triggers (message received/delivered/failed/read, reaction added, and all-events) with block UI wiring, trigger registry entries, and integration metadata/docs.

Implements a Linq webhook provider that verifies Standard Webhooks signatures (HMAC-SHA256, clock skew), maps payloads to trigger inputs, deduplicates on event_id, filters by trigger-specific event_type, and auto-creates/deletes Linq webhook subscriptions on deploy/undeploy using the trigger API key and optional phone-number filters.

Linq tool outputs are aligned with the current API: canonical deliveryStatus on get/edit message (with deprecated isDelivered/isRead), expanded status enum on send, service fallbacks on send, forwardingNumber and reputation (with health_status fallback) on list phone numbers, safer response.json() handling on several tools, tighter RCS check docs (E.164 only), and clarified mark chat read behavior for 1:1 vs group chats.

Reviewed by Cursor Bugbot for commit 1f8c0ef. Configure here.

@greptile-apps

greptile-apps Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates the Linq integration with audited tool fixes and native webhook triggers. The main changes are:

  • Corrected Linq message, delivery status, and phone number output shapes.
  • Added six Linq webhook triggers with automatic subscription create and delete handling.
  • Added Standard Webhooks signature verification for Linq events.
  • Registered the new triggers in the Linq block, trigger registry, docs, and integration metadata.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
apps/sim/triggers/linq/utils.ts Defines shared Linq trigger event mappings, setup text, outputs, and trigger-only configuration fields.
apps/sim/lib/webhooks/providers/linq.ts Adds Linq webhook authentication, event matching, idempotency extraction, and subscription lifecycle handling.
apps/sim/tools/linq/list_phone_numbers.ts Updates phone number response parsing and output metadata for reputation and forwarding number fields.
apps/sim/tools/linq/list_webhook_subscriptions.ts Updates webhook subscription output metadata for nullable response fields.
apps/sim/blocks/blocks/linq.ts Registers the new Linq triggers and their configuration fields on the Linq block.

Reviews (4): Last reviewed commit: "fix(linq): mark nullable list_webhook_su..." | Re-trigger Greptile

Comment thread apps/sim/triggers/linq/utils.ts Outdated
Comment thread apps/sim/tools/linq/list_phone_numbers.ts
…veryStatus enum doc

Final validation against the raw Linq OpenAPI spec confirmed the sent message
is at chat.message (CreateChatResult exposes only chat), so the data.message
fallback was dead code. Also list all 7 DeliveryStatus values in the
send_message output description.
…, nullable forwardingNumber

Review + final pre-merge audit fixes:
- Trigger apiKey/phoneNumbers subblocks collided with the block's tool apiKey
  state key — rename to triggerApiKey/triggerPhoneNumbers (per the namespacing
  rule from #2133) and read them in the webhook handler
- edit_message: the API returns 204 No Content when editing an already-deleted
  message; guard the empty body instead of throwing on response.json()
- list_phone_numbers: mark forwardingNumber output nullable (returns null)
- check_rcs: tighten address hint (RCS is phone-only, not email)
- regenerated docs
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/lib/webhooks/providers/linq.ts Outdated
Comment thread apps/sim/lib/webhooks/providers/linq.ts Outdated
deleteSubscription still read config.apiKey after the credential rename, so
undeploy would skip the DELETE and orphan the Linq subscription. Match
createSubscription's triggerApiKey key.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@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 8f8db29. Configure here.

Comment thread apps/sim/tools/linq/list_phone_numbers.ts
healthStatus returns null when Linq omits reputation/health_status; declare
nullable: true to match the runtime value (same as forwardingNumber).
phoneNumbers/createdAt/updatedAt are null-coerced by mapWebhookSubscription;
declare nullable: true on the array-item schema to match runtime (consistent
with the top-level webhook outputs' optional flags).
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@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 1f8c0ef. Configure here.

@waleedlatif1 waleedlatif1 merged commit c1b84e4 into staging Jul 1, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the worktree-linq-audit branch July 1, 2026 00:19
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