The Linq gateway provides a Python client for Linq’s Partner API V3, enabling iMessage, RCS, and SMS messaging with native Apple features.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/kanoliban/caresupport-original/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Linq is the primary transport layer for CareSupport. It supports:- iMessage (blue bubble) — typing indicators, read receipts, tapbacks, screen effects, voice memos
- RCS (Rich Communication Services) — delivery confirmation, read receipts
- SMS (fallback) — universal compatibility
iMessage → RCS → SMS based on recipient capability.
Module: runtime/scripts/linq_gateway.py
Configuration
Linq credentials are loaded fromruntime/config.py:
runtime/scripts/linq_config.json
runtime/config.py:124
Chat Operations
Create Chat
Recipient phone in E.164 format (e.g.,
+16517037981)Text of the first message
Sender phone (defaults to configured Linq Blue number)
Force a specific service:
"iMessage", "RCS", or "SMS". Omit for automatic fallback.iMessage screen effect (e.g.,
{"type": "screen", "name": "confetti"})Whether the chat was created successfully
Persistent UUID for this conversation (use this for all subsequent messages)
UUID of the initial message
Actual service used:
"iMessage", "RCS", or "SMS"runtime/scripts/linq_gateway.py:72
Example:
Send Message
UUID of the chat (from
create_chat or webhook)Message text
Force a specific service (usually omit for auto-fallback)
iMessage screen effect:
{"type": "screen", "name": "fireworks" | "confetti" | "balloons" | "lasers"}UUID of message to reply to (creates iMessage thread)
Public URL of media to attach (up to 10MB)
Pre-uploaded attachment ID (for files >10MB, up to 100MB)
Whether the message was sent
UUID of the sent message
Actual service used
"pending", "sent", "delivered", or "failed"runtime/scripts/linq_gateway.py:130
Example:
List Chats
Filter by sender phone (defaults to configured Linq number)
Number of chats to return (max 100)
Pagination cursor from previous response
Whether the request succeeded
List of chat objects
Cursor for next page (empty if no more results)
runtime/scripts/linq_gateway.py:108
iMessage Features
Typing Indicators
runtime/scripts/linq_gateway.py:214
runtime/scripts/linq_gateway.py:220
Read Receipts
runtime/scripts/linq_gateway.py:228
Reactions (Tapbacks)
UUID of the message to react to
Reaction type:
"love" ❤️, "like" 👍, "dislike" 👎, "laugh" 😂, "emphasize" ‼️, "question" ❓, or "custom"Custom emoji for
reaction_type="custom" (e.g., "🎉")Message part to react to (for multi-part messages)
runtime/scripts/linq_gateway.py:189
runtime/scripts/linq_gateway.py:204
Example:
Voice Memos
Chat UUID
Public URL of audio file (MP3, M4A, AAC, CAF, WAV, AIFF, AMR; max 10MB)
Sender phone (defaults to configured Linq number)
runtime/scripts/linq_gateway.py:243
Contact Card
runtime/scripts/linq_gateway.py:236
Group Chat
Add Participant
Group chat UUID (must have 3+ existing participants)
Phone number or email to add
runtime/scripts/linq_gateway.py:256
Remove Participant
runtime/scripts/linq_gateway.py:262
Attachments
Pre-Upload (Large Files)
Original filename (e.g.,
"lab_results.pdf")MIME type (e.g.,
"application/pdf")File size in bytes (max 100MB)
Whether pre-upload was successful
Presigned URL to
PUT the file to (expires in 1 hour)ID to reference in
send_message(attachment_id=...)runtime/scripts/linq_gateway.py:270
Example:
Webhooks
List Subscriptions
Whether the request succeeded
List of active webhook subscriptions
runtime/scripts/linq_gateway.py:295
Create Subscription
Public HTTPS URL to receive webhook events
Event types to subscribe to:
"message.created"— Inbound message received"message.updated"— Delivery status changed"reaction.created"— Tapback received"reaction.removed"— Tapback removed"chat.created"— New chat initiated
API version for webhook payload schema
Whether the subscription was created
UUID of the subscription
HMAC-SHA256 secret for verifying webhook authenticity (store securely!)
runtime/scripts/linq_gateway.py:303
Example:
Delete Subscription
runtime/scripts/linq_gateway.py:319
Verify Webhook Signature
Raw request body (do NOT parse first)
X-Linq-Timestamp header valueX-Linq-Signature header value (hex-encoded HMAC)True if signature is valid, False if forged
Location: runtime/scripts/linq_gateway.py:327
Example (Flask webhook receiver):
Phone Numbers
Whether the request succeeded
List of phone number objects
runtime/scripts/linq_gateway.py:285
CLI Usage
Integration with SMS Handler
The polling loop (poll_inbound.py) calls Linq API to check for new messages, then passes them to the SMS handler:
runtime/scripts/poll_inbound.py
Related
- SMS Handler — Core message processing pipeline
- Configuration — Linq credentials and settings