Documentation
¶
Index ¶
- Constants
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename string, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type AttachmentGetResponse
- type AttachmentGetResponseStatus
- type AttachmentNewParams
- type AttachmentNewResponse
- type AttachmentNewResponseHTTPMethod
- type AttachmentService
- type CapabilityCheckRCSParams
- type CapabilityCheckiMessageParams
- type CapabilityService
- type Chat
- type ChatCreatedWebhookEvent
- type ChatCreatedWebhookEventData
- type ChatGroupIconUpdateFailedWebhookEvent
- type ChatGroupIconUpdateFailedWebhookEventData
- type ChatGroupIconUpdatedWebhookEvent
- type ChatGroupIconUpdatedWebhookEventData
- type ChatGroupNameUpdateFailedWebhookEvent
- type ChatGroupNameUpdateFailedWebhookEventData
- type ChatGroupNameUpdatedWebhookEvent
- type ChatGroupNameUpdatedWebhookEventData
- type ChatHandle
- type ChatHandleStatus
- type ChatLeaveChatResponse
- type ChatListChatsParams
- type ChatMessageListParams
- type ChatMessageSendParams
- type ChatMessageSendResponse
- type ChatMessageService
- func (r *ChatMessageService) List(ctx context.Context, chatID string, query ChatMessageListParams, ...) (res *pagination.ListMessagesPagination[Message], err error)
- func (r *ChatMessageService) ListAutoPaging(ctx context.Context, chatID string, query ChatMessageListParams, ...) *pagination.ListMessagesPaginationAutoPager[Message]
- func (r *ChatMessageService) Send(ctx context.Context, chatID string, body ChatMessageSendParams, ...) (res *ChatMessageSendResponse, err error)
- type ChatNewParams
- type ChatNewResponse
- type ChatNewResponseChat
- type ChatParticipantAddParams
- type ChatParticipantAddResponse
- type ChatParticipantRemoveParams
- type ChatParticipantRemoveResponse
- type ChatParticipantService
- func (r *ChatParticipantService) Add(ctx context.Context, chatID string, body ChatParticipantAddParams, ...) (res *ChatParticipantAddResponse, err error)
- func (r *ChatParticipantService) Remove(ctx context.Context, chatID string, body ChatParticipantRemoveParams, ...) (res *ChatParticipantRemoveResponse, err error)
- type ChatSendVoicememoParams
- type ChatSendVoicememoResponse
- type ChatSendVoicememoResponseVoiceMemo
- type ChatSendVoicememoResponseVoiceMemoChat
- type ChatSendVoicememoResponseVoiceMemoVoiceMemo
- type ChatService
- func (r *ChatService) Get(ctx context.Context, chatID string, opts ...option.RequestOption) (res *Chat, err error)
- func (r *ChatService) LeaveChat(ctx context.Context, chatID string, opts ...option.RequestOption) (res *ChatLeaveChatResponse, err error)
- func (r *ChatService) ListChats(ctx context.Context, query ChatListChatsParams, opts ...option.RequestOption) (res *pagination.ListChatsPagination[Chat], err error)
- func (r *ChatService) ListChatsAutoPaging(ctx context.Context, query ChatListChatsParams, opts ...option.RequestOption) *pagination.ListChatsPaginationAutoPager[Chat]
- func (r *ChatService) MarkAsRead(ctx context.Context, chatID string, opts ...option.RequestOption) (err error)
- func (r *ChatService) New(ctx context.Context, body ChatNewParams, opts ...option.RequestOption) (res *ChatNewResponse, err error)
- func (r *ChatService) SendVoicememo(ctx context.Context, chatID string, body ChatSendVoicememoParams, ...) (res *ChatSendVoicememoResponse, err error)
- func (r *ChatService) ShareContactCard(ctx context.Context, chatID string, opts ...option.RequestOption) (err error)
- func (r *ChatService) Update(ctx context.Context, chatID string, body ChatUpdateParams, ...) (res *ChatUpdateResponse, err error)
- type ChatTypingIndicatorStartedWebhookEvent
- type ChatTypingIndicatorStartedWebhookEventData
- type ChatTypingIndicatorStoppedWebhookEvent
- type ChatTypingIndicatorStoppedWebhookEventData
- type ChatTypingService
- type ChatUpdateParams
- type ChatUpdateResponse
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, ...) error
- func (r *Client) Get(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Post(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Put(ctx context.Context, path string, params any, res any, ...) error
- type ContactCardGetParams
- type ContactCardGetResponse
- type ContactCardGetResponseContactCard
- type ContactCardNewParams
- type ContactCardService
- func (r *ContactCardService) Get(ctx context.Context, query ContactCardGetParams, opts ...option.RequestOption) (res *ContactCardGetResponse, err error)
- func (r *ContactCardService) New(ctx context.Context, body ContactCardNewParams, opts ...option.RequestOption) (res *SetContactCard, err error)
- func (r *ContactCardService) Update(ctx context.Context, params ContactCardUpdateParams, ...) (res *SetContactCard, err error)
- type ContactCardUpdateParams
- type Error
- type EventsWebhookEventUnion
- func (u EventsWebhookEventUnion) AsChatCreatedWebhookEvent() (v ChatCreatedWebhookEvent)
- func (u EventsWebhookEventUnion) AsChatGroupIconUpdateFailedWebhookEvent() (v ChatGroupIconUpdateFailedWebhookEvent)
- func (u EventsWebhookEventUnion) AsChatGroupIconUpdatedWebhookEvent() (v ChatGroupIconUpdatedWebhookEvent)
- func (u EventsWebhookEventUnion) AsChatGroupNameUpdateFailedWebhookEvent() (v ChatGroupNameUpdateFailedWebhookEvent)
- func (u EventsWebhookEventUnion) AsChatGroupNameUpdatedWebhookEvent() (v ChatGroupNameUpdatedWebhookEvent)
- func (u EventsWebhookEventUnion) AsChatTypingIndicatorStartedWebhookEvent() (v ChatTypingIndicatorStartedWebhookEvent)
- func (u EventsWebhookEventUnion) AsChatTypingIndicatorStoppedWebhookEvent() (v ChatTypingIndicatorStoppedWebhookEvent)
- func (u EventsWebhookEventUnion) AsMessageDeliveredWebhookEvent() (v MessageDeliveredWebhookEvent)
- func (u EventsWebhookEventUnion) AsMessageEditedWebhookEvent() (v MessageEditedWebhookEvent)
- func (u EventsWebhookEventUnion) AsMessageFailedWebhookEvent() (v MessageFailedWebhookEvent)
- func (u EventsWebhookEventUnion) AsMessageReadWebhookEvent() (v MessageReadWebhookEvent)
- func (u EventsWebhookEventUnion) AsMessageReceivedWebhookEvent() (v MessageReceivedWebhookEvent)
- func (u EventsWebhookEventUnion) AsMessageSentWebhookEvent() (v MessageSentWebhookEvent)
- func (u EventsWebhookEventUnion) AsParticipantAddedWebhookEvent() (v ParticipantAddedWebhookEvent)
- func (u EventsWebhookEventUnion) AsParticipantRemovedWebhookEvent() (v ParticipantRemovedWebhookEvent)
- func (u EventsWebhookEventUnion) AsPhoneNumberStatusUpdatedWebhookEvent() (v PhoneNumberStatusUpdatedWebhookEvent)
- func (u EventsWebhookEventUnion) AsReactionAddedWebhookEvent() (v ReactionAddedWebhookEvent)
- func (u EventsWebhookEventUnion) AsReactionRemovedWebhookEvent() (v ReactionRemovedWebhookEvent)
- func (u EventsWebhookEventUnion) RawJSON() string
- func (r *EventsWebhookEventUnion) UnmarshalJSON(data []byte) error
- type EventsWebhookEventUnionData
- type EventsWebhookEventUnionDataChat
- type HandleCheckParam
- type HandleCheckResponse
- type LinkPartParam
- type LinkPartResponse
- type LinkPartResponseType
- type LinkPartType
- type MediaPartParam
- type MediaPartResponse
- type MediaPartResponseType
- type MediaPartType
- type Message
- type MessageAddReactionParams
- type MessageAddReactionParamsOperation
- type MessageAddReactionResponse
- type MessageContentParam
- type MessageContentPartUnionParam
- type MessageDeliveredWebhookEvent
- type MessageEditedWebhookEvent
- type MessageEditedWebhookEventData
- type MessageEditedWebhookEventDataChat
- type MessageEditedWebhookEventDataPart
- type MessageEffect
- type MessageEffectParam
- type MessageEffectType
- type MessageEventV2
- type MessageEventV2Chat
- type MessageEventV2Direction
- type MessageEventV2PartLink
- type MessageEventV2PartUnion
- func (u MessageEventV2PartUnion) AsAny() anyMessageEventV2Part
- func (u MessageEventV2PartUnion) AsLink() (v MessageEventV2PartLink)
- func (u MessageEventV2PartUnion) AsMedia() (v SchemasMediaPartResponse)
- func (u MessageEventV2PartUnion) AsText() (v SchemasTextPartResponse)
- func (u MessageEventV2PartUnion) RawJSON() string
- func (r *MessageEventV2PartUnion) UnmarshalJSON(data []byte) error
- type MessageEventV2PreferredService
- type MessageEventV2ReplyTo
- type MessageFailedWebhookEvent
- type MessageFailedWebhookEventData
- type MessageListMessagesThreadParams
- type MessageListMessagesThreadParamsOrder
- type MessagePartUnion
- func (u MessagePartUnion) AsLinkPartResponse() (v shared.LinkPartResponse)
- func (u MessagePartUnion) AsMediaPartResponse() (v shared.MediaPartResponse)
- func (u MessagePartUnion) AsTextPartResponse() (v shared.TextPartResponse)
- func (u MessagePartUnion) RawJSON() string
- func (r *MessagePartUnion) UnmarshalJSON(data []byte) error
- type MessageReadWebhookEvent
- type MessageReceivedWebhookEvent
- type MessageSentWebhookEvent
- type MessageService
- func (r *MessageService) AddReaction(ctx context.Context, messageID string, body MessageAddReactionParams, ...) (res *MessageAddReactionResponse, err error)
- func (r *MessageService) Delete(ctx context.Context, messageID string, opts ...option.RequestOption) (err error)
- func (r *MessageService) Get(ctx context.Context, messageID string, opts ...option.RequestOption) (res *Message, err error)
- func (r *MessageService) ListMessagesThread(ctx context.Context, messageID string, query MessageListMessagesThreadParams, ...) (res *pagination.ListMessagesPagination[Message], err error)
- func (r *MessageService) ListMessagesThreadAutoPaging(ctx context.Context, messageID string, query MessageListMessagesThreadParams, ...) *pagination.ListMessagesPaginationAutoPager[Message]
- func (r *MessageService) Update(ctx context.Context, messageID string, body MessageUpdateParams, ...) (res *Message, err error)
- type MessageUpdateParams
- type ParticipantAddedWebhookEvent
- type ParticipantAddedWebhookEventData
- type ParticipantRemovedWebhookEvent
- type ParticipantRemovedWebhookEventData
- type PhoneNumberListResponse
- type PhoneNumberListResponsePhoneNumber
- type PhoneNumberService
- type PhoneNumberStatusUpdatedWebhookEvent
- type PhoneNumberStatusUpdatedWebhookEventData
- type PhoneNumberStatusUpdatedWebhookEventEventType
- type PhonenumberListResponse
- type PhonenumberListResponsePhoneNumber
- type PhonenumberListResponsePhoneNumberCapabilities
- type PhonenumberService
- type Reaction
- type ReactionAddedWebhookEvent
- type ReactionEventBase
- type ReactionEventBaseSticker
- type ReactionRemovedWebhookEvent
- type ReactionSticker
- type ReactionType
- type ReplyTo
- type ReplyToParam
- type SchemasMediaPartResponse
- type SchemasMediaPartResponseType
- type SchemasMessageEffect
- type SchemasMessageEffectType
- type SchemasTextPartResponse
- type SchemasTextPartResponseType
- type SentMessage
- type SentMessageDeliveryStatus
- type SentMessagePartUnion
- func (u SentMessagePartUnion) AsLinkPartResponse() (v shared.LinkPartResponse)
- func (u SentMessagePartUnion) AsMediaPartResponse() (v shared.MediaPartResponse)
- func (u SentMessagePartUnion) AsTextPartResponse() (v shared.TextPartResponse)
- func (u SentMessagePartUnion) RawJSON() string
- func (r *SentMessagePartUnion) UnmarshalJSON(data []byte) error
- type ServiceType
- type SetContactCard
- type SupportedContentType
- type TextDecoration
- type TextDecorationAnimation
- type TextDecorationParam
- type TextDecorationStyle
- type TextPartParam
- type TextPartResponse
- type TextPartResponseType
- type TextPartType
- type WebhookEventListResponse
- type WebhookEventService
- type WebhookEventType
- type WebhookService
- type WebhookSubscription
- type WebhookSubscriptionListResponse
- type WebhookSubscriptionNewParams
- type WebhookSubscriptionNewResponse
- type WebhookSubscriptionService
- func (r *WebhookSubscriptionService) Delete(ctx context.Context, subscriptionID string, opts ...option.RequestOption) (err error)
- func (r *WebhookSubscriptionService) Get(ctx context.Context, subscriptionID string, opts ...option.RequestOption) (res *WebhookSubscription, err error)
- func (r *WebhookSubscriptionService) List(ctx context.Context, opts ...option.RequestOption) (res *WebhookSubscriptionListResponse, err error)
- func (r *WebhookSubscriptionService) New(ctx context.Context, body WebhookSubscriptionNewParams, ...) (res *WebhookSubscriptionNewResponse, err error)
- func (r *WebhookSubscriptionService) Update(ctx context.Context, subscriptionID string, ...) (res *WebhookSubscription, err error)
- type WebhookSubscriptionUpdateParams
Constants ¶
const ChatHandleStatusActive = shared.ChatHandleStatusActive
Equals "active"
const ChatHandleStatusLeft = shared.ChatHandleStatusLeft
Equals "left"
const ChatHandleStatusRemoved = shared.ChatHandleStatusRemoved
Equals "removed"
const LinkPartResponseTypeLink = shared.LinkPartResponseTypeLink
Equals "link"
const MediaPartResponseTypeMedia = shared.MediaPartResponseTypeMedia
Equals "media"
const ReactionTypeCustom = shared.ReactionTypeCustom
Equals "custom"
const ReactionTypeDislike = shared.ReactionTypeDislike
Equals "dislike"
const ReactionTypeEmphasize = shared.ReactionTypeEmphasize
Equals "emphasize"
const ReactionTypeLaugh = shared.ReactionTypeLaugh
Equals "laugh"
const ReactionTypeLike = shared.ReactionTypeLike
Equals "like"
const ReactionTypeLove = shared.ReactionTypeLove
Equals "love"
const ReactionTypeQuestion = shared.ReactionTypeQuestion
Equals "question"
const ReactionTypeSticker = shared.ReactionTypeSticker
Equals "sticker"
const ServiceTypeRCS = shared.ServiceTypeRCS
Equals "RCS"
const ServiceTypeSMS = shared.ServiceTypeSMS
Equals "SMS"
const ServiceTypeiMessage = shared.ServiceTypeiMessage
Equals "iMessage"
const TextDecorationAnimationBig = shared.TextDecorationAnimationBig
Equals "big"
const TextDecorationAnimationBloom = shared.TextDecorationAnimationBloom
Equals "bloom"
const TextDecorationAnimationExplode = shared.TextDecorationAnimationExplode
Equals "explode"
const TextDecorationAnimationJitter = shared.TextDecorationAnimationJitter
Equals "jitter"
const TextDecorationAnimationNod = shared.TextDecorationAnimationNod
Equals "nod"
const TextDecorationAnimationRipple = shared.TextDecorationAnimationRipple
Equals "ripple"
const TextDecorationAnimationShake = shared.TextDecorationAnimationShake
Equals "shake"
const TextDecorationAnimationSmall = shared.TextDecorationAnimationSmall
Equals "small"
const TextDecorationStyleBold = shared.TextDecorationStyleBold
Equals "bold"
const TextDecorationStyleItalic = shared.TextDecorationStyleItalic
Equals "italic"
const TextDecorationStyleStrikethrough = shared.TextDecorationStyleStrikethrough
Equals "strikethrough"
const TextDecorationStyleUnderline = shared.TextDecorationStyleUnderline
Equals "underline"
const TextPartResponseTypeText = shared.TextPartResponseTypeText
Equals "text"
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (LINQ_API_V3_API_KEY, LINQ_API_V3_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type AttachmentGetResponse ¶
type AttachmentGetResponse struct {
// Unique identifier for the attachment (UUID)
ID string `json:"id" api:"required"`
// Supported MIME types for file attachments and media URLs.
//
// **Images:** image/jpeg, image/png, image/gif, image/heic, image/heif,
// image/tiff, image/bmp
//
// **Videos:** video/mp4, video/quicktime, video/mpeg, video/3gpp
//
// **Audio:** audio/mpeg, audio/mp4, audio/x-m4a, audio/x-caf, audio/wav,
// audio/aiff, audio/aac, audio/amr
//
// **Documents:** application/pdf, text/plain, text/markdown, text/vcard, text/rtf,
// text/csv, text/html, text/calendar, application/msword,
// application/vnd.openxmlformats-officedocument.wordprocessingml.document,
// application/vnd.ms-excel,
// application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
// application/vnd.ms-powerpoint,
// application/vnd.openxmlformats-officedocument.presentationml.presentation,
// application/vnd.apple.pages, application/vnd.apple.numbers,
// application/vnd.apple.keynote, application/epub+zip, application/zip
//
// **Unsupported:** WebP, SVG, FLAC, OGG, and executable files are explicitly
// rejected.
//
// Any of "image/jpeg", "image/jpg", "image/png", "image/gif", "image/heic",
// "image/heif", "image/tiff", "image/bmp", "image/x-ms-bmp", "video/mp4",
// "video/quicktime", "video/mpeg", "video/x-m4v", "video/3gpp", "audio/mpeg",
// "audio/mp3", "audio/mp4", "audio/x-m4a", "audio/m4a", "audio/x-caf",
// "audio/wav", "audio/x-wav", "audio/aiff", "audio/x-aiff", "audio/aac",
// "audio/x-aac", "audio/amr", "application/pdf", "text/plain", "text/markdown",
// "text/vcard", "text/x-vcard", "text/rtf", "application/rtf", "text/csv",
// "text/html", "text/calendar", "application/msword",
// "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
// "application/vnd.ms-excel",
// "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
// "application/vnd.ms-powerpoint",
// "application/vnd.openxmlformats-officedocument.presentationml.presentation",
// "application/vnd.apple.pages", "application/x-iwork-pages-sffpages",
// "application/vnd.apple.numbers", "application/x-iwork-numbers-sffnumbers",
// "application/vnd.apple.keynote", "application/x-iwork-keynote-sffkey",
// "application/epub+zip", "application/zip", "application/x-zip-compressed".
ContentType SupportedContentType `json:"content_type" api:"required"`
// When the attachment was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Original filename of the attachment
Filename string `json:"filename" api:"required"`
// Size of the attachment in bytes
SizeBytes int64 `json:"size_bytes" api:"required"`
// Current upload/processing status
//
// Any of "pending", "complete", "failed".
Status AttachmentGetResponseStatus `json:"status" api:"required"`
// URL to download the attachment
DownloadURL string `json:"download_url" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ContentType respjson.Field
CreatedAt respjson.Field
Filename respjson.Field
SizeBytes respjson.Field
Status respjson.Field
DownloadURL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AttachmentGetResponse) RawJSON ¶
func (r AttachmentGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AttachmentGetResponse) UnmarshalJSON ¶
func (r *AttachmentGetResponse) UnmarshalJSON(data []byte) error
type AttachmentGetResponseStatus ¶
type AttachmentGetResponseStatus string
Current upload/processing status
const ( AttachmentGetResponseStatusPending AttachmentGetResponseStatus = "pending" AttachmentGetResponseStatusComplete AttachmentGetResponseStatus = "complete" AttachmentGetResponseStatusFailed AttachmentGetResponseStatus = "failed" )
type AttachmentNewParams ¶
type AttachmentNewParams struct {
// Supported MIME types for file attachments and media URLs.
//
// **Images:** image/jpeg, image/png, image/gif, image/heic, image/heif,
// image/tiff, image/bmp
//
// **Videos:** video/mp4, video/quicktime, video/mpeg, video/3gpp
//
// **Audio:** audio/mpeg, audio/mp4, audio/x-m4a, audio/x-caf, audio/wav,
// audio/aiff, audio/aac, audio/amr
//
// **Documents:** application/pdf, text/plain, text/markdown, text/vcard, text/rtf,
// text/csv, text/html, text/calendar, application/msword,
// application/vnd.openxmlformats-officedocument.wordprocessingml.document,
// application/vnd.ms-excel,
// application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
// application/vnd.ms-powerpoint,
// application/vnd.openxmlformats-officedocument.presentationml.presentation,
// application/vnd.apple.pages, application/vnd.apple.numbers,
// application/vnd.apple.keynote, application/epub+zip, application/zip
//
// **Unsupported:** WebP, SVG, FLAC, OGG, and executable files are explicitly
// rejected.
//
// Any of "image/jpeg", "image/jpg", "image/png", "image/gif", "image/heic",
// "image/heif", "image/tiff", "image/bmp", "image/x-ms-bmp", "video/mp4",
// "video/quicktime", "video/mpeg", "video/x-m4v", "video/3gpp", "audio/mpeg",
// "audio/mp3", "audio/mp4", "audio/x-m4a", "audio/m4a", "audio/x-caf",
// "audio/wav", "audio/x-wav", "audio/aiff", "audio/x-aiff", "audio/aac",
// "audio/x-aac", "audio/amr", "application/pdf", "text/plain", "text/markdown",
// "text/vcard", "text/x-vcard", "text/rtf", "application/rtf", "text/csv",
// "text/html", "text/calendar", "application/msword",
// "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
// "application/vnd.ms-excel",
// "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
// "application/vnd.ms-powerpoint",
// "application/vnd.openxmlformats-officedocument.presentationml.presentation",
// "application/vnd.apple.pages", "application/x-iwork-pages-sffpages",
// "application/vnd.apple.numbers", "application/x-iwork-numbers-sffnumbers",
// "application/vnd.apple.keynote", "application/x-iwork-keynote-sffkey",
// "application/epub+zip", "application/zip", "application/x-zip-compressed".
ContentType SupportedContentType `json:"content_type,omitzero" api:"required"`
// Name of the file to upload
Filename string `json:"filename" api:"required"`
// Size of the file in bytes (max 100MB)
SizeBytes int64 `json:"size_bytes" api:"required"`
// contains filtered or unexported fields
}
func (AttachmentNewParams) MarshalJSON ¶
func (r AttachmentNewParams) MarshalJSON() (data []byte, err error)
func (*AttachmentNewParams) UnmarshalJSON ¶
func (r *AttachmentNewParams) UnmarshalJSON(data []byte) error
type AttachmentNewResponse ¶
type AttachmentNewResponse struct {
// Unique identifier for the attachment (for status checks via GET
// /v3/attachments/{id})
AttachmentID string `json:"attachment_id" api:"required" format:"uuid"`
// Permanent CDN URL for the file. Does not expire. Use the `attachment_id` to
// reference this file in media parts when sending messages.
DownloadURL string `json:"download_url" api:"required" format:"uri"`
// When the upload URL expires (15 minutes from now)
ExpiresAt time.Time `json:"expires_at" api:"required" format:"date-time"`
// HTTP method to use for upload (always PUT)
//
// Any of "PUT".
HTTPMethod AttachmentNewResponseHTTPMethod `json:"http_method" api:"required"`
// HTTP headers that must be set on the upload request. The presigned URL is signed
// with these exact values — S3 will reject the upload if they don't match.
RequiredHeaders map[string]string `json:"required_headers" api:"required"`
// Presigned URL for uploading the file. PUT the raw binary file content to this
// URL with the `required_headers`. Do not JSON-encode or multipart-wrap the body.
// Expires after 15 minutes.
UploadURL string `json:"upload_url" api:"required" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
AttachmentID respjson.Field
DownloadURL respjson.Field
ExpiresAt respjson.Field
HTTPMethod respjson.Field
RequiredHeaders respjson.Field
UploadURL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AttachmentNewResponse) RawJSON ¶
func (r AttachmentNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AttachmentNewResponse) UnmarshalJSON ¶
func (r *AttachmentNewResponse) UnmarshalJSON(data []byte) error
type AttachmentNewResponseHTTPMethod ¶
type AttachmentNewResponseHTTPMethod string
HTTP method to use for upload (always PUT)
const (
AttachmentNewResponseHTTPMethodPut AttachmentNewResponseHTTPMethod = "PUT"
)
type AttachmentService ¶
type AttachmentService struct {
Options []option.RequestOption
}
Send files (images, videos, documents, audio) with messages by providing a URL in a media part. Pre-uploading via `POST /v3/attachments` is **optional** and only needed for specific optimization scenarios.
## Sending Media via URL (up to 10MB)
Provide a publicly accessible HTTPS URL with a [supported media type](#supported-file-types) in the `url` field of a media part.
```json
{
"parts": [{ "type": "media", "url": "https://your-cdn.com/images/photo.jpg" }]
}
```
This works with any URL you already host — no pre-upload step required. **Maximum file size: 10MB.**
## Pre-Upload (required for files over 10MB)
Use `POST /v3/attachments` when you want to:
- **Send files larger than 10MB** (up to 100MB) — URL-based downloads are limited to 10MB
- **Send the same file to many recipients** — upload once, reuse the `attachment_id` without re-downloading each time
- **Reduce message send latency** — the file is already stored, so sending is faster
**How it works:**
- `POST /v3/attachments` with file metadata → returns a presigned `upload_url` (valid for **15 minutes**) and a permanent `attachment_id`
- PUT the raw file bytes to the `upload_url` with the `required_headers` (no JSON or multipart — just the binary content)
- Reference the `attachment_id` in your media part when sending messages (no expiration)
**Key difference:** When you provide an external `url`, we download and process the file on every send. When you use a pre-uploaded `attachment_id`, the file is already stored — so repeated sends skip the download step entirely.
## Domain Allowlisting
Attachment URLs in API responses are served from `cdn.linqapp.com`. This includes:
- `url` fields in media and voice memo message parts - `download_url` fields in attachment and upload response objects
If your application enforces domain allowlists (e.g., for SSRF protection), add:
``` cdn.linqapp.com ```
## Supported File Types
- **Images:** JPEG, PNG, GIF, HEIC, HEIF, TIFF, BMP - **Videos:** MP4, MOV, M4V - **Audio:** M4A, AAC, MP3, WAV, AIFF, CAF, AMR - **Documents:** PDF, TXT, RTF, CSV, Office formats, ZIP - **Contact & Calendar:** VCF, ICS
## Audio: Attachment vs Voice Memo
Audio files sent as media parts appear as **downloadable file attachments** in iMessage. To send audio as an **iMessage voice memo bubble** (with native inline playback UI), use the dedicated `POST /v3/chats/{chatId}/voicememo` endpoint instead.
## File Size Limits
- **URL-based (`url` field):** 10MB maximum - **Pre-upload (`attachment_id`):** 100MB maximum
AttachmentService contains methods and other services that help with interacting with the linq-api-v3 API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAttachmentService method instead.
func NewAttachmentService ¶
func NewAttachmentService(opts ...option.RequestOption) (r AttachmentService)
NewAttachmentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*AttachmentService) Get ¶
func (r *AttachmentService) Get(ctx context.Context, attachmentID string, opts ...option.RequestOption) (res *AttachmentGetResponse, err error)
Retrieve metadata for a specific attachment including its status, file information, and URLs for downloading.
func (*AttachmentService) New ¶
func (r *AttachmentService) New(ctx context.Context, body AttachmentNewParams, opts ...option.RequestOption) (res *AttachmentNewResponse, err error)
**This endpoint is optional.** You can send media by simply providing a URL in your message's media part — no pre-upload required. Use this endpoint only when you want to upload a file ahead of time for reuse or latency optimization.
Returns a presigned upload URL and a permanent `attachment_id` you can reference in future messages.
## Step 1: Request an upload URL
Call this endpoint with file metadata:
```json POST /v3/attachments
{
"filename": "photo.jpg",
"content_type": "image/jpeg",
"size_bytes": 1024000
}
```
The response includes an `upload_url` (valid for 15 minutes) and a permanent `attachment_id`.
## Step 2: Upload the file
Make a PUT request to the `upload_url` with the raw file bytes as the request body. You **must** include all headers from `required_headers` exactly as returned — the presigned URL is signed with these values and S3 will reject the upload if they don't match.
The request body is the binary file content — **not** JSON, **not** multipart form data. The file must equal `size_bytes` bytes (the value you declared in step 1).
```bash
curl -X PUT "<upload_url from step 1>" \ -H "Content-Type: image/jpeg" \ -H "Content-Length: 1024000" \ --data-binary @photo.jpg
```
## Step 3: Send a message with the attachment
Reference the `attachment_id` in a media part. The ID never expires — use it in as many messages as you want.
```json POST /v3/chats
{
"from": "+15559876543",
"to": ["+15551234567"],
"message": {
"parts": [
{ "type": "media", "attachment_id": "<attachment_id from step 1>" }
]
}
}
```
## When to use this instead of a URL in the media part
- Sending the same file to multiple recipients (avoids re-downloading each time) - Large files where you want to separate upload from message send - Latency-sensitive sends where the file should already be stored
If you just need to send a file once, skip all of this and pass a `url` directly in the media part instead.
**File Size Limit:** 100MB
**Unsupported Types:** WebP, SVG, FLAC, OGG, and executable files are explicitly rejected.
type CapabilityCheckRCSParams ¶ added in v0.2.0
type CapabilityCheckRCSParams struct {
HandleCheck HandleCheckParam
// contains filtered or unexported fields
}
func (CapabilityCheckRCSParams) MarshalJSON ¶ added in v0.2.0
func (r CapabilityCheckRCSParams) MarshalJSON() (data []byte, err error)
func (*CapabilityCheckRCSParams) UnmarshalJSON ¶ added in v0.2.0
func (r *CapabilityCheckRCSParams) UnmarshalJSON(data []byte) error
type CapabilityCheckiMessageParams ¶ added in v0.2.0
type CapabilityCheckiMessageParams struct {
HandleCheck HandleCheckParam
// contains filtered or unexported fields
}
func (CapabilityCheckiMessageParams) MarshalJSON ¶ added in v0.2.0
func (r CapabilityCheckiMessageParams) MarshalJSON() (data []byte, err error)
func (*CapabilityCheckiMessageParams) UnmarshalJSON ¶ added in v0.2.0
func (r *CapabilityCheckiMessageParams) UnmarshalJSON(data []byte) error
type CapabilityService ¶
type CapabilityService struct {
Options []option.RequestOption
}
Check whether a recipient address supports iMessage or RCS before sending a message.
CapabilityService contains methods and other services that help with interacting with the linq-api-v3 API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCapabilityService method instead.
func NewCapabilityService ¶
func NewCapabilityService(opts ...option.RequestOption) (r CapabilityService)
NewCapabilityService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*CapabilityService) CheckRCS ¶ added in v0.2.0
func (r *CapabilityService) CheckRCS(ctx context.Context, body CapabilityCheckRCSParams, opts ...option.RequestOption) (res *HandleCheckResponse, err error)
Check whether a recipient address (phone number) supports RCS messaging.
func (*CapabilityService) CheckiMessage ¶ added in v0.2.0
func (r *CapabilityService) CheckiMessage(ctx context.Context, body CapabilityCheckiMessageParams, opts ...option.RequestOption) (res *HandleCheckResponse, err error)
Check whether a recipient address (phone number or email) is reachable via iMessage.
type Chat ¶
type Chat struct {
// Unique identifier for the chat
ID string `json:"id" api:"required" format:"uuid"`
// When the chat was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Display name for the chat. Defaults to a comma-separated list of recipient
// handles. Can be updated for group chats.
DisplayName string `json:"display_name" api:"required"`
// List of chat participants with full handle details. Always contains at least two
// handles (your phone number and the other participant).
Handles []shared.ChatHandle `json:"handles" api:"required"`
// Whether the chat is archived
IsArchived bool `json:"is_archived" api:"required"`
// Whether this is a group chat
IsGroup bool `json:"is_group" api:"required"`
// When the chat was last updated
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// Messaging service type
//
// Any of "iMessage", "SMS", "RCS".
Service shared.ServiceType `json:"service" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
DisplayName respjson.Field
Handles respjson.Field
IsArchived respjson.Field
IsGroup respjson.Field
UpdatedAt respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Chat) UnmarshalJSON ¶
type ChatCreatedWebhookEvent ¶ added in v0.12.0
type ChatCreatedWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Payload for chat.created webhook events. Matches GET /v3/chats/{chatId}
// response.
Data ChatCreatedWebhookEventData `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for chat.created events
func (ChatCreatedWebhookEvent) RawJSON ¶ added in v0.12.0
func (r ChatCreatedWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCreatedWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *ChatCreatedWebhookEvent) UnmarshalJSON(data []byte) error
type ChatCreatedWebhookEventData ¶ added in v0.12.0
type ChatCreatedWebhookEventData struct {
// Unique identifier for the chat
ID string `json:"id" api:"required" format:"uuid"`
// When the chat was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Display name for the chat. Defaults to a comma-separated list of recipient
// handles. Can be updated for group chats.
DisplayName string `json:"display_name" api:"required"`
// List of chat participants with full handle details. Always contains at least two
// handles (your phone number and the other participant).
Handles []shared.ChatHandle `json:"handles" api:"required"`
// Whether this is a group chat
IsGroup bool `json:"is_group" api:"required"`
// When the chat was last updated
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// Messaging service type
//
// Any of "iMessage", "SMS", "RCS".
Service shared.ServiceType `json:"service" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
DisplayName respjson.Field
Handles respjson.Field
IsGroup respjson.Field
UpdatedAt respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Payload for chat.created webhook events. Matches GET /v3/chats/{chatId} response.
func (ChatCreatedWebhookEventData) RawJSON ¶ added in v0.12.0
func (r ChatCreatedWebhookEventData) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCreatedWebhookEventData) UnmarshalJSON ¶ added in v0.12.0
func (r *ChatCreatedWebhookEventData) UnmarshalJSON(data []byte) error
type ChatGroupIconUpdateFailedWebhookEvent ¶ added in v0.12.0
type ChatGroupIconUpdateFailedWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Error details for chat.group_icon_update_failed webhook events. See
// [WebhookErrorCode](#/components/schemas/WebhookErrorCode) for the full error
// code reference.
Data ChatGroupIconUpdateFailedWebhookEventData `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for chat.group_icon_update_failed events
func (ChatGroupIconUpdateFailedWebhookEvent) RawJSON ¶ added in v0.12.0
func (r ChatGroupIconUpdateFailedWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatGroupIconUpdateFailedWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *ChatGroupIconUpdateFailedWebhookEvent) UnmarshalJSON(data []byte) error
type ChatGroupIconUpdateFailedWebhookEventData ¶ added in v0.12.0
type ChatGroupIconUpdateFailedWebhookEventData struct {
// Chat identifier (UUID) of the group chat
ChatID string `json:"chat_id" api:"required"`
// Error codes in webhook failure events (3007, 4001).
ErrorCode int64 `json:"error_code" api:"required"`
// When the failure was detected
FailedAt time.Time `json:"failed_at" api:"required" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ChatID respjson.Field
ErrorCode respjson.Field
FailedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Error details for chat.group_icon_update_failed webhook events. See [WebhookErrorCode](#/components/schemas/WebhookErrorCode) for the full error code reference.
func (ChatGroupIconUpdateFailedWebhookEventData) RawJSON ¶ added in v0.12.0
func (r ChatGroupIconUpdateFailedWebhookEventData) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatGroupIconUpdateFailedWebhookEventData) UnmarshalJSON ¶ added in v0.12.0
func (r *ChatGroupIconUpdateFailedWebhookEventData) UnmarshalJSON(data []byte) error
type ChatGroupIconUpdatedWebhookEvent ¶ added in v0.12.0
type ChatGroupIconUpdatedWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Payload for chat.group_icon_updated webhook events
Data ChatGroupIconUpdatedWebhookEventData `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for chat.group_icon_updated events
func (ChatGroupIconUpdatedWebhookEvent) RawJSON ¶ added in v0.12.0
func (r ChatGroupIconUpdatedWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatGroupIconUpdatedWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *ChatGroupIconUpdatedWebhookEvent) UnmarshalJSON(data []byte) error
type ChatGroupIconUpdatedWebhookEventData ¶ added in v0.12.0
type ChatGroupIconUpdatedWebhookEventData struct {
// Chat identifier (UUID) of the group chat
ChatID string `json:"chat_id" api:"required"`
// When the update occurred
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// The handle who made the change.
ChangedByHandle shared.ChatHandle `json:"changed_by_handle" api:"nullable"`
// New icon URL (null if the icon was removed)
NewValue string `json:"new_value" api:"nullable"`
// Previous icon URL (null if no previous icon)
OldValue string `json:"old_value" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ChatID respjson.Field
UpdatedAt respjson.Field
ChangedByHandle respjson.Field
NewValue respjson.Field
OldValue respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Payload for chat.group_icon_updated webhook events
func (ChatGroupIconUpdatedWebhookEventData) RawJSON ¶ added in v0.12.0
func (r ChatGroupIconUpdatedWebhookEventData) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatGroupIconUpdatedWebhookEventData) UnmarshalJSON ¶ added in v0.12.0
func (r *ChatGroupIconUpdatedWebhookEventData) UnmarshalJSON(data []byte) error
type ChatGroupNameUpdateFailedWebhookEvent ¶ added in v0.12.0
type ChatGroupNameUpdateFailedWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Error details for chat.group_name_update_failed webhook events. See
// [WebhookErrorCode](#/components/schemas/WebhookErrorCode) for the full error
// code reference.
Data ChatGroupNameUpdateFailedWebhookEventData `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for chat.group_name_update_failed events
func (ChatGroupNameUpdateFailedWebhookEvent) RawJSON ¶ added in v0.12.0
func (r ChatGroupNameUpdateFailedWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatGroupNameUpdateFailedWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *ChatGroupNameUpdateFailedWebhookEvent) UnmarshalJSON(data []byte) error
type ChatGroupNameUpdateFailedWebhookEventData ¶ added in v0.12.0
type ChatGroupNameUpdateFailedWebhookEventData struct {
// Chat identifier (UUID) of the group chat
ChatID string `json:"chat_id" api:"required"`
// Error codes in webhook failure events (3007, 4001).
ErrorCode int64 `json:"error_code" api:"required"`
// When the failure was detected
FailedAt time.Time `json:"failed_at" api:"required" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ChatID respjson.Field
ErrorCode respjson.Field
FailedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Error details for chat.group_name_update_failed webhook events. See [WebhookErrorCode](#/components/schemas/WebhookErrorCode) for the full error code reference.
func (ChatGroupNameUpdateFailedWebhookEventData) RawJSON ¶ added in v0.12.0
func (r ChatGroupNameUpdateFailedWebhookEventData) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatGroupNameUpdateFailedWebhookEventData) UnmarshalJSON ¶ added in v0.12.0
func (r *ChatGroupNameUpdateFailedWebhookEventData) UnmarshalJSON(data []byte) error
type ChatGroupNameUpdatedWebhookEvent ¶ added in v0.12.0
type ChatGroupNameUpdatedWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Payload for chat.group_name_updated webhook events
Data ChatGroupNameUpdatedWebhookEventData `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for chat.group_name_updated events
func (ChatGroupNameUpdatedWebhookEvent) RawJSON ¶ added in v0.12.0
func (r ChatGroupNameUpdatedWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatGroupNameUpdatedWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *ChatGroupNameUpdatedWebhookEvent) UnmarshalJSON(data []byte) error
type ChatGroupNameUpdatedWebhookEventData ¶ added in v0.12.0
type ChatGroupNameUpdatedWebhookEventData struct {
// Chat identifier (UUID) of the group chat
ChatID string `json:"chat_id" api:"required"`
// When the update occurred
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// The handle who made the change.
ChangedByHandle shared.ChatHandle `json:"changed_by_handle" api:"nullable"`
// New group name (null if the name was removed)
NewValue string `json:"new_value" api:"nullable"`
// Previous group name (null if no previous name)
OldValue string `json:"old_value" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ChatID respjson.Field
UpdatedAt respjson.Field
ChangedByHandle respjson.Field
NewValue respjson.Field
OldValue respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Payload for chat.group_name_updated webhook events
func (ChatGroupNameUpdatedWebhookEventData) RawJSON ¶ added in v0.12.0
func (r ChatGroupNameUpdatedWebhookEventData) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatGroupNameUpdatedWebhookEventData) UnmarshalJSON ¶ added in v0.12.0
func (r *ChatGroupNameUpdatedWebhookEventData) UnmarshalJSON(data []byte) error
type ChatHandleStatus ¶
type ChatHandleStatus = shared.ChatHandleStatus
Participant status
This is an alias to an internal type.
type ChatLeaveChatResponse ¶ added in v0.8.0
type ChatLeaveChatResponse struct {
Message string `json:"message"`
Status string `json:"status"`
TraceID string `json:"trace_id"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Status respjson.Field
TraceID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ChatLeaveChatResponse) RawJSON ¶ added in v0.8.0
func (r ChatLeaveChatResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatLeaveChatResponse) UnmarshalJSON ¶ added in v0.8.0
func (r *ChatLeaveChatResponse) UnmarshalJSON(data []byte) error
type ChatListChatsParams ¶ added in v0.2.0
type ChatListChatsParams struct {
// Pagination cursor from the previous response's `next_cursor` field. Omit this
// parameter for the first page of results.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Phone number to filter chats by. Returns chats made from this phone number. Must
// be in E.164 format (e.g., `+13343284472`). The `+` is automatically URL-encoded
// by HTTP clients. If omitted, returns chats across all phone numbers owned by the
// partner.
From param.Opt[string] `query:"from,omitzero" json:"-"`
// Maximum number of chats to return per page
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Filter chats by a participant handle. Only returns chats where this handle is a
// participant. Can be an E.164 phone number (e.g., `+13343284472`) or an email
// address (e.g., `user@example.com`). For phone numbers, the `+` is automatically
// URL-encoded by HTTP clients.
To param.Opt[string] `query:"to,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (ChatListChatsParams) URLQuery ¶ added in v0.2.0
func (r ChatListChatsParams) URLQuery() (v url.Values, err error)
URLQuery serializes ChatListChatsParams's query parameters as `url.Values`.
type ChatMessageListParams ¶
type ChatMessageListParams struct {
// Pagination cursor from previous next_cursor response
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Maximum number of messages to return
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (ChatMessageListParams) URLQuery ¶
func (r ChatMessageListParams) URLQuery() (v url.Values, err error)
URLQuery serializes ChatMessageListParams's query parameters as `url.Values`.
type ChatMessageSendParams ¶
type ChatMessageSendParams struct {
// Message content container. Groups all message-related fields together,
// separating the "what" (message content) from the "where" (routing fields like
// from/to).
Message MessageContentParam `json:"message,omitzero" api:"required"`
// contains filtered or unexported fields
}
func (ChatMessageSendParams) MarshalJSON ¶
func (r ChatMessageSendParams) MarshalJSON() (data []byte, err error)
func (*ChatMessageSendParams) UnmarshalJSON ¶
func (r *ChatMessageSendParams) UnmarshalJSON(data []byte) error
type ChatMessageSendResponse ¶
type ChatMessageSendResponse struct {
// Unique identifier of the chat this message was sent to
ChatID string `json:"chat_id" api:"required" format:"uuid"`
// A message that was sent (used in CreateChat and SendMessage responses)
Message SentMessage `json:"message" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ChatID respjson.Field
Message respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Response for sending a message to a chat
func (ChatMessageSendResponse) RawJSON ¶
func (r ChatMessageSendResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatMessageSendResponse) UnmarshalJSON ¶
func (r *ChatMessageSendResponse) UnmarshalJSON(data []byte) error
type ChatMessageService ¶
type ChatMessageService struct {
Options []option.RequestOption
}
Messages are individual communications within a chat thread.
Messages can include text, media attachments, rich link previews, special effects (like confetti or fireworks), and reactions. All messages are associated with a specific chat and sent from a phone number you own.
Messages support delivery status tracking, read receipts, and editing capabilities.
## Rich Link Previews
Send a URL as a `link` part to deliver it with a rich preview card showing the page's title, description, and image (when available). A `link` part must be the **only** part in the message — it cannot be combined with text or media parts. To send a URL without a preview card, include it in a `text` part instead.
**Limitations:**
- A `link` part cannot be combined with other parts in the same message. - Maximum URL length: 2,048 characters.
ChatMessageService contains methods and other services that help with interacting with the linq-api-v3 API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewChatMessageService method instead.
func NewChatMessageService ¶
func NewChatMessageService(opts ...option.RequestOption) (r ChatMessageService)
NewChatMessageService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ChatMessageService) List ¶
func (r *ChatMessageService) List(ctx context.Context, chatID string, query ChatMessageListParams, opts ...option.RequestOption) (res *pagination.ListMessagesPagination[Message], err error)
Retrieve messages from a specific chat with pagination support.
func (*ChatMessageService) ListAutoPaging ¶ added in v0.2.0
func (r *ChatMessageService) ListAutoPaging(ctx context.Context, chatID string, query ChatMessageListParams, opts ...option.RequestOption) *pagination.ListMessagesPaginationAutoPager[Message]
Retrieve messages from a specific chat with pagination support.
func (*ChatMessageService) Send ¶
func (r *ChatMessageService) Send(ctx context.Context, chatID string, body ChatMessageSendParams, opts ...option.RequestOption) (res *ChatMessageSendResponse, err error)
Send a message to an existing chat. Use this endpoint when you already have a chat ID and want to send additional messages to it.
## Message Effects
You can add iMessage effects to make your messages more expressive. Effects are optional and can be either screen effects (full-screen animations) or bubble effects (message bubble animations).
**Screen Effects:** `confetti`, `fireworks`, `lasers`, `sparkles`, `celebration`, `hearts`, `love`, `balloons`, `happy_birthday`, `echo`, `spotlight`
**Bubble Effects:** `slam`, `loud`, `gentle`, `invisible`
Only one effect type can be applied per message.
## Inline Text Decorations (iMessage only)
Use the `text_decorations` array on a text part to apply styling and animations to character ranges.
Each decoration specifies a `range: [start, end)` and exactly one of `style` or `animation`.
**Styles:** `bold`, `italic`, `strikethrough`, `underline` **Animations:** `big`, `small`, `shake`, `nod`, `explode`, `ripple`, `bloom`, `jitter`
```json
{
"type": "text",
"value": "Hello world",
"text_decorations": [
{ "range": [0, 5], "style": "bold" },
{ "range": [6, 11], "animation": "shake" }
]
}
```
**Note:** Style ranges (bold, italic, etc.) may overlap, but animation ranges must not overlap with other animations or styles. Text decorations only render for iMessage recipients. For SMS/RCS, text decorations are not applied.
type ChatNewParams ¶
type ChatNewParams struct {
// Sender phone number in E.164 format. Must be a phone number that the
// authenticated partner has permission to send from.
From string `json:"from" api:"required"`
// Message content container. Groups all message-related fields together,
// separating the "what" (message content) from the "where" (routing fields like
// from/to).
Message MessageContentParam `json:"message,omitzero" api:"required"`
// Array of recipient handles (phone numbers in E.164 format or email addresses).
// For individual chats, provide one recipient. For group chats, provide multiple.
To []string `json:"to,omitzero" api:"required"`
// contains filtered or unexported fields
}
func (ChatNewParams) MarshalJSON ¶
func (r ChatNewParams) MarshalJSON() (data []byte, err error)
func (*ChatNewParams) UnmarshalJSON ¶
func (r *ChatNewParams) UnmarshalJSON(data []byte) error
type ChatNewResponse ¶
type ChatNewResponse struct {
Chat ChatNewResponseChat `json:"chat" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Chat respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Response for creating a new chat with an initial message
func (ChatNewResponse) RawJSON ¶
func (r ChatNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatNewResponse) UnmarshalJSON ¶
func (r *ChatNewResponse) UnmarshalJSON(data []byte) error
type ChatNewResponseChat ¶
type ChatNewResponseChat struct {
// Unique identifier for the created chat (UUID)
ID string `json:"id" api:"required" format:"uuid"`
// Display name for the chat. Defaults to a comma-separated list of recipient
// handles. Can be updated for group chats.
DisplayName string `json:"display_name" api:"required"`
// List of participants in the chat. Always contains at least two handles (your
// phone number and the other participant).
Handles []shared.ChatHandle `json:"handles" api:"required"`
// Whether this is a group chat
IsGroup bool `json:"is_group" api:"required"`
// A message that was sent (used in CreateChat and SendMessage responses)
Message SentMessage `json:"message" api:"required"`
// Messaging service type
//
// Any of "iMessage", "SMS", "RCS".
Service shared.ServiceType `json:"service" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
DisplayName respjson.Field
Handles respjson.Field
IsGroup respjson.Field
Message respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ChatNewResponseChat) RawJSON ¶
func (r ChatNewResponseChat) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatNewResponseChat) UnmarshalJSON ¶
func (r *ChatNewResponseChat) UnmarshalJSON(data []byte) error
type ChatParticipantAddParams ¶
type ChatParticipantAddParams struct {
// Phone number (E.164 format) or email address of the participant to add
Handle string `json:"handle" api:"required"`
// contains filtered or unexported fields
}
func (ChatParticipantAddParams) MarshalJSON ¶
func (r ChatParticipantAddParams) MarshalJSON() (data []byte, err error)
func (*ChatParticipantAddParams) UnmarshalJSON ¶
func (r *ChatParticipantAddParams) UnmarshalJSON(data []byte) error
type ChatParticipantAddResponse ¶
type ChatParticipantAddResponse struct {
Message string `json:"message"`
Status string `json:"status"`
TraceID string `json:"trace_id"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Status respjson.Field
TraceID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ChatParticipantAddResponse) RawJSON ¶
func (r ChatParticipantAddResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatParticipantAddResponse) UnmarshalJSON ¶
func (r *ChatParticipantAddResponse) UnmarshalJSON(data []byte) error
type ChatParticipantRemoveParams ¶
type ChatParticipantRemoveParams struct {
// Phone number (E.164 format) or email address of the participant to remove
Handle string `json:"handle" api:"required"`
// contains filtered or unexported fields
}
func (ChatParticipantRemoveParams) MarshalJSON ¶
func (r ChatParticipantRemoveParams) MarshalJSON() (data []byte, err error)
func (*ChatParticipantRemoveParams) UnmarshalJSON ¶
func (r *ChatParticipantRemoveParams) UnmarshalJSON(data []byte) error
type ChatParticipantRemoveResponse ¶
type ChatParticipantRemoveResponse struct {
Message string `json:"message"`
Status string `json:"status"`
TraceID string `json:"trace_id"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Status respjson.Field
TraceID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ChatParticipantRemoveResponse) RawJSON ¶
func (r ChatParticipantRemoveResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatParticipantRemoveResponse) UnmarshalJSON ¶
func (r *ChatParticipantRemoveResponse) UnmarshalJSON(data []byte) error
type ChatParticipantService ¶
type ChatParticipantService struct {
Options []option.RequestOption
}
A Chat is a conversation thread with one or more participants.
To begin a chat, you must create a Chat with at least one recipient handle. Including multiple handles creates a group chat.
When creating a chat, the `from` field specifies which of your authorized phone numbers the message originates from. Your authentication token grants access to one or more phone numbers, but the `from` field determines the actual sender.
**Handle Format:**
- Handles can be phone numbers or email addresses
- Phone numbers MUST be in E.164 format (starting with +)
- Phone format: `+[country code][subscriber number]`
- Example phone: `+12223334444` (US), `+442071234567` (UK), `+81312345678` (Japan)
- Example email: `user@example.com`
- No spaces, dashes, or parentheses in phone numbers
ChatParticipantService contains methods and other services that help with interacting with the linq-api-v3 API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewChatParticipantService method instead.
func NewChatParticipantService ¶
func NewChatParticipantService(opts ...option.RequestOption) (r ChatParticipantService)
NewChatParticipantService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ChatParticipantService) Add ¶
func (r *ChatParticipantService) Add(ctx context.Context, chatID string, body ChatParticipantAddParams, opts ...option.RequestOption) (res *ChatParticipantAddResponse, err error)
Add a new participant to an existing group chat.
**Requirements:**
- Group chats only (3+ existing participants)
- New participant must support the same messaging service as the group
- Cross-service additions not allowed (e.g., can't add RCS-only user to iMessage group)
- For cross-service scenarios, create a new chat instead
func (*ChatParticipantService) Remove ¶
func (r *ChatParticipantService) Remove(ctx context.Context, chatID string, body ChatParticipantRemoveParams, opts ...option.RequestOption) (res *ChatParticipantRemoveResponse, err error)
Remove a participant from an existing group chat.
**Requirements:**
- Group chats only - Must have 3+ participants after removal
type ChatSendVoicememoParams ¶
type ChatSendVoicememoParams struct {
// Reference to a voice memo file pre-uploaded via `POST /v3/attachments`. The file
// is already stored, so sends using this ID skip the download step.
//
// Either `voice_memo_url` or `attachment_id` must be provided, but not both.
AttachmentID param.Opt[string] `json:"attachment_id,omitzero" format:"uuid"`
// URL of the voice memo audio file. Must be a publicly accessible HTTPS URL.
//
// Either `voice_memo_url` or `attachment_id` must be provided, but not both.
VoiceMemoURL param.Opt[string] `json:"voice_memo_url,omitzero" format:"uri"`
// contains filtered or unexported fields
}
func (ChatSendVoicememoParams) MarshalJSON ¶
func (r ChatSendVoicememoParams) MarshalJSON() (data []byte, err error)
func (*ChatSendVoicememoParams) UnmarshalJSON ¶
func (r *ChatSendVoicememoParams) UnmarshalJSON(data []byte) error
type ChatSendVoicememoResponse ¶
type ChatSendVoicememoResponse struct {
VoiceMemo ChatSendVoicememoResponseVoiceMemo `json:"voice_memo" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
VoiceMemo respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Response for sending a voice memo to a chat
func (ChatSendVoicememoResponse) RawJSON ¶
func (r ChatSendVoicememoResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatSendVoicememoResponse) UnmarshalJSON ¶
func (r *ChatSendVoicememoResponse) UnmarshalJSON(data []byte) error
type ChatSendVoicememoResponseVoiceMemo ¶
type ChatSendVoicememoResponseVoiceMemo struct {
// Message identifier
ID string `json:"id" api:"required" format:"uuid"`
Chat ChatSendVoicememoResponseVoiceMemoChat `json:"chat" api:"required"`
// When the voice memo was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Sender phone number
From string `json:"from" api:"required"`
// Current delivery status
Status string `json:"status" api:"required"`
// Recipient handles (phone numbers or email addresses)
To []string `json:"to" api:"required"`
VoiceMemo ChatSendVoicememoResponseVoiceMemoVoiceMemo `json:"voice_memo" api:"required"`
// Messaging service type
//
// Any of "iMessage", "SMS", "RCS".
Service shared.ServiceType `json:"service" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Chat respjson.Field
CreatedAt respjson.Field
From respjson.Field
Status respjson.Field
To respjson.Field
VoiceMemo respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ChatSendVoicememoResponseVoiceMemo) RawJSON ¶
func (r ChatSendVoicememoResponseVoiceMemo) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatSendVoicememoResponseVoiceMemo) UnmarshalJSON ¶
func (r *ChatSendVoicememoResponseVoiceMemo) UnmarshalJSON(data []byte) error
type ChatSendVoicememoResponseVoiceMemoChat ¶
type ChatSendVoicememoResponseVoiceMemoChat struct {
// Chat identifier
ID string `json:"id" api:"required" format:"uuid"`
// Chat participants
Handles []shared.ChatHandle `json:"handles" api:"required"`
// Whether the chat is active
IsActive bool `json:"is_active" api:"required"`
// Whether this is a group chat
IsGroup bool `json:"is_group" api:"required"`
// Messaging service type
//
// Any of "iMessage", "SMS", "RCS".
Service shared.ServiceType `json:"service" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Handles respjson.Field
IsActive respjson.Field
IsGroup respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ChatSendVoicememoResponseVoiceMemoChat) RawJSON ¶
func (r ChatSendVoicememoResponseVoiceMemoChat) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatSendVoicememoResponseVoiceMemoChat) UnmarshalJSON ¶
func (r *ChatSendVoicememoResponseVoiceMemoChat) UnmarshalJSON(data []byte) error
type ChatSendVoicememoResponseVoiceMemoVoiceMemo ¶
type ChatSendVoicememoResponseVoiceMemoVoiceMemo struct {
// Attachment identifier
ID string `json:"id" api:"required" format:"uuid"`
// Original filename
Filename string `json:"filename" api:"required"`
// Audio MIME type
MimeType string `json:"mime_type" api:"required"`
// File size in bytes
SizeBytes int64 `json:"size_bytes" api:"required"`
// CDN URL for downloading the voice memo
URL string `json:"url" api:"required" format:"uri"`
// Duration in milliseconds
DurationMs int64 `json:"duration_ms" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Filename respjson.Field
MimeType respjson.Field
SizeBytes respjson.Field
URL respjson.Field
DurationMs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ChatSendVoicememoResponseVoiceMemoVoiceMemo) RawJSON ¶
func (r ChatSendVoicememoResponseVoiceMemoVoiceMemo) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatSendVoicememoResponseVoiceMemoVoiceMemo) UnmarshalJSON ¶
func (r *ChatSendVoicememoResponseVoiceMemoVoiceMemo) UnmarshalJSON(data []byte) error
type ChatService ¶
type ChatService struct {
Options []option.RequestOption
// A Chat is a conversation thread with one or more participants.
//
// To begin a chat, you must create a Chat with at least one recipient handle.
// Including multiple handles creates a group chat.
//
// When creating a chat, the `from` field specifies which of your authorized phone
// numbers the message originates from. Your authentication token grants access to
// one or more phone numbers, but the `from` field determines the actual sender.
//
// **Handle Format:**
//
// - Handles can be phone numbers or email addresses
// - Phone numbers MUST be in E.164 format (starting with +)
// - Phone format: `+[country code][subscriber number]`
// - Example phone: `+12223334444` (US), `+442071234567` (UK), `+81312345678`
// (Japan)
// - Example email: `user@example.com`
// - No spaces, dashes, or parentheses in phone numbers
Participants ChatParticipantService
// A Chat is a conversation thread with one or more participants.
//
// To begin a chat, you must create a Chat with at least one recipient handle.
// Including multiple handles creates a group chat.
//
// When creating a chat, the `from` field specifies which of your authorized phone
// numbers the message originates from. Your authentication token grants access to
// one or more phone numbers, but the `from` field determines the actual sender.
//
// **Handle Format:**
//
// - Handles can be phone numbers or email addresses
// - Phone numbers MUST be in E.164 format (starting with +)
// - Phone format: `+[country code][subscriber number]`
// - Example phone: `+12223334444` (US), `+442071234567` (UK), `+81312345678`
// (Japan)
// - Example email: `user@example.com`
// - No spaces, dashes, or parentheses in phone numbers
Typing ChatTypingService
// Messages are individual communications within a chat thread.
//
// Messages can include text, media attachments, rich link previews, special
// effects (like confetti or fireworks), and reactions. All messages are associated
// with a specific chat and sent from a phone number you own.
//
// Messages support delivery status tracking, read receipts, and editing
// capabilities.
//
// ## Rich Link Previews
//
// Send a URL as a `link` part to deliver it with a rich preview card showing the
// page's title, description, and image (when available). A `link` part must be the
// **only** part in the message — it cannot be combined with text or media parts.
// To send a URL without a preview card, include it in a `text` part instead.
//
// **Limitations:**
//
// - A `link` part cannot be combined with other parts in the same message.
// - Maximum URL length: 2,048 characters.
Messages ChatMessageService
}
ChatService contains methods and other services that help with interacting with the linq-api-v3 API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewChatService method instead.
func NewChatService ¶
func NewChatService(opts ...option.RequestOption) (r ChatService)
NewChatService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ChatService) Get ¶
func (r *ChatService) Get(ctx context.Context, chatID string, opts ...option.RequestOption) (res *Chat, err error)
Retrieve a chat by its unique identifier.
func (*ChatService) LeaveChat ¶ added in v0.8.0
func (r *ChatService) LeaveChat(ctx context.Context, chatID string, opts ...option.RequestOption) (res *ChatLeaveChatResponse, err error)
Removes your phone number from a group chat. Once you leave, you will no longer receive messages from the group and all interaction endpoints (send message, typing, mark read, etc.) will return 409.
A `participant.removed` webhook will fire once the leave has been processed.
**Supported**
- iMessage group chats with 4 or more active participants (including yourself)
**Not supported**
- DM (1-on-1) chats — use the chat directly to continue the conversation
func (*ChatService) ListChats ¶ added in v0.2.0
func (r *ChatService) ListChats(ctx context.Context, query ChatListChatsParams, opts ...option.RequestOption) (res *pagination.ListChatsPagination[Chat], err error)
Retrieves a paginated list of chats for the authenticated partner.
**Filtering:**
- If `from` is provided, returns chats for that specific phone number
- If `from` is omitted, returns chats across all phone numbers owned by the partner
- If `to` is provided, only returns chats where the specified handle is a participant
**Pagination:**
- Use `limit` to control page size (default: 20, max: 100) - The response includes `next_cursor` for fetching the next page - When `next_cursor` is `null`, there are no more results to fetch - Pass the `next_cursor` value as the `cursor` parameter for the next request
**Example pagination flow:**
1. First request: `GET /v3/chats?from=%2B12223334444&limit=20` 2. Response includes `next_cursor: "20"` (more results exist) 3. Next request: `GET /v3/chats?from=%2B12223334444&limit=20&cursor=20` 4. Response includes `next_cursor: null` (no more results)
func (*ChatService) ListChatsAutoPaging ¶ added in v0.2.0
func (r *ChatService) ListChatsAutoPaging(ctx context.Context, query ChatListChatsParams, opts ...option.RequestOption) *pagination.ListChatsPaginationAutoPager[Chat]
Retrieves a paginated list of chats for the authenticated partner.
**Filtering:**
- If `from` is provided, returns chats for that specific phone number
- If `from` is omitted, returns chats across all phone numbers owned by the partner
- If `to` is provided, only returns chats where the specified handle is a participant
**Pagination:**
- Use `limit` to control page size (default: 20, max: 100) - The response includes `next_cursor` for fetching the next page - When `next_cursor` is `null`, there are no more results to fetch - Pass the `next_cursor` value as the `cursor` parameter for the next request
**Example pagination flow:**
1. First request: `GET /v3/chats?from=%2B12223334444&limit=20` 2. Response includes `next_cursor: "20"` (more results exist) 3. Next request: `GET /v3/chats?from=%2B12223334444&limit=20&cursor=20` 4. Response includes `next_cursor: null` (no more results)
func (*ChatService) MarkAsRead ¶
func (r *ChatService) MarkAsRead(ctx context.Context, chatID string, opts ...option.RequestOption) (err error)
Mark all messages in a chat as read.
func (*ChatService) New ¶
func (r *ChatService) New(ctx context.Context, body ChatNewParams, opts ...option.RequestOption) (res *ChatNewResponse, err error)
Create a new chat with specified participants and send an initial message. The initial message is required when creating a chat.
## Message Effects
You can add iMessage effects to make your messages more expressive. Effects are optional and can be either screen effects (full-screen animations) or bubble effects (message bubble animations).
**Screen Effects:** `confetti`, `fireworks`, `lasers`, `sparkles`, `celebration`, `hearts`, `love`, `balloons`, `happy_birthday`, `echo`, `spotlight`
**Bubble Effects:** `slam`, `loud`, `gentle`, `invisible`
Only one effect type can be applied per message.
## Inline Text Decorations (iMessage only)
Use the `text_decorations` array on a text part to apply styling and animations to character ranges.
Each decoration specifies a `range: [start, end)` and exactly one of `style` or `animation`.
**Styles:** `bold`, `italic`, `strikethrough`, `underline` **Animations:** `big`, `small`, `shake`, `nod`, `explode`, `ripple`, `bloom`, `jitter`
```json
{
"type": "text",
"value": "Hello world",
"text_decorations": [
{ "range": [0, 5], "style": "bold" },
{ "range": [6, 11], "animation": "shake" }
]
}
```
**Note:** Style ranges (bold, italic, etc.) may overlap, but animation ranges must not overlap with other animations or styles. Text decorations only render for iMessage recipients. For SMS/RCS, text decorations are not applied.
func (*ChatService) SendVoicememo ¶
func (r *ChatService) SendVoicememo(ctx context.Context, chatID string, body ChatSendVoicememoParams, opts ...option.RequestOption) (res *ChatSendVoicememoResponse, err error)
Send an audio file as an **iMessage voice memo bubble** to all participants in a chat. Voice memos appear with iMessage's native inline playback UI, unlike regular audio attachments sent via media parts which appear as downloadable files.
**Supported audio formats:**
- MP3 (audio/mpeg) - M4A (audio/x-m4a, audio/mp4) - AAC (audio/aac) - CAF (audio/x-caf) - Core Audio Format - WAV (audio/wav) - AIFF (audio/aiff, audio/x-aiff) - AMR (audio/amr)
func (*ChatService) ShareContactCard ¶
func (r *ChatService) ShareContactCard(ctx context.Context, chatID string, opts ...option.RequestOption) (err error)
Share your contact information (Name and Photo Sharing) with a chat.
**Note:** A contact card must be configured before sharing. You can set up your contact card via the [Contact Card API](#tag/Contact-Card) or on the [Linq dashboard](https://dashboard.linqapp.com/contact-cards).
func (*ChatService) Update ¶
func (r *ChatService) Update(ctx context.Context, chatID string, body ChatUpdateParams, opts ...option.RequestOption) (res *ChatUpdateResponse, err error)
Update chat properties such as display name and group chat icon.
Listen for `chat.group_name_updated`, `chat.group_icon_updated`, `chat.group_name_update_failed`, or `chat.group_icon_update_failed` webhook events to confirm the outcome.
type ChatTypingIndicatorStartedWebhookEvent ¶ added in v0.12.0
type ChatTypingIndicatorStartedWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Payload for chat.typing_indicator.started webhook events
Data ChatTypingIndicatorStartedWebhookEventData `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for chat.typing_indicator.started events
func (ChatTypingIndicatorStartedWebhookEvent) RawJSON ¶ added in v0.12.0
func (r ChatTypingIndicatorStartedWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatTypingIndicatorStartedWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *ChatTypingIndicatorStartedWebhookEvent) UnmarshalJSON(data []byte) error
type ChatTypingIndicatorStartedWebhookEventData ¶ added in v0.12.0
type ChatTypingIndicatorStartedWebhookEventData struct {
// Chat identifier
ChatID string `json:"chat_id" api:"required" format:"uuid"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ChatID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Payload for chat.typing_indicator.started webhook events
func (ChatTypingIndicatorStartedWebhookEventData) RawJSON ¶ added in v0.12.0
func (r ChatTypingIndicatorStartedWebhookEventData) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatTypingIndicatorStartedWebhookEventData) UnmarshalJSON ¶ added in v0.12.0
func (r *ChatTypingIndicatorStartedWebhookEventData) UnmarshalJSON(data []byte) error
type ChatTypingIndicatorStoppedWebhookEvent ¶ added in v0.12.0
type ChatTypingIndicatorStoppedWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Payload for chat.typing_indicator.stopped webhook events
Data ChatTypingIndicatorStoppedWebhookEventData `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for chat.typing_indicator.stopped events
func (ChatTypingIndicatorStoppedWebhookEvent) RawJSON ¶ added in v0.12.0
func (r ChatTypingIndicatorStoppedWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatTypingIndicatorStoppedWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *ChatTypingIndicatorStoppedWebhookEvent) UnmarshalJSON(data []byte) error
type ChatTypingIndicatorStoppedWebhookEventData ¶ added in v0.12.0
type ChatTypingIndicatorStoppedWebhookEventData struct {
// Chat identifier
ChatID string `json:"chat_id" api:"required" format:"uuid"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ChatID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Payload for chat.typing_indicator.stopped webhook events
func (ChatTypingIndicatorStoppedWebhookEventData) RawJSON ¶ added in v0.12.0
func (r ChatTypingIndicatorStoppedWebhookEventData) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatTypingIndicatorStoppedWebhookEventData) UnmarshalJSON ¶ added in v0.12.0
func (r *ChatTypingIndicatorStoppedWebhookEventData) UnmarshalJSON(data []byte) error
type ChatTypingService ¶
type ChatTypingService struct {
Options []option.RequestOption
}
A Chat is a conversation thread with one or more participants.
To begin a chat, you must create a Chat with at least one recipient handle. Including multiple handles creates a group chat.
When creating a chat, the `from` field specifies which of your authorized phone numbers the message originates from. Your authentication token grants access to one or more phone numbers, but the `from` field determines the actual sender.
**Handle Format:**
- Handles can be phone numbers or email addresses
- Phone numbers MUST be in E.164 format (starting with +)
- Phone format: `+[country code][subscriber number]`
- Example phone: `+12223334444` (US), `+442071234567` (UK), `+81312345678` (Japan)
- Example email: `user@example.com`
- No spaces, dashes, or parentheses in phone numbers
ChatTypingService contains methods and other services that help with interacting with the linq-api-v3 API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewChatTypingService method instead.
func NewChatTypingService ¶
func NewChatTypingService(opts ...option.RequestOption) (r ChatTypingService)
NewChatTypingService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ChatTypingService) Start ¶
func (r *ChatTypingService) Start(ctx context.Context, chatID string, opts ...option.RequestOption) (err error)
Send a typing indicator to show that someone is typing in the chat.
**Note:** Group chat typing indicators are not currently supported. Attempting to start a typing indicator in a group chat will return a `403` error.
func (*ChatTypingService) Stop ¶
func (r *ChatTypingService) Stop(ctx context.Context, chatID string, opts ...option.RequestOption) (err error)
Stop the typing indicator for the chat.
**Note:** Typing indicators are automatically stopped when a message is sent, so calling this endpoint after sending a message is unnecessary.
**Note:** Group chat typing indicators are not currently supported. Attempting to stop a typing indicator in a group chat will return a `403` error.
type ChatUpdateParams ¶
type ChatUpdateParams struct {
// New display name for the chat (group chats only)
DisplayName param.Opt[string] `json:"display_name,omitzero"`
// URL of an image to set as the group chat icon (group chats only)
GroupChatIcon param.Opt[string] `json:"group_chat_icon,omitzero" format:"uri"`
// contains filtered or unexported fields
}
func (ChatUpdateParams) MarshalJSON ¶
func (r ChatUpdateParams) MarshalJSON() (data []byte, err error)
func (*ChatUpdateParams) UnmarshalJSON ¶
func (r *ChatUpdateParams) UnmarshalJSON(data []byte) error
type ChatUpdateResponse ¶ added in v0.6.1
type ChatUpdateResponse struct {
ChatID string `json:"chat_id" format:"uuid"`
Status string `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ChatID respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ChatUpdateResponse) RawJSON ¶ added in v0.6.1
func (r ChatUpdateResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatUpdateResponse) UnmarshalJSON ¶ added in v0.6.1
func (r *ChatUpdateResponse) UnmarshalJSON(data []byte) error
type Client ¶
type Client struct {
Options []option.RequestOption
Chats ChatService
// Messages are individual communications within a chat thread.
//
// Messages can include text, media attachments, rich link previews, special
// effects (like confetti or fireworks), and reactions. All messages are associated
// with a specific chat and sent from a phone number you own.
//
// Messages support delivery status tracking, read receipts, and editing
// capabilities.
//
// ## Rich Link Previews
//
// Send a URL as a `link` part to deliver it with a rich preview card showing the
// page's title, description, and image (when available). A `link` part must be the
// **only** part in the message — it cannot be combined with text or media parts.
// To send a URL without a preview card, include it in a `text` part instead.
//
// **Limitations:**
//
// - A `link` part cannot be combined with other parts in the same message.
// - Maximum URL length: 2,048 characters.
Messages MessageService
// Send files (images, videos, documents, audio) with messages by providing a URL
// in a media part. Pre-uploading via `POST /v3/attachments` is **optional** and
// only needed for specific optimization scenarios.
//
// ## Sending Media via URL (up to 10MB)
//
// Provide a publicly accessible HTTPS URL with a
// [supported media type](#supported-file-types) in the `url` field of a media
// part.
//
// “`json
//
// {
// "parts": [{ "type": "media", "url": "https://your-cdn.com/images/photo.jpg" }]
// }
//
// “`
//
// This works with any URL you already host — no pre-upload step required.
// **Maximum file size: 10MB.**
//
// ## Pre-Upload (required for files over 10MB)
//
// Use `POST /v3/attachments` when you want to:
//
// - **Send files larger than 10MB** (up to 100MB) — URL-based downloads are
// limited to 10MB
// - **Send the same file to many recipients** — upload once, reuse the
// `attachment_id` without re-downloading each time
// - **Reduce message send latency** — the file is already stored, so sending is
// faster
//
// **How it works:**
//
// 1. `POST /v3/attachments` with file metadata → returns a presigned `upload_url`
// (valid for **15 minutes**) and a permanent `attachment_id`
// 2. PUT the raw file bytes to the `upload_url` with the `required_headers` (no
// JSON or multipart — just the binary content)
// 3. Reference the `attachment_id` in your media part when sending messages (no
// expiration)
//
// **Key difference:** When you provide an external `url`, we download and process
// the file on every send. When you use a pre-uploaded `attachment_id`, the file is
// already stored — so repeated sends skip the download step entirely.
//
// ## Domain Allowlisting
//
// Attachment URLs in API responses are served from `cdn.linqapp.com`. This
// includes:
//
// - `url` fields in media and voice memo message parts
// - `download_url` fields in attachment and upload response objects
//
// If your application enforces domain allowlists (e.g., for SSRF protection), add:
//
// “`
// cdn.linqapp.com
// “`
//
// ## Supported File Types
//
// - **Images:** JPEG, PNG, GIF, HEIC, HEIF, TIFF, BMP
// - **Videos:** MP4, MOV, M4V
// - **Audio:** M4A, AAC, MP3, WAV, AIFF, CAF, AMR
// - **Documents:** PDF, TXT, RTF, CSV, Office formats, ZIP
// - **Contact & Calendar:** VCF, ICS
//
// ## Audio: Attachment vs Voice Memo
//
// Audio files sent as media parts appear as **downloadable file attachments** in
// iMessage. To send audio as an **iMessage voice memo bubble** (with native inline
// playback UI), use the dedicated `POST /v3/chats/{chatId}/voicememo` endpoint
// instead.
//
// ## File Size Limits
//
// - **URL-based (`url` field):** 10MB maximum
// - **Pre-upload (`attachment_id`):** 100MB maximum
Attachments AttachmentService
// Phone Numbers represent the phone numbers assigned to your partner account.
//
// Use the list phone numbers endpoint to discover which phone numbers are
// available for sending messages.
//
// When creating chats, listing chats, or sending a voice memo, use one of your
// assigned phone numbers in the `from` field.
Phonenumbers PhonenumberService
// Phone Numbers represent the phone numbers assigned to your partner account.
//
// Use the list phone numbers endpoint to discover which phone numbers are
// available for sending messages.
//
// When creating chats, listing chats, or sending a voice memo, use one of your
// assigned phone numbers in the `from` field.
PhoneNumbers PhoneNumberService
// Webhook Subscriptions allow you to receive real-time notifications when events
// occur on your account.
//
// Configure webhook endpoints to receive events such as messages sent/received,
// delivery status changes, reactions, typing indicators, and more.
//
// Failed deliveries (5xx, 429, network errors) are retried up to 10 times over ~25
// minutes with exponential backoff. Each event includes a unique ID for
// deduplication.
//
// ## Webhook Headers
//
// Each webhook request includes the following headers:
//
// | Header | Description |
// | --------------------------- | --------------------------------------------------------- |
// | `X-Webhook-Event` | The event type (e.g., `message.sent`, `message.received`) |
// | `X-Webhook-Subscription-ID` | Your webhook subscription ID |
// | `X-Webhook-Timestamp` | Unix timestamp (seconds) when the webhook was sent |
// | `X-Webhook-Signature` | HMAC-SHA256 signature for verification |
//
// ## Verifying Webhook Signatures
//
// All webhooks are signed using HMAC-SHA256. You should always verify the
// signature to ensure the webhook originated from Linq and hasn't been tampered
// with.
//
// **Signature Construction:**
//
// The signature is computed over a concatenation of the timestamp and payload:
//
// “`
// {timestamp}.{payload}
// “`
//
// Where:
//
// - `timestamp` is the value from the `X-Webhook-Timestamp` header
// - `payload` is the raw JSON request body (exact bytes, not re-serialized)
//
// **Verification Steps:**
//
// 1. Extract the `X-Webhook-Timestamp` and `X-Webhook-Signature` headers
// 2. Get the raw request body bytes (do not parse and re-serialize)
// 3. Concatenate: `"{timestamp}.{payload}"`
// 4. Compute HMAC-SHA256 using your signing secret as the key
// 5. Hex-encode the result and compare with `X-Webhook-Signature`
// 6. Use constant-time comparison to prevent timing attacks
//
// **Example (Python):**
//
// “`python
// import hmac
// import hashlib
//
// def verify_webhook(signing_secret, payload, timestamp, signature):
//
// message = f"{timestamp}.{payload.decode('utf-8')}"
// expected = hmac.new(
// signing_secret.encode('utf-8'),
// message.encode('utf-8'),
// hashlib.sha256
// ).hexdigest()
// return hmac.compare_digest(expected, signature)
//
// “`
//
// **Example (Node.js):**
//
// “`javascript
// const crypto = require("crypto");
//
// function verifyWebhook(signingSecret, payload, timestamp, signature) {
// const message = `${timestamp}.${payload}`;
// const expected = crypto
// .createHmac("sha256", signingSecret)
// .update(message)
// .digest("hex");
// return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
// }
//
// “`
//
// **Security Best Practices:**
//
// - Reject webhooks with timestamps older than 5 minutes to prevent replay attacks
// - Always use constant-time comparison for signature verification
// - Store your signing secret securely (e.g., environment variable, secrets
// manager)
// - Return a 2xx status code quickly, then process the webhook asynchronously
WebhookEvents WebhookEventService
// Webhook Subscriptions allow you to receive real-time notifications when events
// occur on your account.
//
// Configure webhook endpoints to receive events such as messages sent/received,
// delivery status changes, reactions, typing indicators, and more.
//
// Failed deliveries (5xx, 429, network errors) are retried up to 10 times over ~25
// minutes with exponential backoff. Each event includes a unique ID for
// deduplication.
//
// ## Webhook Headers
//
// Each webhook request includes the following headers:
//
// | Header | Description |
// | --------------------------- | --------------------------------------------------------- |
// | `X-Webhook-Event` | The event type (e.g., `message.sent`, `message.received`) |
// | `X-Webhook-Subscription-ID` | Your webhook subscription ID |
// | `X-Webhook-Timestamp` | Unix timestamp (seconds) when the webhook was sent |
// | `X-Webhook-Signature` | HMAC-SHA256 signature for verification |
//
// ## Verifying Webhook Signatures
//
// All webhooks are signed using HMAC-SHA256. You should always verify the
// signature to ensure the webhook originated from Linq and hasn't been tampered
// with.
//
// **Signature Construction:**
//
// The signature is computed over a concatenation of the timestamp and payload:
//
// “`
// {timestamp}.{payload}
// “`
//
// Where:
//
// - `timestamp` is the value from the `X-Webhook-Timestamp` header
// - `payload` is the raw JSON request body (exact bytes, not re-serialized)
//
// **Verification Steps:**
//
// 1. Extract the `X-Webhook-Timestamp` and `X-Webhook-Signature` headers
// 2. Get the raw request body bytes (do not parse and re-serialize)
// 3. Concatenate: `"{timestamp}.{payload}"`
// 4. Compute HMAC-SHA256 using your signing secret as the key
// 5. Hex-encode the result and compare with `X-Webhook-Signature`
// 6. Use constant-time comparison to prevent timing attacks
//
// **Example (Python):**
//
// “`python
// import hmac
// import hashlib
//
// def verify_webhook(signing_secret, payload, timestamp, signature):
//
// message = f"{timestamp}.{payload.decode('utf-8')}"
// expected = hmac.new(
// signing_secret.encode('utf-8'),
// message.encode('utf-8'),
// hashlib.sha256
// ).hexdigest()
// return hmac.compare_digest(expected, signature)
//
// “`
//
// **Example (Node.js):**
//
// “`javascript
// const crypto = require("crypto");
//
// function verifyWebhook(signingSecret, payload, timestamp, signature) {
// const message = `${timestamp}.${payload}`;
// const expected = crypto
// .createHmac("sha256", signingSecret)
// .update(message)
// .digest("hex");
// return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
// }
//
// “`
//
// **Security Best Practices:**
//
// - Reject webhooks with timestamps older than 5 minutes to prevent replay attacks
// - Always use constant-time comparison for signature verification
// - Store your signing secret securely (e.g., environment variable, secrets
// manager)
// - Return a 2xx status code quickly, then process the webhook asynchronously
WebhookSubscriptions WebhookSubscriptionService
// Check whether a recipient address supports iMessage or RCS before sending a
// message.
Capability CapabilityService
Webhooks WebhookService
// Contact Card lets you set and share your contact information (name and profile
// photo) with chat participants via iMessage Name and Photo Sharing.
//
// Use `POST /v3/contact_card` to create or update a card for a phone number. Use
// `PATCH /v3/contact_card` to update an existing active card. Use
// `GET /v3/contact_card` to retrieve the active card(s) for your partner account.
//
// **Sharing behavior:** Sharing may not take effect in every chat due to
// limitations outside our control. We recommend calling the share endpoint once
// per day, after the first outbound activity.
ContactCard ContactCardService
}
Client creates a struct with services and top level methods that help with interacting with the linq-api-v3 API. You should not instantiate this client directly, and instead use the NewClient method instead.
func NewClient ¶
func NewClient(opts ...option.RequestOption) (r Client)
NewClient generates a new client with the default option read from the environment (LINQ_API_V3_API_KEY, LINQ_API_V3_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.
func (*Client) Delete ¶
func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Execute ¶
func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error
Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.
If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.
The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.
If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.
Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.
The response body will be deserialized into the res variable, depending on its type:
- A pointer to a *http.Response is populated by the raw response.
- A pointer to a byte array will be populated with the contents of the request body.
- A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
- A nil value will not read the response body.
For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.
func (*Client) Get ¶
func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Patch ¶
func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
type ContactCardGetParams ¶ added in v0.8.0
type ContactCardGetParams struct {
// E.164 phone number to filter by. If omitted, all my cards for the partner are
// returned.
PhoneNumber param.Opt[string] `query:"phone_number,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (ContactCardGetParams) URLQuery ¶ added in v0.8.0
func (r ContactCardGetParams) URLQuery() (v url.Values, err error)
URLQuery serializes ContactCardGetParams's query parameters as `url.Values`.
type ContactCardGetResponse ¶ added in v0.8.0
type ContactCardGetResponse struct {
ContactCards []ContactCardGetResponseContactCard `json:"contact_cards" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ContactCards respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ContactCardGetResponse) RawJSON ¶ added in v0.8.0
func (r ContactCardGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ContactCardGetResponse) UnmarshalJSON ¶ added in v0.8.0
func (r *ContactCardGetResponse) UnmarshalJSON(data []byte) error
type ContactCardGetResponseContactCard ¶ added in v0.8.0
type ContactCardGetResponseContactCard struct {
FirstName string `json:"first_name" api:"required"`
IsActive bool `json:"is_active" api:"required"`
PhoneNumber string `json:"phone_number" api:"required"`
ImageURL string `json:"image_url"`
LastName string `json:"last_name"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FirstName respjson.Field
IsActive respjson.Field
PhoneNumber respjson.Field
ImageURL respjson.Field
LastName respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ContactCardGetResponseContactCard) RawJSON ¶ added in v0.8.0
func (r ContactCardGetResponseContactCard) RawJSON() string
Returns the unmodified JSON received from the API
func (*ContactCardGetResponseContactCard) UnmarshalJSON ¶ added in v0.8.0
func (r *ContactCardGetResponseContactCard) UnmarshalJSON(data []byte) error
type ContactCardNewParams ¶ added in v0.8.0
type ContactCardNewParams struct {
// First name for the contact card. Required.
FirstName string `json:"first_name" api:"required"`
// E.164 phone number to associate the contact card with
PhoneNumber string `json:"phone_number" api:"required"`
// URL of the profile image to rehost on the CDN. Only re-uploaded when a new value
// is provided.
ImageURL param.Opt[string] `json:"image_url,omitzero"`
// Last name for the contact card. Optional.
LastName param.Opt[string] `json:"last_name,omitzero"`
// contains filtered or unexported fields
}
func (ContactCardNewParams) MarshalJSON ¶ added in v0.8.0
func (r ContactCardNewParams) MarshalJSON() (data []byte, err error)
func (*ContactCardNewParams) UnmarshalJSON ¶ added in v0.8.0
func (r *ContactCardNewParams) UnmarshalJSON(data []byte) error
type ContactCardService ¶ added in v0.8.0
type ContactCardService struct {
Options []option.RequestOption
}
Contact Card lets you set and share your contact information (name and profile photo) with chat participants via iMessage Name and Photo Sharing.
Use `POST /v3/contact_card` to create or update a card for a phone number. Use `PATCH /v3/contact_card` to update an existing active card. Use `GET /v3/contact_card` to retrieve the active card(s) for your partner account.
**Sharing behavior:** Sharing may not take effect in every chat due to limitations outside our control. We recommend calling the share endpoint once per day, after the first outbound activity.
ContactCardService contains methods and other services that help with interacting with the linq-api-v3 API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewContactCardService method instead.
func NewContactCardService ¶ added in v0.8.0
func NewContactCardService(opts ...option.RequestOption) (r ContactCardService)
NewContactCardService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ContactCardService) Get ¶ added in v0.8.0
func (r *ContactCardService) Get(ctx context.Context, query ContactCardGetParams, opts ...option.RequestOption) (res *ContactCardGetResponse, err error)
Returns the contact card for a specific phone number, or all contact cards for the authenticated partner if no `phone_number` is provided.
func (*ContactCardService) New ¶ added in v0.8.0
func (r *ContactCardService) New(ctx context.Context, body ContactCardNewParams, opts ...option.RequestOption) (res *SetContactCard, err error)
Creates a contact card for a phone number. This endpoint is intended for initial, one-time setup only.
The contact card is stored in an inactive state first. Once it's applied successfully, it is activated and `is_active` is returned as `true`. On failure, `is_active` is `false`.
**Note:** To update an existing contact card after setup, use `PATCH /v3/contact_card` instead.
func (*ContactCardService) Update ¶ added in v0.8.0
func (r *ContactCardService) Update(ctx context.Context, params ContactCardUpdateParams, opts ...option.RequestOption) (res *SetContactCard, err error)
Partially updates an existing active contact card for a phone number.
Fetches the current active contact card and merges the provided fields. Only fields present in the request body are updated; omitted fields retain their existing values.
Requires an active contact card to exist for the phone number.
type ContactCardUpdateParams ¶ added in v0.8.0
type ContactCardUpdateParams struct {
// E.164 phone number of the contact card to update
PhoneNumber string `query:"phone_number" api:"required" json:"-"`
// Updated first name. If omitted, the existing value is kept.
FirstName param.Opt[string] `json:"first_name,omitzero"`
// Updated profile image URL. If omitted, the existing image is kept.
ImageURL param.Opt[string] `json:"image_url,omitzero"`
// Updated last name. If omitted, the existing value is kept.
LastName param.Opt[string] `json:"last_name,omitzero"`
// contains filtered or unexported fields
}
func (ContactCardUpdateParams) MarshalJSON ¶ added in v0.8.0
func (r ContactCardUpdateParams) MarshalJSON() (data []byte, err error)
func (ContactCardUpdateParams) URLQuery ¶ added in v0.8.0
func (r ContactCardUpdateParams) URLQuery() (v url.Values, err error)
URLQuery serializes ContactCardUpdateParams's query parameters as `url.Values`.
func (*ContactCardUpdateParams) UnmarshalJSON ¶ added in v0.8.0
func (r *ContactCardUpdateParams) UnmarshalJSON(data []byte) error
type EventsWebhookEventUnion ¶ added in v0.2.0
type EventsWebhookEventUnion struct {
APIVersion string `json:"api_version"`
CreatedAt time.Time `json:"created_at"`
// This field is a union of [MessageEventV2], [MessageFailedWebhookEventData],
// [MessageEditedWebhookEventData], [ReactionEventBase],
// [ParticipantAddedWebhookEventData], [ParticipantRemovedWebhookEventData],
// [ChatCreatedWebhookEventData], [ChatGroupNameUpdatedWebhookEventData],
// [ChatGroupIconUpdatedWebhookEventData],
// [ChatGroupNameUpdateFailedWebhookEventData],
// [ChatGroupIconUpdateFailedWebhookEventData],
// [ChatTypingIndicatorStartedWebhookEventData],
// [ChatTypingIndicatorStoppedWebhookEventData],
// [PhoneNumberStatusUpdatedWebhookEventData]
Data EventsWebhookEventUnionData `json:"data"`
EventID string `json:"event_id"`
// Any of nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
// nil, nil, nil, nil.
EventType string `json:"event_type"`
PartnerID string `json:"partner_id"`
TraceID string `json:"trace_id"`
WebhookVersion string `json:"webhook_version"`
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
EventsWebhookEventUnion contains all possible properties and values from MessageSentWebhookEvent, MessageReceivedWebhookEvent, MessageReadWebhookEvent, MessageDeliveredWebhookEvent, MessageFailedWebhookEvent, MessageEditedWebhookEvent, ReactionAddedWebhookEvent, ReactionRemovedWebhookEvent, ParticipantAddedWebhookEvent, ParticipantRemovedWebhookEvent, ChatCreatedWebhookEvent, ChatGroupNameUpdatedWebhookEvent, ChatGroupIconUpdatedWebhookEvent, ChatGroupNameUpdateFailedWebhookEvent, ChatGroupIconUpdateFailedWebhookEvent, ChatTypingIndicatorStartedWebhookEvent, ChatTypingIndicatorStoppedWebhookEvent, PhoneNumberStatusUpdatedWebhookEvent.
Use the [EventsWebhookEventUnion.AsAny] method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (EventsWebhookEventUnion) AsChatCreatedWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsChatCreatedWebhookEvent() (v ChatCreatedWebhookEvent)
func (EventsWebhookEventUnion) AsChatGroupIconUpdateFailedWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsChatGroupIconUpdateFailedWebhookEvent() (v ChatGroupIconUpdateFailedWebhookEvent)
func (EventsWebhookEventUnion) AsChatGroupIconUpdatedWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsChatGroupIconUpdatedWebhookEvent() (v ChatGroupIconUpdatedWebhookEvent)
func (EventsWebhookEventUnion) AsChatGroupNameUpdateFailedWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsChatGroupNameUpdateFailedWebhookEvent() (v ChatGroupNameUpdateFailedWebhookEvent)
func (EventsWebhookEventUnion) AsChatGroupNameUpdatedWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsChatGroupNameUpdatedWebhookEvent() (v ChatGroupNameUpdatedWebhookEvent)
func (EventsWebhookEventUnion) AsChatTypingIndicatorStartedWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsChatTypingIndicatorStartedWebhookEvent() (v ChatTypingIndicatorStartedWebhookEvent)
func (EventsWebhookEventUnion) AsChatTypingIndicatorStoppedWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsChatTypingIndicatorStoppedWebhookEvent() (v ChatTypingIndicatorStoppedWebhookEvent)
func (EventsWebhookEventUnion) AsMessageDeliveredWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsMessageDeliveredWebhookEvent() (v MessageDeliveredWebhookEvent)
func (EventsWebhookEventUnion) AsMessageEditedWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsMessageEditedWebhookEvent() (v MessageEditedWebhookEvent)
func (EventsWebhookEventUnion) AsMessageFailedWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsMessageFailedWebhookEvent() (v MessageFailedWebhookEvent)
func (EventsWebhookEventUnion) AsMessageReadWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsMessageReadWebhookEvent() (v MessageReadWebhookEvent)
func (EventsWebhookEventUnion) AsMessageReceivedWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsMessageReceivedWebhookEvent() (v MessageReceivedWebhookEvent)
func (EventsWebhookEventUnion) AsMessageSentWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsMessageSentWebhookEvent() (v MessageSentWebhookEvent)
func (EventsWebhookEventUnion) AsParticipantAddedWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsParticipantAddedWebhookEvent() (v ParticipantAddedWebhookEvent)
func (EventsWebhookEventUnion) AsParticipantRemovedWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsParticipantRemovedWebhookEvent() (v ParticipantRemovedWebhookEvent)
func (EventsWebhookEventUnion) AsPhoneNumberStatusUpdatedWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsPhoneNumberStatusUpdatedWebhookEvent() (v PhoneNumberStatusUpdatedWebhookEvent)
func (EventsWebhookEventUnion) AsReactionAddedWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsReactionAddedWebhookEvent() (v ReactionAddedWebhookEvent)
func (EventsWebhookEventUnion) AsReactionRemovedWebhookEvent ¶ added in v0.12.0
func (u EventsWebhookEventUnion) AsReactionRemovedWebhookEvent() (v ReactionRemovedWebhookEvent)
func (EventsWebhookEventUnion) RawJSON ¶ added in v0.2.0
func (u EventsWebhookEventUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*EventsWebhookEventUnion) UnmarshalJSON ¶ added in v0.2.0
func (r *EventsWebhookEventUnion) UnmarshalJSON(data []byte) error
type EventsWebhookEventUnionData ¶ added in v0.2.0
type EventsWebhookEventUnionData struct {
ID string `json:"id"`
// This field is a union of [MessageEventV2Chat],
// [MessageEditedWebhookEventDataChat]
Chat EventsWebhookEventUnionDataChat `json:"chat"`
Direction string `json:"direction"`
// This field is from variant [MessageEventV2].
Parts []MessageEventV2PartUnion `json:"parts"`
// This field is from variant [MessageEventV2].
SenderHandle shared.ChatHandle `json:"sender_handle"`
// This field is from variant [MessageEventV2].
Service shared.ServiceType `json:"service"`
// This field is from variant [MessageEventV2].
DeliveredAt time.Time `json:"delivered_at"`
// This field is from variant [MessageEventV2].
Effect SchemasMessageEffect `json:"effect"`
// This field is from variant [MessageEventV2].
IdempotencyKey string `json:"idempotency_key"`
// This field is from variant [MessageEventV2].
PreferredService MessageEventV2PreferredService `json:"preferred_service"`
// This field is from variant [MessageEventV2].
ReadAt time.Time `json:"read_at"`
// This field is from variant [MessageEventV2].
ReplyTo MessageEventV2ReplyTo `json:"reply_to"`
// This field is from variant [MessageEventV2].
SentAt time.Time `json:"sent_at"`
// This field is from variant [MessageFailedWebhookEventData].
Code int64 `json:"code"`
FailedAt time.Time `json:"failed_at"`
ChatID string `json:"chat_id"`
MessageID string `json:"message_id"`
// This field is from variant [MessageFailedWebhookEventData].
Reason string `json:"reason"`
// This field is from variant [MessageEditedWebhookEventData].
EditedAt time.Time `json:"edited_at"`
// This field is from variant [MessageEditedWebhookEventData].
Part MessageEditedWebhookEventDataPart `json:"part"`
// This field is from variant [ReactionEventBase].
IsFromMe bool `json:"is_from_me"`
// This field is from variant [ReactionEventBase].
ReactionType shared.ReactionType `json:"reaction_type"`
// This field is from variant [ReactionEventBase].
CustomEmoji string `json:"custom_emoji"`
// This field is from variant [ReactionEventBase].
From string `json:"from"`
// This field is from variant [ReactionEventBase].
FromHandle shared.ChatHandle `json:"from_handle"`
// This field is from variant [ReactionEventBase].
PartIndex int64 `json:"part_index"`
// This field is from variant [ReactionEventBase].
ReactedAt time.Time `json:"reacted_at"`
// This field is from variant [ReactionEventBase].
Sticker ReactionEventBaseSticker `json:"sticker"`
Handle string `json:"handle"`
// This field is from variant [ParticipantAddedWebhookEventData].
AddedAt time.Time `json:"added_at"`
// This field is from variant [ParticipantAddedWebhookEventData].
Participant shared.ChatHandle `json:"participant"`
// This field is from variant [ParticipantRemovedWebhookEventData].
RemovedAt time.Time `json:"removed_at"`
// This field is from variant [ChatCreatedWebhookEventData].
CreatedAt time.Time `json:"created_at"`
// This field is from variant [ChatCreatedWebhookEventData].
DisplayName string `json:"display_name"`
// This field is from variant [ChatCreatedWebhookEventData].
Handles []shared.ChatHandle `json:"handles"`
// This field is from variant [ChatCreatedWebhookEventData].
IsGroup bool `json:"is_group"`
UpdatedAt time.Time `json:"updated_at"`
// This field is from variant [ChatGroupNameUpdatedWebhookEventData].
ChangedByHandle shared.ChatHandle `json:"changed_by_handle"`
NewValue string `json:"new_value"`
OldValue string `json:"old_value"`
ErrorCode int64 `json:"error_code"`
// This field is from variant [PhoneNumberStatusUpdatedWebhookEventData].
ChangedAt time.Time `json:"changed_at"`
// This field is from variant [PhoneNumberStatusUpdatedWebhookEventData].
NewStatus string `json:"new_status"`
// This field is from variant [PhoneNumberStatusUpdatedWebhookEventData].
PhoneNumber string `json:"phone_number"`
// This field is from variant [PhoneNumberStatusUpdatedWebhookEventData].
PreviousStatus string `json:"previous_status"`
JSON struct {
ID respjson.Field
Chat respjson.Field
Direction respjson.Field
Parts respjson.Field
SenderHandle respjson.Field
Service respjson.Field
DeliveredAt respjson.Field
Effect respjson.Field
IdempotencyKey respjson.Field
PreferredService respjson.Field
ReadAt respjson.Field
ReplyTo respjson.Field
SentAt respjson.Field
Code respjson.Field
FailedAt respjson.Field
ChatID respjson.Field
MessageID respjson.Field
Reason respjson.Field
EditedAt respjson.Field
Part respjson.Field
IsFromMe respjson.Field
ReactionType respjson.Field
CustomEmoji respjson.Field
From respjson.Field
FromHandle respjson.Field
PartIndex respjson.Field
ReactedAt respjson.Field
Sticker respjson.Field
Handle respjson.Field
AddedAt respjson.Field
Participant respjson.Field
RemovedAt respjson.Field
CreatedAt respjson.Field
DisplayName respjson.Field
Handles respjson.Field
IsGroup respjson.Field
UpdatedAt respjson.Field
ChangedByHandle respjson.Field
NewValue respjson.Field
OldValue respjson.Field
ErrorCode respjson.Field
ChangedAt respjson.Field
NewStatus respjson.Field
PhoneNumber respjson.Field
PreviousStatus respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
EventsWebhookEventUnionData is an implicit subunion of EventsWebhookEventUnion. EventsWebhookEventUnionData provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the EventsWebhookEventUnion.
func (*EventsWebhookEventUnionData) UnmarshalJSON ¶ added in v0.2.0
func (r *EventsWebhookEventUnionData) UnmarshalJSON(data []byte) error
type EventsWebhookEventUnionDataChat ¶ added in v0.6.1
type EventsWebhookEventUnionDataChat struct {
ID string `json:"id"`
IsGroup bool `json:"is_group"`
// This field is from variant [MessageEventV2Chat].
OwnerHandle shared.ChatHandle `json:"owner_handle"`
JSON struct {
ID respjson.Field
IsGroup respjson.Field
OwnerHandle respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
EventsWebhookEventUnionDataChat is an implicit subunion of EventsWebhookEventUnion. EventsWebhookEventUnionDataChat provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the EventsWebhookEventUnion.
func (*EventsWebhookEventUnionDataChat) UnmarshalJSON ¶ added in v0.6.1
func (r *EventsWebhookEventUnionDataChat) UnmarshalJSON(data []byte) error
type HandleCheckParam ¶ added in v0.8.0
type HandleCheckParam struct {
// The recipient phone number or email address to check
Address string `json:"address" api:"required"`
// Optional sender phone number. If omitted, an available phone from your pool is
// used automatically.
From param.Opt[string] `json:"from,omitzero"`
// contains filtered or unexported fields
}
The property Address is required.
func (HandleCheckParam) MarshalJSON ¶ added in v0.8.0
func (r HandleCheckParam) MarshalJSON() (data []byte, err error)
func (*HandleCheckParam) UnmarshalJSON ¶ added in v0.8.0
func (r *HandleCheckParam) UnmarshalJSON(data []byte) error
type HandleCheckResponse ¶ added in v0.8.0
type HandleCheckResponse struct {
// The recipient address that was checked
Address string `json:"address" api:"required"`
// Whether the recipient supports the checked messaging service
Available bool `json:"available" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Address respjson.Field
Available respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (HandleCheckResponse) RawJSON ¶ added in v0.8.0
func (r HandleCheckResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*HandleCheckResponse) UnmarshalJSON ¶ added in v0.8.0
func (r *HandleCheckResponse) UnmarshalJSON(data []byte) error
type LinkPartParam ¶ added in v0.8.0
type LinkPartParam struct {
// Indicates this is a rich link preview part
//
// Any of "link".
Type LinkPartType `json:"type,omitzero" api:"required"`
// URL to send with a rich link preview. The recipient will see an inline card with
// the page's title, description, and preview image (when available).
//
// A `link` part must be the **only** part in the message. To send a URL as plain
// text (no preview card), use a `text` part instead.
Value string `json:"value" api:"required" format:"uri"`
// contains filtered or unexported fields
}
The properties Type, Value are required.
func (LinkPartParam) MarshalJSON ¶ added in v0.8.0
func (r LinkPartParam) MarshalJSON() (data []byte, err error)
func (*LinkPartParam) UnmarshalJSON ¶ added in v0.8.0
func (r *LinkPartParam) UnmarshalJSON(data []byte) error
type LinkPartResponse ¶ added in v0.13.0
type LinkPartResponse = shared.LinkPartResponse
A rich link preview part
This is an alias to an internal type.
type LinkPartResponseType ¶ added in v0.13.0
type LinkPartResponseType = shared.LinkPartResponseType
Indicates this is a rich link preview part
This is an alias to an internal type.
type LinkPartType ¶ added in v0.8.0
type LinkPartType string
Indicates this is a rich link preview part
const (
LinkPartTypeLink LinkPartType = "link"
)
type MediaPartParam ¶ added in v0.2.0
type MediaPartParam struct {
// Indicates this is a media attachment part
//
// Any of "media".
Type MediaPartType `json:"type,omitzero" api:"required"`
// Reference to a file pre-uploaded via `POST /v3/attachments` (optional). The file
// is already stored, so sends using this ID skip the download step — useful when
// sending the same file to many recipients.
//
// Either `url` or `attachment_id` must be provided, but not both.
AttachmentID param.Opt[string] `json:"attachment_id,omitzero" format:"uuid"`
// Any publicly accessible HTTPS URL to the media file. The server downloads and
// sends the file automatically — no pre-upload step required.
//
// **Size limit:** 10MB maximum for URL-based downloads. For larger files (up to
// 100MB), use the pre-upload flow: `POST /v3/attachments` to get a presigned URL,
// upload directly, then reference by `attachment_id`.
//
// **Requirements:**
//
// - URL must use HTTPS
// - File content must be a supported format (the server validates the actual file
// content)
//
// **Supported formats:**
//
// - Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp
// - Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp
// - Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr
// - Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx,
// .pages, .numbers, .key, .epub, .zip, .html, .htm
// - Contact & Calendar: .vcf, .ics
//
// **Tip:** Audio sent here appears as a regular file attachment. To send audio as
// an iMessage voice memo bubble (with inline playback), use
// `/v3/chats/{chatId}/voicememo`. For repeated sends of the same file, use
// `attachment_id` to avoid redundant downloads.
//
// Either `url` or `attachment_id` must be provided, but not both.
URL param.Opt[string] `json:"url,omitzero" format:"uri"`
// contains filtered or unexported fields
}
The property Type is required.
func (MediaPartParam) MarshalJSON ¶ added in v0.2.0
func (r MediaPartParam) MarshalJSON() (data []byte, err error)
func (*MediaPartParam) UnmarshalJSON ¶ added in v0.2.0
func (r *MediaPartParam) UnmarshalJSON(data []byte) error
type MediaPartResponse ¶ added in v0.2.0
type MediaPartResponse = shared.MediaPartResponse
A media attachment part
This is an alias to an internal type.
type MediaPartResponseType ¶ added in v0.2.0
type MediaPartResponseType = shared.MediaPartResponseType
Indicates this is a media attachment part
This is an alias to an internal type.
type MediaPartType ¶
type MediaPartType string
Indicates this is a media attachment part
const (
MediaPartTypeMedia MediaPartType = "media"
)
type Message ¶
type Message struct {
// Unique identifier for the message
ID string `json:"id" api:"required" format:"uuid"`
// ID of the chat this message belongs to
ChatID string `json:"chat_id" api:"required" format:"uuid"`
// When the message was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Whether the message has been delivered
IsDelivered bool `json:"is_delivered" api:"required"`
// Whether this message was sent by the authenticated user
IsFromMe bool `json:"is_from_me" api:"required"`
// Whether the message has been read
IsRead bool `json:"is_read" api:"required"`
// When the message was last updated
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// When the message was delivered
DeliveredAt time.Time `json:"delivered_at" api:"nullable" format:"date-time"`
// iMessage effect applied to a message (screen or bubble effect)
Effect MessageEffect `json:"effect" api:"nullable"`
// DEPRECATED: Use from_handle instead. Phone number of the message sender.
//
// Deprecated: deprecated
From string `json:"from" api:"nullable"`
// The sender of this message as a full handle object
FromHandle shared.ChatHandle `json:"from_handle" api:"nullable"`
// Message parts in order (text, media, and link)
Parts []MessagePartUnion `json:"parts" api:"nullable"`
// Messaging service type
//
// Any of "iMessage", "SMS", "RCS".
PreferredService shared.ServiceType `json:"preferred_service" api:"nullable"`
// When the message was read
ReadAt time.Time `json:"read_at" api:"nullable" format:"date-time"`
// Indicates this message is a threaded reply to another message
ReplyTo ReplyTo `json:"reply_to" api:"nullable"`
// When the message was sent
SentAt time.Time `json:"sent_at" api:"nullable" format:"date-time"`
// Messaging service type
//
// Any of "iMessage", "SMS", "RCS".
Service shared.ServiceType `json:"service" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ChatID respjson.Field
CreatedAt respjson.Field
IsDelivered respjson.Field
IsFromMe respjson.Field
IsRead respjson.Field
UpdatedAt respjson.Field
DeliveredAt respjson.Field
Effect respjson.Field
From respjson.Field
FromHandle respjson.Field
Parts respjson.Field
PreferredService respjson.Field
ReadAt respjson.Field
ReplyTo respjson.Field
SentAt respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Message) UnmarshalJSON ¶
type MessageAddReactionParams ¶
type MessageAddReactionParams struct {
// Whether to add or remove the reaction
//
// Any of "add", "remove".
Operation MessageAddReactionParamsOperation `json:"operation,omitzero" api:"required"`
// Type of reaction. Standard iMessage tapbacks are love, like, dislike, laugh,
// emphasize, question. Custom emoji reactions have type "custom" with the actual
// emoji in the custom_emoji field. Sticker reactions have type "sticker" with
// sticker attachment details in the sticker field.
//
// Any of "love", "like", "dislike", "laugh", "emphasize", "question", "custom",
// "sticker".
Type shared.ReactionType `json:"type,omitzero" api:"required"`
// Custom emoji string. Required when type is "custom".
CustomEmoji param.Opt[string] `json:"custom_emoji,omitzero"`
// Optional index of the message part to react to. If not provided, reacts to the
// entire message (part 0).
PartIndex param.Opt[int64] `json:"part_index,omitzero"`
// contains filtered or unexported fields
}
func (MessageAddReactionParams) MarshalJSON ¶
func (r MessageAddReactionParams) MarshalJSON() (data []byte, err error)
func (*MessageAddReactionParams) UnmarshalJSON ¶
func (r *MessageAddReactionParams) UnmarshalJSON(data []byte) error
type MessageAddReactionParamsOperation ¶
type MessageAddReactionParamsOperation string
Whether to add or remove the reaction
const ( MessageAddReactionParamsOperationAdd MessageAddReactionParamsOperation = "add" MessageAddReactionParamsOperationRemove MessageAddReactionParamsOperation = "remove" )
type MessageAddReactionResponse ¶ added in v0.1.2
type MessageAddReactionResponse struct {
Message string `json:"message"`
Status string `json:"status"`
TraceID string `json:"trace_id"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Status respjson.Field
TraceID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageAddReactionResponse) RawJSON ¶ added in v0.1.2
func (r MessageAddReactionResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageAddReactionResponse) UnmarshalJSON ¶ added in v0.1.2
func (r *MessageAddReactionResponse) UnmarshalJSON(data []byte) error
type MessageContentParam ¶
type MessageContentParam struct {
// Array of message parts. Each part can be text, media, or link. Parts are
// displayed in order. Text and media can be mixed freely, but a `link` part must
// be the only part in the message.
//
// **Rich Link Previews:**
//
// - Use a `link` part to send a URL with a rich preview card
// - A `link` part must be the **only** part in the message
// - To send a URL as plain text (no preview), use a `text` part instead
//
// **Supported Media:**
//
// - Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp
// - Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp
// - Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr
// - Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx,
// .pages, .numbers, .key, .epub, .zip, .html, .htm
// - Contact & Calendar: .vcf, .ics
//
// **Audio:**
//
// - Audio files (.m4a, .mp3, .aac, .caf, .wav, .aiff, .amr) are fully supported as
// media parts
// - To send audio as an **iMessage voice memo bubble** (inline playback UI), use
// the dedicated `/v3/chats/{chatId}/voicememo` endpoint instead
//
// **Validation Rules:**
//
// - A `link` part must be the **only** part in the message. It cannot be combined
// with text or media parts.
// - Consecutive text parts are not allowed. Text parts must be separated by media
// parts. For example, [text, text] is invalid, but [text, media, text] is valid.
// - Maximum of **100 parts** total.
// - Media parts using a public `url` (downloaded by the server on send) are capped
// at **40**. Parts using `attachment_id` or presigned URLs are exempt from this
// sub-limit. For bulk media sends exceeding 40 files, pre-upload via
// `POST /v3/attachments` and reference by `attachment_id` or `download_url`.
Parts []MessageContentPartUnionParam `json:"parts,omitzero" api:"required"`
// Optional idempotency key for this message. Use this to prevent duplicate sends
// of the same message.
IdempotencyKey param.Opt[string] `json:"idempotency_key,omitzero"`
// iMessage effect to apply to this message (screen or bubble effect)
Effect MessageEffectParam `json:"effect,omitzero"`
// Messaging service type
//
// Any of "iMessage", "SMS", "RCS".
PreferredService shared.ServiceType `json:"preferred_service,omitzero"`
// Reply to another message to create a threaded conversation
ReplyTo ReplyToParam `json:"reply_to,omitzero"`
// contains filtered or unexported fields
}
Message content container. Groups all message-related fields together, separating the "what" (message content) from the "where" (routing fields like from/to).
The property Parts is required.
func (MessageContentParam) MarshalJSON ¶
func (r MessageContentParam) MarshalJSON() (data []byte, err error)
func (*MessageContentParam) UnmarshalJSON ¶
func (r *MessageContentParam) UnmarshalJSON(data []byte) error
type MessageContentPartUnionParam ¶
type MessageContentPartUnionParam struct {
OfText *TextPartParam `json:",omitzero,inline"`
OfMedia *MediaPartParam `json:",omitzero,inline"`
OfLink *LinkPartParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (MessageContentPartUnionParam) MarshalJSON ¶
func (u MessageContentPartUnionParam) MarshalJSON() ([]byte, error)
func (*MessageContentPartUnionParam) UnmarshalJSON ¶
func (u *MessageContentPartUnionParam) UnmarshalJSON(data []byte) error
type MessageDeliveredWebhookEvent ¶ added in v0.12.0
type MessageDeliveredWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Unified payload for message webhooks when using `webhook_version: "2026-02-03"`.
//
// This schema is used for message.sent, message.received, message.delivered, and
// message.read events when the subscription URL includes `?version=2026-02-03`.
//
// Key differences from V1 (2025-01-01):
//
// - `direction`: "inbound" or "outbound" instead of `is_from_me` boolean
// - `sender_handle`: Full handle object for the sender
// - `chat`: Nested object with `id`, `is_group`, and `owner_handle`
// - Message fields (`id`, `parts`, `effect`, etc.) are at the top level, not
// nested in `message`
//
// Timestamps indicate the message state:
//
// - `message.sent`: sent_at set, delivered_at=null, read_at=null
// - `message.received`: sent_at set, delivered_at=null, read_at=null
// - `message.delivered`: sent_at set, delivered_at set, read_at=null
// - `message.read`: sent_at set, delivered_at set, read_at set
Data MessageEventV2 `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for message.delivered events (2026-02-03 format)
func (MessageDeliveredWebhookEvent) RawJSON ¶ added in v0.12.0
func (r MessageDeliveredWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageDeliveredWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *MessageDeliveredWebhookEvent) UnmarshalJSON(data []byte) error
type MessageEditedWebhookEvent ¶ added in v0.12.0
type MessageEditedWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Payload for `message.edited` events (2026-02-03 format).
//
// Describes which part of a message was edited and when. Only text parts can be
// edited. Only available for subscriptions using `webhook_version: "2026-02-03"`.
Data MessageEditedWebhookEventData `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for message.edited events (2026-02-03 format only)
func (MessageEditedWebhookEvent) RawJSON ¶ added in v0.12.0
func (r MessageEditedWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageEditedWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *MessageEditedWebhookEvent) UnmarshalJSON(data []byte) error
type MessageEditedWebhookEventData ¶ added in v0.12.0
type MessageEditedWebhookEventData struct {
// Message identifier
ID string `json:"id" api:"required" format:"uuid"`
// Chat context
Chat MessageEditedWebhookEventDataChat `json:"chat" api:"required"`
// "outbound" if you sent the original message, "inbound" if you received it
//
// Any of "outbound", "inbound".
Direction string `json:"direction" api:"required"`
// When the edit occurred
EditedAt time.Time `json:"edited_at" api:"required" format:"date-time"`
// The edited part
Part MessageEditedWebhookEventDataPart `json:"part" api:"required"`
// The handle that sent (and edited) this message
SenderHandle shared.ChatHandle `json:"sender_handle" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Chat respjson.Field
Direction respjson.Field
EditedAt respjson.Field
Part respjson.Field
SenderHandle respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Payload for `message.edited` events (2026-02-03 format).
Describes which part of a message was edited and when. Only text parts can be edited. Only available for subscriptions using `webhook_version: "2026-02-03"`.
func (MessageEditedWebhookEventData) RawJSON ¶ added in v0.12.0
func (r MessageEditedWebhookEventData) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageEditedWebhookEventData) UnmarshalJSON ¶ added in v0.12.0
func (r *MessageEditedWebhookEventData) UnmarshalJSON(data []byte) error
type MessageEditedWebhookEventDataChat ¶ added in v0.12.0
type MessageEditedWebhookEventDataChat struct {
// Chat identifier
ID string `json:"id" api:"required" format:"uuid"`
// Whether this is a group chat
IsGroup bool `json:"is_group" api:"required"`
// The handle that owns this chat (your phone number)
OwnerHandle shared.ChatHandle `json:"owner_handle" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
IsGroup respjson.Field
OwnerHandle respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Chat context
func (MessageEditedWebhookEventDataChat) RawJSON ¶ added in v0.12.0
func (r MessageEditedWebhookEventDataChat) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageEditedWebhookEventDataChat) UnmarshalJSON ¶ added in v0.12.0
func (r *MessageEditedWebhookEventDataChat) UnmarshalJSON(data []byte) error
type MessageEditedWebhookEventDataPart ¶ added in v0.12.0
type MessageEditedWebhookEventDataPart struct {
// Zero-based index of the edited part within the message
Index int64 `json:"index" api:"required"`
// New text content of the part
Text string `json:"text" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Index respjson.Field
Text respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The edited part
func (MessageEditedWebhookEventDataPart) RawJSON ¶ added in v0.12.0
func (r MessageEditedWebhookEventDataPart) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageEditedWebhookEventDataPart) UnmarshalJSON ¶ added in v0.12.0
func (r *MessageEditedWebhookEventDataPart) UnmarshalJSON(data []byte) error
type MessageEffect ¶
type MessageEffect struct {
// Name of the effect. Common values:
//
// - Screen effects: confetti, fireworks, lasers, sparkles, celebration, hearts,
// love, balloons, happy_birthday, echo, spotlight
// - Bubble effects: slam, loud, gentle, invisible
Name string `json:"name"`
// Type of effect
//
// Any of "screen", "bubble".
Type MessageEffectType `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Name respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
iMessage effect applied to a message (screen or bubble effect)
func (MessageEffect) RawJSON ¶
func (r MessageEffect) RawJSON() string
Returns the unmodified JSON received from the API
func (MessageEffect) ToParam ¶
func (r MessageEffect) ToParam() MessageEffectParam
ToParam converts this MessageEffect to a MessageEffectParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with MessageEffectParam.Overrides()
func (*MessageEffect) UnmarshalJSON ¶
func (r *MessageEffect) UnmarshalJSON(data []byte) error
type MessageEffectParam ¶
type MessageEffectParam struct {
// Name of the effect. Common values:
//
// - Screen effects: confetti, fireworks, lasers, sparkles, celebration, hearts,
// love, balloons, happy_birthday, echo, spotlight
// - Bubble effects: slam, loud, gentle, invisible
Name param.Opt[string] `json:"name,omitzero"`
// Type of effect
//
// Any of "screen", "bubble".
Type MessageEffectType `json:"type,omitzero"`
// contains filtered or unexported fields
}
iMessage effect applied to a message (screen or bubble effect)
func (MessageEffectParam) MarshalJSON ¶
func (r MessageEffectParam) MarshalJSON() (data []byte, err error)
func (*MessageEffectParam) UnmarshalJSON ¶
func (r *MessageEffectParam) UnmarshalJSON(data []byte) error
type MessageEffectType ¶
type MessageEffectType string
Type of effect
const ( MessageEffectTypeScreen MessageEffectType = "screen" MessageEffectTypeBubble MessageEffectType = "bubble" )
type MessageEventV2 ¶ added in v0.2.0
type MessageEventV2 struct {
// Message identifier
ID string `json:"id" api:"required" format:"uuid"`
// Chat information
Chat MessageEventV2Chat `json:"chat" api:"required"`
// Message direction - "outbound" if sent by you, "inbound" if received
//
// Any of "inbound", "outbound".
Direction MessageEventV2Direction `json:"direction" api:"required"`
// Message parts (text and/or media)
Parts []MessageEventV2PartUnion `json:"parts" api:"required"`
// The handle that sent this message
SenderHandle shared.ChatHandle `json:"sender_handle" api:"required"`
// Messaging service type
//
// Any of "iMessage", "SMS", "RCS".
Service shared.ServiceType `json:"service" api:"required"`
// When the message was delivered. Null if not yet delivered.
DeliveredAt time.Time `json:"delivered_at" api:"nullable" format:"date-time"`
// iMessage effect applied to a message (screen or bubble animation)
Effect SchemasMessageEffect `json:"effect" api:"nullable"`
// Idempotency key for deduplication of outbound messages.
IdempotencyKey string `json:"idempotency_key" api:"nullable"`
// Preferred messaging service type. Includes "auto" for default fallback behavior.
//
// Any of "iMessage", "SMS", "RCS", "auto".
PreferredService MessageEventV2PreferredService `json:"preferred_service" api:"nullable"`
// When the message was read. Null if not yet read.
ReadAt time.Time `json:"read_at" api:"nullable" format:"date-time"`
// Reference to the message this is replying to (for threaded replies)
ReplyTo MessageEventV2ReplyTo `json:"reply_to" api:"nullable"`
// When the message was sent. Null if not yet sent.
SentAt time.Time `json:"sent_at" api:"nullable" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Chat respjson.Field
Direction respjson.Field
Parts respjson.Field
SenderHandle respjson.Field
Service respjson.Field
DeliveredAt respjson.Field
Effect respjson.Field
IdempotencyKey respjson.Field
PreferredService respjson.Field
ReadAt respjson.Field
ReplyTo respjson.Field
SentAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Unified payload for message webhooks when using `webhook_version: "2026-02-03"`.
This schema is used for message.sent, message.received, message.delivered, and message.read events when the subscription URL includes `?version=2026-02-03`.
Key differences from V1 (2025-01-01):
- `direction`: "inbound" or "outbound" instead of `is_from_me` boolean
- `sender_handle`: Full handle object for the sender
- `chat`: Nested object with `id`, `is_group`, and `owner_handle`
- Message fields (`id`, `parts`, `effect`, etc.) are at the top level, not nested in `message`
Timestamps indicate the message state:
- `message.sent`: sent_at set, delivered_at=null, read_at=null - `message.received`: sent_at set, delivered_at=null, read_at=null - `message.delivered`: sent_at set, delivered_at set, read_at=null - `message.read`: sent_at set, delivered_at set, read_at set
func (MessageEventV2) RawJSON ¶ added in v0.2.0
func (r MessageEventV2) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageEventV2) UnmarshalJSON ¶ added in v0.2.0
func (r *MessageEventV2) UnmarshalJSON(data []byte) error
type MessageEventV2Chat ¶ added in v0.2.0
type MessageEventV2Chat struct {
// Chat identifier
ID string `json:"id" api:"required" format:"uuid"`
// Whether this is a group chat
IsGroup bool `json:"is_group" api:"nullable"`
// Your phone number's handle. Always has is_me=true.
OwnerHandle shared.ChatHandle `json:"owner_handle" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
IsGroup respjson.Field
OwnerHandle respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Chat information
func (MessageEventV2Chat) RawJSON ¶ added in v0.2.0
func (r MessageEventV2Chat) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageEventV2Chat) UnmarshalJSON ¶ added in v0.2.0
func (r *MessageEventV2Chat) UnmarshalJSON(data []byte) error
type MessageEventV2Direction ¶ added in v0.2.0
type MessageEventV2Direction string
Message direction - "outbound" if sent by you, "inbound" if received
const ( MessageEventV2DirectionInbound MessageEventV2Direction = "inbound" MessageEventV2DirectionOutbound MessageEventV2Direction = "outbound" )
type MessageEventV2PartLink ¶ added in v0.9.0
type MessageEventV2PartLink struct {
// Indicates this is a rich link preview part
Type constant.Link `json:"type" default:"link"`
// The URL
Value string `json:"value" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
Value respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A rich link preview part
func (MessageEventV2PartLink) RawJSON ¶ added in v0.9.0
func (r MessageEventV2PartLink) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageEventV2PartLink) UnmarshalJSON ¶ added in v0.9.0
func (r *MessageEventV2PartLink) UnmarshalJSON(data []byte) error
type MessageEventV2PartUnion ¶ added in v0.2.0
type MessageEventV2PartUnion struct {
// Any of "text", "media", "link".
Type string `json:"type"`
Value string `json:"value"`
// This field is from variant [SchemasTextPartResponse].
TextDecorations []shared.TextDecoration `json:"text_decorations"`
// This field is from variant [SchemasMediaPartResponse].
ID string `json:"id"`
// This field is from variant [SchemasMediaPartResponse].
Filename string `json:"filename"`
// This field is from variant [SchemasMediaPartResponse].
MimeType string `json:"mime_type"`
// This field is from variant [SchemasMediaPartResponse].
SizeBytes int64 `json:"size_bytes"`
// This field is from variant [SchemasMediaPartResponse].
URL string `json:"url"`
JSON struct {
Type respjson.Field
Value respjson.Field
TextDecorations respjson.Field
ID respjson.Field
Filename respjson.Field
MimeType respjson.Field
SizeBytes respjson.Field
URL respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MessageEventV2PartUnion contains all possible properties and values from SchemasTextPartResponse, SchemasMediaPartResponse, MessageEventV2PartLink.
Use the MessageEventV2PartUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MessageEventV2PartUnion) AsAny ¶ added in v0.2.0
func (u MessageEventV2PartUnion) AsAny() anyMessageEventV2Part
Use the following switch statement to find the correct variant
switch variant := MessageEventV2PartUnion.AsAny().(type) {
case linqgo.SchemasTextPartResponse:
case linqgo.SchemasMediaPartResponse:
case linqgo.MessageEventV2PartLink:
default:
fmt.Errorf("no variant present")
}
func (MessageEventV2PartUnion) AsLink ¶ added in v0.9.0
func (u MessageEventV2PartUnion) AsLink() (v MessageEventV2PartLink)
func (MessageEventV2PartUnion) AsMedia ¶ added in v0.2.0
func (u MessageEventV2PartUnion) AsMedia() (v SchemasMediaPartResponse)
func (MessageEventV2PartUnion) AsText ¶ added in v0.2.0
func (u MessageEventV2PartUnion) AsText() (v SchemasTextPartResponse)
func (MessageEventV2PartUnion) RawJSON ¶ added in v0.2.0
func (u MessageEventV2PartUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageEventV2PartUnion) UnmarshalJSON ¶ added in v0.2.0
func (r *MessageEventV2PartUnion) UnmarshalJSON(data []byte) error
type MessageEventV2PreferredService ¶ added in v0.2.0
type MessageEventV2PreferredService string
Preferred messaging service type. Includes "auto" for default fallback behavior.
const ( MessageEventV2PreferredServiceiMessage MessageEventV2PreferredService = "iMessage" MessageEventV2PreferredServiceSMS MessageEventV2PreferredService = "SMS" MessageEventV2PreferredServiceRCS MessageEventV2PreferredService = "RCS" MessageEventV2PreferredServiceAuto MessageEventV2PreferredService = "auto" )
type MessageEventV2ReplyTo ¶ added in v0.2.0
type MessageEventV2ReplyTo struct {
// ID of the message being replied to
MessageID string `json:"message_id" format:"uuid"`
// Index of the part being replied to
PartIndex int64 `json:"part_index"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MessageID respjson.Field
PartIndex respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Reference to the message this is replying to (for threaded replies)
func (MessageEventV2ReplyTo) RawJSON ¶ added in v0.2.0
func (r MessageEventV2ReplyTo) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageEventV2ReplyTo) UnmarshalJSON ¶ added in v0.2.0
func (r *MessageEventV2ReplyTo) UnmarshalJSON(data []byte) error
type MessageFailedWebhookEvent ¶ added in v0.12.0
type MessageFailedWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Error details for message.failed webhook events. See
// [WebhookErrorCode](#/components/schemas/WebhookErrorCode) for the full error
// code reference.
Data MessageFailedWebhookEventData `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for message.failed events
func (MessageFailedWebhookEvent) RawJSON ¶ added in v0.12.0
func (r MessageFailedWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageFailedWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *MessageFailedWebhookEvent) UnmarshalJSON(data []byte) error
type MessageFailedWebhookEventData ¶ added in v0.12.0
type MessageFailedWebhookEventData struct {
// Error codes in webhook failure events (3007, 4001).
Code int64 `json:"code" api:"required"`
// When the failure was detected
FailedAt time.Time `json:"failed_at" api:"required" format:"date-time"`
// Chat identifier (UUID)
ChatID string `json:"chat_id"`
// Message identifier (UUID)
MessageID string `json:"message_id"`
// Human-readable description of the failure
Reason string `json:"reason"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
FailedAt respjson.Field
ChatID respjson.Field
MessageID respjson.Field
Reason respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Error details for message.failed webhook events. See [WebhookErrorCode](#/components/schemas/WebhookErrorCode) for the full error code reference.
func (MessageFailedWebhookEventData) RawJSON ¶ added in v0.12.0
func (r MessageFailedWebhookEventData) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageFailedWebhookEventData) UnmarshalJSON ¶ added in v0.12.0
func (r *MessageFailedWebhookEventData) UnmarshalJSON(data []byte) error
type MessageListMessagesThreadParams ¶ added in v0.2.0
type MessageListMessagesThreadParams struct {
// Pagination cursor from previous next_cursor response
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Maximum number of messages to return
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Sort order for messages (asc = oldest first, desc = newest first)
//
// Any of "asc", "desc".
Order MessageListMessagesThreadParamsOrder `query:"order,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (MessageListMessagesThreadParams) URLQuery ¶ added in v0.2.0
func (r MessageListMessagesThreadParams) URLQuery() (v url.Values, err error)
URLQuery serializes MessageListMessagesThreadParams's query parameters as `url.Values`.
type MessageListMessagesThreadParamsOrder ¶ added in v0.2.0
type MessageListMessagesThreadParamsOrder string
Sort order for messages (asc = oldest first, desc = newest first)
const ( MessageListMessagesThreadParamsOrderAsc MessageListMessagesThreadParamsOrder = "asc" MessageListMessagesThreadParamsOrderDesc MessageListMessagesThreadParamsOrder = "desc" )
type MessagePartUnion ¶
type MessagePartUnion struct {
Reactions []shared.Reaction `json:"reactions"`
Type string `json:"type"`
Value string `json:"value"`
// This field is from variant [shared.TextPartResponse].
TextDecorations []shared.TextDecoration `json:"text_decorations"`
// This field is from variant [shared.MediaPartResponse].
ID string `json:"id"`
// This field is from variant [shared.MediaPartResponse].
Filename string `json:"filename"`
// This field is from variant [shared.MediaPartResponse].
MimeType string `json:"mime_type"`
// This field is from variant [shared.MediaPartResponse].
SizeBytes int64 `json:"size_bytes"`
// This field is from variant [shared.MediaPartResponse].
URL string `json:"url"`
JSON struct {
Reactions respjson.Field
Type respjson.Field
Value respjson.Field
TextDecorations respjson.Field
ID respjson.Field
Filename respjson.Field
MimeType respjson.Field
SizeBytes respjson.Field
URL respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MessagePartUnion contains all possible properties and values from shared.TextPartResponse, shared.MediaPartResponse, shared.LinkPartResponse.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MessagePartUnion) AsLinkPartResponse ¶ added in v0.13.0
func (u MessagePartUnion) AsLinkPartResponse() (v shared.LinkPartResponse)
func (MessagePartUnion) AsMediaPartResponse ¶ added in v0.2.0
func (u MessagePartUnion) AsMediaPartResponse() (v shared.MediaPartResponse)
func (MessagePartUnion) AsTextPartResponse ¶ added in v0.2.0
func (u MessagePartUnion) AsTextPartResponse() (v shared.TextPartResponse)
func (MessagePartUnion) RawJSON ¶
func (u MessagePartUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessagePartUnion) UnmarshalJSON ¶
func (r *MessagePartUnion) UnmarshalJSON(data []byte) error
type MessageReadWebhookEvent ¶ added in v0.12.0
type MessageReadWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Unified payload for message webhooks when using `webhook_version: "2026-02-03"`.
//
// This schema is used for message.sent, message.received, message.delivered, and
// message.read events when the subscription URL includes `?version=2026-02-03`.
//
// Key differences from V1 (2025-01-01):
//
// - `direction`: "inbound" or "outbound" instead of `is_from_me` boolean
// - `sender_handle`: Full handle object for the sender
// - `chat`: Nested object with `id`, `is_group`, and `owner_handle`
// - Message fields (`id`, `parts`, `effect`, etc.) are at the top level, not
// nested in `message`
//
// Timestamps indicate the message state:
//
// - `message.sent`: sent_at set, delivered_at=null, read_at=null
// - `message.received`: sent_at set, delivered_at=null, read_at=null
// - `message.delivered`: sent_at set, delivered_at set, read_at=null
// - `message.read`: sent_at set, delivered_at set, read_at set
Data MessageEventV2 `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for message.read events (2026-02-03 format)
func (MessageReadWebhookEvent) RawJSON ¶ added in v0.12.0
func (r MessageReadWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageReadWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *MessageReadWebhookEvent) UnmarshalJSON(data []byte) error
type MessageReceivedWebhookEvent ¶ added in v0.12.0
type MessageReceivedWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Unified payload for message webhooks when using `webhook_version: "2026-02-03"`.
//
// This schema is used for message.sent, message.received, message.delivered, and
// message.read events when the subscription URL includes `?version=2026-02-03`.
//
// Key differences from V1 (2025-01-01):
//
// - `direction`: "inbound" or "outbound" instead of `is_from_me` boolean
// - `sender_handle`: Full handle object for the sender
// - `chat`: Nested object with `id`, `is_group`, and `owner_handle`
// - Message fields (`id`, `parts`, `effect`, etc.) are at the top level, not
// nested in `message`
//
// Timestamps indicate the message state:
//
// - `message.sent`: sent_at set, delivered_at=null, read_at=null
// - `message.received`: sent_at set, delivered_at=null, read_at=null
// - `message.delivered`: sent_at set, delivered_at set, read_at=null
// - `message.read`: sent_at set, delivered_at set, read_at set
Data MessageEventV2 `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for message.received events (2026-02-03 format)
func (MessageReceivedWebhookEvent) RawJSON ¶ added in v0.12.0
func (r MessageReceivedWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageReceivedWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *MessageReceivedWebhookEvent) UnmarshalJSON(data []byte) error
type MessageSentWebhookEvent ¶ added in v0.12.0
type MessageSentWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Unified payload for message webhooks when using `webhook_version: "2026-02-03"`.
//
// This schema is used for message.sent, message.received, message.delivered, and
// message.read events when the subscription URL includes `?version=2026-02-03`.
//
// Key differences from V1 (2025-01-01):
//
// - `direction`: "inbound" or "outbound" instead of `is_from_me` boolean
// - `sender_handle`: Full handle object for the sender
// - `chat`: Nested object with `id`, `is_group`, and `owner_handle`
// - Message fields (`id`, `parts`, `effect`, etc.) are at the top level, not
// nested in `message`
//
// Timestamps indicate the message state:
//
// - `message.sent`: sent_at set, delivered_at=null, read_at=null
// - `message.received`: sent_at set, delivered_at=null, read_at=null
// - `message.delivered`: sent_at set, delivered_at set, read_at=null
// - `message.read`: sent_at set, delivered_at set, read_at set
Data MessageEventV2 `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for message.sent events (2026-02-03 format)
func (MessageSentWebhookEvent) RawJSON ¶ added in v0.12.0
func (r MessageSentWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageSentWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *MessageSentWebhookEvent) UnmarshalJSON(data []byte) error
type MessageService ¶
type MessageService struct {
Options []option.RequestOption
}
Messages are individual communications within a chat thread.
Messages can include text, media attachments, rich link previews, special effects (like confetti or fireworks), and reactions. All messages are associated with a specific chat and sent from a phone number you own.
Messages support delivery status tracking, read receipts, and editing capabilities.
## Rich Link Previews
Send a URL as a `link` part to deliver it with a rich preview card showing the page's title, description, and image (when available). A `link` part must be the **only** part in the message — it cannot be combined with text or media parts. To send a URL without a preview card, include it in a `text` part instead.
**Limitations:**
- A `link` part cannot be combined with other parts in the same message. - Maximum URL length: 2,048 characters.
MessageService contains methods and other services that help with interacting with the linq-api-v3 API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewMessageService method instead.
func NewMessageService ¶
func NewMessageService(opts ...option.RequestOption) (r MessageService)
NewMessageService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*MessageService) AddReaction ¶
func (r *MessageService) AddReaction(ctx context.Context, messageID string, body MessageAddReactionParams, opts ...option.RequestOption) (res *MessageAddReactionResponse, err error)
Add or remove emoji reactions to messages. Reactions let users express their response to a message without sending a new message.
**Supported Reactions:**
- love ❤️ - like 👍 - dislike 👎 - laugh 😂 - emphasize ‼️ - question ❓ - custom - any emoji (use `custom_emoji` field to specify)
func (*MessageService) Delete ¶
func (r *MessageService) Delete(ctx context.Context, messageID string, opts ...option.RequestOption) (err error)
Deletes a message from the Linq API only. This does NOT unsend or remove the message from the actual chat — recipients will still see the message.
func (*MessageService) Get ¶
func (r *MessageService) Get(ctx context.Context, messageID string, opts ...option.RequestOption) (res *Message, err error)
Retrieve a specific message by its ID. This endpoint returns the full message details including text, attachments, reactions, and metadata.
func (*MessageService) ListMessagesThread ¶ added in v0.2.0
func (r *MessageService) ListMessagesThread(ctx context.Context, messageID string, query MessageListMessagesThreadParams, opts ...option.RequestOption) (res *pagination.ListMessagesPagination[Message], err error)
Retrieve all messages in a conversation thread. Given any message ID in the thread, returns the originator message and all replies in chronological order.
If the message is not part of a thread, returns just that single message.
Supports pagination and configurable ordering.
func (*MessageService) ListMessagesThreadAutoPaging ¶ added in v0.2.0
func (r *MessageService) ListMessagesThreadAutoPaging(ctx context.Context, messageID string, query MessageListMessagesThreadParams, opts ...option.RequestOption) *pagination.ListMessagesPaginationAutoPager[Message]
Retrieve all messages in a conversation thread. Given any message ID in the thread, returns the originator message and all replies in chronological order.
If the message is not part of a thread, returns just that single message.
Supports pagination and configurable ordering.
func (*MessageService) Update ¶ added in v0.3.0
func (r *MessageService) Update(ctx context.Context, messageID string, body MessageUpdateParams, opts ...option.RequestOption) (res *Message, err error)
Edit the text content of a specific part of a previously sent message.
type MessageUpdateParams ¶ added in v0.3.0
type MessageUpdateParams struct {
// New text content for the message part
Text string `json:"text" api:"required"`
// Index of the message part to edit. Defaults to 0.
PartIndex param.Opt[int64] `json:"part_index,omitzero"`
// contains filtered or unexported fields
}
func (MessageUpdateParams) MarshalJSON ¶ added in v0.3.0
func (r MessageUpdateParams) MarshalJSON() (data []byte, err error)
func (*MessageUpdateParams) UnmarshalJSON ¶ added in v0.3.0
func (r *MessageUpdateParams) UnmarshalJSON(data []byte) error
type ParticipantAddedWebhookEvent ¶ added in v0.12.0
type ParticipantAddedWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Payload for participant.added webhook events
Data ParticipantAddedWebhookEventData `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for participant.added events
func (ParticipantAddedWebhookEvent) RawJSON ¶ added in v0.12.0
func (r ParticipantAddedWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ParticipantAddedWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *ParticipantAddedWebhookEvent) UnmarshalJSON(data []byte) error
type ParticipantAddedWebhookEventData ¶ added in v0.12.0
type ParticipantAddedWebhookEventData struct {
// DEPRECATED: Use participant instead. Handle (phone number or email address) of
// the added participant.
//
// Deprecated: deprecated
Handle string `json:"handle" api:"required"`
// When the participant was added
AddedAt time.Time `json:"added_at" format:"date-time"`
// Chat identifier (UUID) of the group chat
ChatID string `json:"chat_id"`
// The added participant as a full handle object
Participant shared.ChatHandle `json:"participant"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Handle respjson.Field
AddedAt respjson.Field
ChatID respjson.Field
Participant respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Payload for participant.added webhook events
func (ParticipantAddedWebhookEventData) RawJSON ¶ added in v0.12.0
func (r ParticipantAddedWebhookEventData) RawJSON() string
Returns the unmodified JSON received from the API
func (*ParticipantAddedWebhookEventData) UnmarshalJSON ¶ added in v0.12.0
func (r *ParticipantAddedWebhookEventData) UnmarshalJSON(data []byte) error
type ParticipantRemovedWebhookEvent ¶ added in v0.12.0
type ParticipantRemovedWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Payload for participant.removed webhook events
Data ParticipantRemovedWebhookEventData `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for participant.removed events
func (ParticipantRemovedWebhookEvent) RawJSON ¶ added in v0.12.0
func (r ParticipantRemovedWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ParticipantRemovedWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *ParticipantRemovedWebhookEvent) UnmarshalJSON(data []byte) error
type ParticipantRemovedWebhookEventData ¶ added in v0.12.0
type ParticipantRemovedWebhookEventData struct {
// DEPRECATED: Use participant instead. Handle (phone number or email address) of
// the removed participant.
//
// Deprecated: deprecated
Handle string `json:"handle" api:"required"`
// Chat identifier (UUID) of the group chat
ChatID string `json:"chat_id"`
// The removed participant as a full handle object
Participant shared.ChatHandle `json:"participant"`
// When the participant was removed
RemovedAt time.Time `json:"removed_at" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Handle respjson.Field
ChatID respjson.Field
Participant respjson.Field
RemovedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Payload for participant.removed webhook events
func (ParticipantRemovedWebhookEventData) RawJSON ¶ added in v0.12.0
func (r ParticipantRemovedWebhookEventData) RawJSON() string
Returns the unmodified JSON received from the API
func (*ParticipantRemovedWebhookEventData) UnmarshalJSON ¶ added in v0.12.0
func (r *ParticipantRemovedWebhookEventData) UnmarshalJSON(data []byte) error
type PhoneNumberListResponse ¶
type PhoneNumberListResponse struct {
// List of phone numbers assigned to the partner
PhoneNumbers []PhoneNumberListResponsePhoneNumber `json:"phone_numbers" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
PhoneNumbers respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PhoneNumberListResponse) RawJSON ¶
func (r PhoneNumberListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*PhoneNumberListResponse) UnmarshalJSON ¶
func (r *PhoneNumberListResponse) UnmarshalJSON(data []byte) error
type PhoneNumberListResponsePhoneNumber ¶
type PhoneNumberListResponsePhoneNumber struct {
// Unique identifier for the phone number
ID string `json:"id" api:"required" format:"uuid"`
// Phone number in E.164 format
PhoneNumber string `json:"phone_number" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
PhoneNumber respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PhoneNumberListResponsePhoneNumber) RawJSON ¶
func (r PhoneNumberListResponsePhoneNumber) RawJSON() string
Returns the unmodified JSON received from the API
func (*PhoneNumberListResponsePhoneNumber) UnmarshalJSON ¶
func (r *PhoneNumberListResponsePhoneNumber) UnmarshalJSON(data []byte) error
type PhoneNumberService ¶
type PhoneNumberService struct {
Options []option.RequestOption
}
Phone Numbers represent the phone numbers assigned to your partner account.
Use the list phone numbers endpoint to discover which phone numbers are available for sending messages.
When creating chats, listing chats, or sending a voice memo, use one of your assigned phone numbers in the `from` field.
PhoneNumberService contains methods and other services that help with interacting with the linq-api-v3 API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPhoneNumberService method instead.
func NewPhoneNumberService ¶
func NewPhoneNumberService(opts ...option.RequestOption) (r PhoneNumberService)
NewPhoneNumberService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*PhoneNumberService) List ¶
func (r *PhoneNumberService) List(ctx context.Context, opts ...option.RequestOption) (res *PhoneNumberListResponse, err error)
Returns all phone numbers assigned to the authenticated partner. Use this endpoint to discover which phone numbers are available for use as the `from` field when creating a chat, listing chats, or sending a voice memo.
type PhoneNumberStatusUpdatedWebhookEvent ¶ added in v0.12.0
type PhoneNumberStatusUpdatedWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Payload for phone_number.status_updated webhook events
Data PhoneNumberStatusUpdatedWebhookEventData `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// The type of event
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType PhoneNumberStatusUpdatedWebhookEventEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for phone_number.status_updated events
func (PhoneNumberStatusUpdatedWebhookEvent) RawJSON ¶ added in v0.12.0
func (r PhoneNumberStatusUpdatedWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*PhoneNumberStatusUpdatedWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *PhoneNumberStatusUpdatedWebhookEvent) UnmarshalJSON(data []byte) error
type PhoneNumberStatusUpdatedWebhookEventData ¶ added in v0.12.0
type PhoneNumberStatusUpdatedWebhookEventData struct {
// When the status change occurred
ChangedAt time.Time `json:"changed_at" api:"required" format:"date-time"`
// The new service status
//
// Any of "ACTIVE", "FLAGGED".
NewStatus string `json:"new_status" api:"required"`
// Phone number in E.164 format
PhoneNumber string `json:"phone_number" api:"required"`
// The previous service status
//
// Any of "ACTIVE", "FLAGGED".
PreviousStatus string `json:"previous_status" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ChangedAt respjson.Field
NewStatus respjson.Field
PhoneNumber respjson.Field
PreviousStatus respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Payload for phone_number.status_updated webhook events
func (PhoneNumberStatusUpdatedWebhookEventData) RawJSON ¶ added in v0.12.0
func (r PhoneNumberStatusUpdatedWebhookEventData) RawJSON() string
Returns the unmodified JSON received from the API
func (*PhoneNumberStatusUpdatedWebhookEventData) UnmarshalJSON ¶ added in v0.12.0
func (r *PhoneNumberStatusUpdatedWebhookEventData) UnmarshalJSON(data []byte) error
type PhoneNumberStatusUpdatedWebhookEventEventType ¶ added in v0.12.0
type PhoneNumberStatusUpdatedWebhookEventEventType string
The type of event
const ( PhoneNumberStatusUpdatedWebhookEventEventTypeMessageSent PhoneNumberStatusUpdatedWebhookEventEventType = "message.sent" PhoneNumberStatusUpdatedWebhookEventEventTypeMessageReceived PhoneNumberStatusUpdatedWebhookEventEventType = "message.received" PhoneNumberStatusUpdatedWebhookEventEventTypeMessageRead PhoneNumberStatusUpdatedWebhookEventEventType = "message.read" PhoneNumberStatusUpdatedWebhookEventEventTypeMessageDelivered PhoneNumberStatusUpdatedWebhookEventEventType = "message.delivered" PhoneNumberStatusUpdatedWebhookEventEventTypeMessageFailed PhoneNumberStatusUpdatedWebhookEventEventType = "message.failed" PhoneNumberStatusUpdatedWebhookEventEventTypeMessageEdited PhoneNumberStatusUpdatedWebhookEventEventType = "message.edited" PhoneNumberStatusUpdatedWebhookEventEventTypeReactionAdded PhoneNumberStatusUpdatedWebhookEventEventType = "reaction.added" PhoneNumberStatusUpdatedWebhookEventEventTypeReactionRemoved PhoneNumberStatusUpdatedWebhookEventEventType = "reaction.removed" PhoneNumberStatusUpdatedWebhookEventEventTypeParticipantAdded PhoneNumberStatusUpdatedWebhookEventEventType = "participant.added" PhoneNumberStatusUpdatedWebhookEventEventTypeParticipantRemoved PhoneNumberStatusUpdatedWebhookEventEventType = "participant.removed" PhoneNumberStatusUpdatedWebhookEventEventTypeChatCreated PhoneNumberStatusUpdatedWebhookEventEventType = "chat.created" PhoneNumberStatusUpdatedWebhookEventEventTypeChatGroupNameUpdated PhoneNumberStatusUpdatedWebhookEventEventType = "chat.group_name_updated" PhoneNumberStatusUpdatedWebhookEventEventTypeChatGroupIconUpdated PhoneNumberStatusUpdatedWebhookEventEventType = "chat.group_icon_updated" PhoneNumberStatusUpdatedWebhookEventEventTypeChatGroupNameUpdateFailed PhoneNumberStatusUpdatedWebhookEventEventType = "chat.group_name_update_failed" PhoneNumberStatusUpdatedWebhookEventEventTypeChatGroupIconUpdateFailed PhoneNumberStatusUpdatedWebhookEventEventType = "chat.group_icon_update_failed" PhoneNumberStatusUpdatedWebhookEventEventTypeChatTypingIndicatorStarted PhoneNumberStatusUpdatedWebhookEventEventType = "chat.typing_indicator.started" PhoneNumberStatusUpdatedWebhookEventEventTypeChatTypingIndicatorStopped PhoneNumberStatusUpdatedWebhookEventEventType = "chat.typing_indicator.stopped" PhoneNumberStatusUpdatedWebhookEventEventTypePhoneNumberStatusUpdated PhoneNumberStatusUpdatedWebhookEventEventType = "phone_number.status_updated" PhoneNumberStatusUpdatedWebhookEventEventTypeCallInitiated PhoneNumberStatusUpdatedWebhookEventEventType = "call.initiated" PhoneNumberStatusUpdatedWebhookEventEventTypeCallRinging PhoneNumberStatusUpdatedWebhookEventEventType = "call.ringing" PhoneNumberStatusUpdatedWebhookEventEventTypeCallAnswered PhoneNumberStatusUpdatedWebhookEventEventType = "call.answered" PhoneNumberStatusUpdatedWebhookEventEventTypeCallEnded PhoneNumberStatusUpdatedWebhookEventEventType = "call.ended" PhoneNumberStatusUpdatedWebhookEventEventTypeCallFailed PhoneNumberStatusUpdatedWebhookEventEventType = "call.failed" PhoneNumberStatusUpdatedWebhookEventEventTypeCallDeclined PhoneNumberStatusUpdatedWebhookEventEventType = "call.declined" PhoneNumberStatusUpdatedWebhookEventEventTypeCallNoAnswer PhoneNumberStatusUpdatedWebhookEventEventType = "call.no_answer" )
type PhonenumberListResponse ¶
type PhonenumberListResponse struct {
// List of phone numbers assigned to the partner
PhoneNumbers []PhonenumberListResponsePhoneNumber `json:"phone_numbers" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
PhoneNumbers respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PhonenumberListResponse) RawJSON ¶
func (r PhonenumberListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*PhonenumberListResponse) UnmarshalJSON ¶
func (r *PhonenumberListResponse) UnmarshalJSON(data []byte) error
type PhonenumberListResponsePhoneNumber ¶
type PhonenumberListResponsePhoneNumber struct {
// Unique identifier for the phone number
ID string `json:"id" api:"required" format:"uuid"`
// Phone number in E.164 format
PhoneNumber string `json:"phone_number" api:"required"`
Capabilities PhonenumberListResponsePhoneNumberCapabilities `json:"capabilities"`
// Deprecated. Always null.
CountryCode string `json:"country_code"`
// Deprecated. Always null.
Type string `json:"type" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
PhoneNumber respjson.Field
Capabilities respjson.Field
CountryCode respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PhonenumberListResponsePhoneNumber) RawJSON ¶
func (r PhonenumberListResponsePhoneNumber) RawJSON() string
Returns the unmodified JSON received from the API
func (*PhonenumberListResponsePhoneNumber) UnmarshalJSON ¶
func (r *PhonenumberListResponsePhoneNumber) UnmarshalJSON(data []byte) error
type PhonenumberListResponsePhoneNumberCapabilities ¶
type PhonenumberListResponsePhoneNumberCapabilities struct {
// Whether MMS messaging is supported
Mms bool `json:"mms" api:"required"`
// Whether SMS messaging is supported
SMS bool `json:"sms" api:"required"`
// Whether voice calls are supported
Voice bool `json:"voice" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Mms respjson.Field
SMS respjson.Field
Voice respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PhonenumberListResponsePhoneNumberCapabilities) RawJSON ¶
func (r PhonenumberListResponsePhoneNumberCapabilities) RawJSON() string
Returns the unmodified JSON received from the API
func (*PhonenumberListResponsePhoneNumberCapabilities) UnmarshalJSON ¶
func (r *PhonenumberListResponsePhoneNumberCapabilities) UnmarshalJSON(data []byte) error
type PhonenumberService ¶
type PhonenumberService struct {
Options []option.RequestOption
}
Phone Numbers represent the phone numbers assigned to your partner account.
Use the list phone numbers endpoint to discover which phone numbers are available for sending messages.
When creating chats, listing chats, or sending a voice memo, use one of your assigned phone numbers in the `from` field.
PhonenumberService contains methods and other services that help with interacting with the linq-api-v3 API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPhonenumberService method instead.
func NewPhonenumberService ¶
func NewPhonenumberService(opts ...option.RequestOption) (r PhonenumberService)
NewPhonenumberService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*PhonenumberService) List
deprecated
func (r *PhonenumberService) List(ctx context.Context, opts ...option.RequestOption) (res *PhonenumberListResponse, err error)
**Deprecated.** Use `GET /v3/phone_numbers` instead.
Deprecated: deprecated
type ReactionAddedWebhookEvent ¶ added in v0.12.0
type ReactionAddedWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Payload for reaction.added webhook events
Data ReactionEventBase `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for reaction.added events
func (ReactionAddedWebhookEvent) RawJSON ¶ added in v0.12.0
func (r ReactionAddedWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ReactionAddedWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *ReactionAddedWebhookEvent) UnmarshalJSON(data []byte) error
type ReactionEventBase ¶ added in v0.2.0
type ReactionEventBase struct {
// Whether this reaction was from the owner of the phone number (true) or from
// someone else (false)
IsFromMe bool `json:"is_from_me" api:"required"`
// Type of reaction. Standard iMessage tapbacks are love, like, dislike, laugh,
// emphasize, question. Custom emoji reactions have type "custom" with the actual
// emoji in the custom_emoji field. Sticker reactions have type "sticker" with
// sticker attachment details in the sticker field.
//
// Any of "love", "like", "dislike", "laugh", "emphasize", "question", "custom",
// "sticker".
ReactionType shared.ReactionType `json:"reaction_type" api:"required"`
// Chat identifier (UUID)
ChatID string `json:"chat_id"`
// The actual emoji when reaction_type is "custom". Null for standard tapbacks.
CustomEmoji string `json:"custom_emoji" api:"nullable"`
// DEPRECATED: Use from_handle instead. Phone number or email address of the person
// who added/removed the reaction.
//
// Deprecated: deprecated
From string `json:"from"`
// The person who added/removed the reaction as a full handle object
FromHandle shared.ChatHandle `json:"from_handle"`
// Message identifier (UUID) that the reaction was added to or removed from
MessageID string `json:"message_id"`
// Index of the message part that was reacted to (0-based)
PartIndex int64 `json:"part_index"`
// When the reaction was added or removed
ReactedAt time.Time `json:"reacted_at" format:"date-time"`
// Messaging service type
//
// Any of "iMessage", "SMS", "RCS".
Service shared.ServiceType `json:"service"`
// Sticker attachment details when reaction_type is "sticker". Null for non-sticker
// reactions.
Sticker ReactionEventBaseSticker `json:"sticker" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
IsFromMe respjson.Field
ReactionType respjson.Field
ChatID respjson.Field
CustomEmoji respjson.Field
From respjson.Field
FromHandle respjson.Field
MessageID respjson.Field
PartIndex respjson.Field
ReactedAt respjson.Field
Service respjson.Field
Sticker respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ReactionEventBase) RawJSON ¶ added in v0.2.0
func (r ReactionEventBase) RawJSON() string
Returns the unmodified JSON received from the API
func (*ReactionEventBase) UnmarshalJSON ¶ added in v0.2.0
func (r *ReactionEventBase) UnmarshalJSON(data []byte) error
type ReactionEventBaseSticker ¶ added in v0.2.0
type ReactionEventBaseSticker struct {
// Filename of the sticker
FileName string `json:"file_name"`
// Sticker image height in pixels
Height int64 `json:"height"`
// MIME type of the sticker image
MimeType string `json:"mime_type"`
// Presigned URL for downloading the sticker image (expires in 1 hour).
URL string `json:"url" format:"uri"`
// Sticker image width in pixels
Width int64 `json:"width"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FileName respjson.Field
Height respjson.Field
MimeType respjson.Field
URL respjson.Field
Width respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Sticker attachment details when reaction_type is "sticker". Null for non-sticker reactions.
func (ReactionEventBaseSticker) RawJSON ¶ added in v0.2.0
func (r ReactionEventBaseSticker) RawJSON() string
Returns the unmodified JSON received from the API
func (*ReactionEventBaseSticker) UnmarshalJSON ¶ added in v0.2.0
func (r *ReactionEventBaseSticker) UnmarshalJSON(data []byte) error
type ReactionRemovedWebhookEvent ¶ added in v0.12.0
type ReactionRemovedWebhookEvent struct {
// API version for the webhook payload format
APIVersion string `json:"api_version" api:"required"`
// When the event was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Payload for reaction.removed webhook events
Data ReactionEventBase `json:"data" api:"required"`
// Unique identifier for this event (for deduplication)
EventID string `json:"event_id" api:"required" format:"uuid"`
// Valid webhook event types that can be subscribed to.
//
// **Note:** `message.edited` is only delivered to subscriptions using
// `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
// subscription will not produce any deliveries.
//
// Any of "message.sent", "message.received", "message.read", "message.delivered",
// "message.failed", "message.edited", "reaction.added", "reaction.removed",
// "participant.added", "participant.removed", "chat.created",
// "chat.group_name_updated", "chat.group_icon_updated",
// "chat.group_name_update_failed", "chat.group_icon_update_failed",
// "chat.typing_indicator.started", "chat.typing_indicator.stopped",
// "phone_number.status_updated", "call.initiated", "call.ringing",
// "call.answered", "call.ended", "call.failed", "call.declined", "call.no_answer".
EventType WebhookEventType `json:"event_type" api:"required"`
// Partner identifier. Present on all webhooks for cross-referencing.
PartnerID string `json:"partner_id" api:"required"`
// Trace ID for debugging and correlation across systems.
TraceID string `json:"trace_id" api:"required"`
// Date-based webhook payload version. Determined by the `?version=` query
// parameter in your webhook subscription URL. If no version parameter is
// specified, defaults based on subscription creation date.
WebhookVersion string `json:"webhook_version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIVersion respjson.Field
CreatedAt respjson.Field
Data respjson.Field
EventID respjson.Field
EventType respjson.Field
PartnerID respjson.Field
TraceID respjson.Field
WebhookVersion respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Complete webhook payload for reaction.removed events
func (ReactionRemovedWebhookEvent) RawJSON ¶ added in v0.12.0
func (r ReactionRemovedWebhookEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ReactionRemovedWebhookEvent) UnmarshalJSON ¶ added in v0.12.0
func (r *ReactionRemovedWebhookEvent) UnmarshalJSON(data []byte) error
type ReactionSticker ¶ added in v0.1.1
type ReactionSticker = shared.ReactionSticker
Sticker attachment details when reaction_type is "sticker". Null for non-sticker reactions.
This is an alias to an internal type.
type ReactionType ¶
type ReactionType = shared.ReactionType
Type of reaction. Standard iMessage tapbacks are love, like, dislike, laugh, emphasize, question. Custom emoji reactions have type "custom" with the actual emoji in the custom_emoji field. Sticker reactions have type "sticker" with sticker attachment details in the sticker field.
This is an alias to an internal type.
type ReplyTo ¶
type ReplyTo struct {
// The ID of the message to reply to
MessageID string `json:"message_id" api:"required" format:"uuid"`
// The specific message part to reply to (0-based index). Defaults to 0 (first
// part) if not provided. Use this when replying to a specific part of a multipart
// message.
PartIndex int64 `json:"part_index"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MessageID respjson.Field
PartIndex respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Indicates this message is a threaded reply to another message
func (ReplyTo) ToParam ¶
func (r ReplyTo) ToParam() ReplyToParam
ToParam converts this ReplyTo to a ReplyToParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ReplyToParam.Overrides()
func (*ReplyTo) UnmarshalJSON ¶
type ReplyToParam ¶
type ReplyToParam struct {
// The ID of the message to reply to
MessageID string `json:"message_id" api:"required" format:"uuid"`
// The specific message part to reply to (0-based index). Defaults to 0 (first
// part) if not provided. Use this when replying to a specific part of a multipart
// message.
PartIndex param.Opt[int64] `json:"part_index,omitzero"`
// contains filtered or unexported fields
}
Indicates this message is a threaded reply to another message
The property MessageID is required.
func (ReplyToParam) MarshalJSON ¶
func (r ReplyToParam) MarshalJSON() (data []byte, err error)
func (*ReplyToParam) UnmarshalJSON ¶
func (r *ReplyToParam) UnmarshalJSON(data []byte) error
type SchemasMediaPartResponse ¶ added in v0.2.0
type SchemasMediaPartResponse struct {
// Unique attachment identifier
ID string `json:"id" api:"required" format:"uuid"`
// Original filename
Filename string `json:"filename" api:"required"`
// MIME type of the file
MimeType string `json:"mime_type" api:"required"`
// File size in bytes
SizeBytes int64 `json:"size_bytes" api:"required"`
// Indicates this is a media attachment part
//
// Any of "media".
Type SchemasMediaPartResponseType `json:"type" api:"required"`
// Presigned URL for downloading the attachment (expires in 1 hour).
URL string `json:"url" api:"required" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Filename respjson.Field
MimeType respjson.Field
SizeBytes respjson.Field
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A media attachment part
func (SchemasMediaPartResponse) RawJSON ¶ added in v0.2.0
func (r SchemasMediaPartResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*SchemasMediaPartResponse) UnmarshalJSON ¶ added in v0.2.0
func (r *SchemasMediaPartResponse) UnmarshalJSON(data []byte) error
type SchemasMediaPartResponseType ¶ added in v0.2.0
type SchemasMediaPartResponseType string
Indicates this is a media attachment part
const (
SchemasMediaPartResponseTypeMedia SchemasMediaPartResponseType = "media"
)
type SchemasMessageEffect ¶ added in v0.2.0
type SchemasMessageEffect struct {
// Effect name (confetti, fireworks, slam, gentle, etc.)
Name string `json:"name"`
// Effect category
//
// Any of "screen", "bubble".
Type SchemasMessageEffectType `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Name respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
iMessage effect applied to a message (screen or bubble animation)
func (SchemasMessageEffect) RawJSON ¶ added in v0.2.0
func (r SchemasMessageEffect) RawJSON() string
Returns the unmodified JSON received from the API
func (*SchemasMessageEffect) UnmarshalJSON ¶ added in v0.2.0
func (r *SchemasMessageEffect) UnmarshalJSON(data []byte) error
type SchemasMessageEffectType ¶ added in v0.2.0
type SchemasMessageEffectType string
Effect category
const ( SchemasMessageEffectTypeScreen SchemasMessageEffectType = "screen" SchemasMessageEffectTypeBubble SchemasMessageEffectType = "bubble" )
type SchemasTextPartResponse ¶ added in v0.2.0
type SchemasTextPartResponse struct {
// Indicates this is a text message part
//
// Any of "text".
Type SchemasTextPartResponseType `json:"type" api:"required"`
// The text content
Value string `json:"value" api:"required"`
// Text decorations applied to character ranges in the value
TextDecorations []shared.TextDecoration `json:"text_decorations" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
Value respjson.Field
TextDecorations respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A text message part
func (SchemasTextPartResponse) RawJSON ¶ added in v0.2.0
func (r SchemasTextPartResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*SchemasTextPartResponse) UnmarshalJSON ¶ added in v0.2.0
func (r *SchemasTextPartResponse) UnmarshalJSON(data []byte) error
type SchemasTextPartResponseType ¶ added in v0.2.0
type SchemasTextPartResponseType string
Indicates this is a text message part
const (
SchemasTextPartResponseTypeText SchemasTextPartResponseType = "text"
)
type SentMessage ¶
type SentMessage struct {
// Message identifier (UUID)
ID string `json:"id" api:"required" format:"uuid"`
// Current delivery status of a message
//
// Any of "pending", "queued", "sent", "delivered", "failed".
DeliveryStatus SentMessageDeliveryStatus `json:"delivery_status" api:"required"`
// Whether the message has been read
IsRead bool `json:"is_read" api:"required"`
// Message parts in order (text, media, and link)
Parts []SentMessagePartUnion `json:"parts" api:"required"`
// When the message was sent
SentAt time.Time `json:"sent_at" api:"required" format:"date-time"`
// When the message was delivered
DeliveredAt time.Time `json:"delivered_at" api:"nullable" format:"date-time"`
// iMessage effect applied to a message (screen or bubble effect)
Effect MessageEffect `json:"effect" api:"nullable"`
// The sender of this message as a full handle object
FromHandle shared.ChatHandle `json:"from_handle" api:"nullable"`
// Messaging service type
//
// Any of "iMessage", "SMS", "RCS".
PreferredService shared.ServiceType `json:"preferred_service" api:"nullable"`
// Indicates this message is a threaded reply to another message
ReplyTo ReplyTo `json:"reply_to" api:"nullable"`
// Messaging service type
//
// Any of "iMessage", "SMS", "RCS".
Service shared.ServiceType `json:"service" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
DeliveryStatus respjson.Field
IsRead respjson.Field
Parts respjson.Field
SentAt respjson.Field
DeliveredAt respjson.Field
Effect respjson.Field
FromHandle respjson.Field
PreferredService respjson.Field
ReplyTo respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A message that was sent (used in CreateChat and SendMessage responses)
func (SentMessage) RawJSON ¶
func (r SentMessage) RawJSON() string
Returns the unmodified JSON received from the API
func (*SentMessage) UnmarshalJSON ¶
func (r *SentMessage) UnmarshalJSON(data []byte) error
type SentMessageDeliveryStatus ¶
type SentMessageDeliveryStatus string
Current delivery status of a message
const ( SentMessageDeliveryStatusPending SentMessageDeliveryStatus = "pending" SentMessageDeliveryStatusQueued SentMessageDeliveryStatus = "queued" SentMessageDeliveryStatusSent SentMessageDeliveryStatus = "sent" SentMessageDeliveryStatusDelivered SentMessageDeliveryStatus = "delivered" SentMessageDeliveryStatusFailed SentMessageDeliveryStatus = "failed" )
type SentMessagePartUnion ¶
type SentMessagePartUnion struct {
Reactions []shared.Reaction `json:"reactions"`
Type string `json:"type"`
Value string `json:"value"`
// This field is from variant [shared.TextPartResponse].
TextDecorations []shared.TextDecoration `json:"text_decorations"`
// This field is from variant [shared.MediaPartResponse].
ID string `json:"id"`
// This field is from variant [shared.MediaPartResponse].
Filename string `json:"filename"`
// This field is from variant [shared.MediaPartResponse].
MimeType string `json:"mime_type"`
// This field is from variant [shared.MediaPartResponse].
SizeBytes int64 `json:"size_bytes"`
// This field is from variant [shared.MediaPartResponse].
URL string `json:"url"`
JSON struct {
Reactions respjson.Field
Type respjson.Field
Value respjson.Field
TextDecorations respjson.Field
ID respjson.Field
Filename respjson.Field
MimeType respjson.Field
SizeBytes respjson.Field
URL respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
SentMessagePartUnion contains all possible properties and values from shared.TextPartResponse, shared.MediaPartResponse, shared.LinkPartResponse.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (SentMessagePartUnion) AsLinkPartResponse ¶ added in v0.13.0
func (u SentMessagePartUnion) AsLinkPartResponse() (v shared.LinkPartResponse)
func (SentMessagePartUnion) AsMediaPartResponse ¶ added in v0.2.0
func (u SentMessagePartUnion) AsMediaPartResponse() (v shared.MediaPartResponse)
func (SentMessagePartUnion) AsTextPartResponse ¶ added in v0.2.0
func (u SentMessagePartUnion) AsTextPartResponse() (v shared.TextPartResponse)
func (SentMessagePartUnion) RawJSON ¶
func (u SentMessagePartUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*SentMessagePartUnion) UnmarshalJSON ¶
func (r *SentMessagePartUnion) UnmarshalJSON(data []byte) error
type ServiceType ¶
type ServiceType = shared.ServiceType
Messaging service type
This is an alias to an internal type.
type SetContactCard ¶ added in v0.8.0
type SetContactCard struct {
// First name on the contact card
FirstName string `json:"first_name" api:"required"`
// Whether the contact card was successfully applied to the device
IsActive bool `json:"is_active" api:"required"`
// The phone number the contact card is associated with
PhoneNumber string `json:"phone_number" api:"required"`
// Image URL on the contact card
ImageURL string `json:"image_url"`
// Last name on the contact card
LastName string `json:"last_name"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FirstName respjson.Field
IsActive respjson.Field
PhoneNumber respjson.Field
ImageURL respjson.Field
LastName respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (SetContactCard) RawJSON ¶ added in v0.8.0
func (r SetContactCard) RawJSON() string
Returns the unmodified JSON received from the API
func (*SetContactCard) UnmarshalJSON ¶ added in v0.8.0
func (r *SetContactCard) UnmarshalJSON(data []byte) error
type SupportedContentType ¶
type SupportedContentType string
Supported MIME types for file attachments and media URLs.
**Images:** image/jpeg, image/png, image/gif, image/heic, image/heif, image/tiff, image/bmp
**Videos:** video/mp4, video/quicktime, video/mpeg, video/3gpp
**Audio:** audio/mpeg, audio/mp4, audio/x-m4a, audio/x-caf, audio/wav, audio/aiff, audio/aac, audio/amr
**Documents:** application/pdf, text/plain, text/markdown, text/vcard, text/rtf, text/csv, text/html, text/calendar, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/vnd.apple.pages, application/vnd.apple.numbers, application/vnd.apple.keynote, application/epub+zip, application/zip
**Unsupported:** WebP, SVG, FLAC, OGG, and executable files are explicitly rejected.
const ( SupportedContentTypeImageJpeg SupportedContentType = "image/jpeg" SupportedContentTypeImageJpg SupportedContentType = "image/jpg" SupportedContentTypeImagePng SupportedContentType = "image/png" SupportedContentTypeImageGif SupportedContentType = "image/gif" SupportedContentTypeImageHeic SupportedContentType = "image/heic" SupportedContentTypeImageHeif SupportedContentType = "image/heif" SupportedContentTypeImageTiff SupportedContentType = "image/tiff" SupportedContentTypeImageBmp SupportedContentType = "image/bmp" SupportedContentTypeImageXMsBmp SupportedContentType = "image/x-ms-bmp" SupportedContentTypeVideoMP4 SupportedContentType = "video/mp4" SupportedContentTypeVideoQuicktime SupportedContentType = "video/quicktime" SupportedContentTypeVideoMpeg SupportedContentType = "video/mpeg" SupportedContentTypeVideoXM4v SupportedContentType = "video/x-m4v" SupportedContentTypeVideo3gpp SupportedContentType = "video/3gpp" SupportedContentTypeAudioMpeg SupportedContentType = "audio/mpeg" SupportedContentTypeAudioMP3 SupportedContentType = "audio/mp3" SupportedContentTypeAudioMP4 SupportedContentType = "audio/mp4" SupportedContentTypeAudioXM4a SupportedContentType = "audio/x-m4a" SupportedContentTypeAudioM4a SupportedContentType = "audio/m4a" SupportedContentTypeAudioXCaf SupportedContentType = "audio/x-caf" SupportedContentTypeAudioWav SupportedContentType = "audio/wav" SupportedContentTypeAudioXWav SupportedContentType = "audio/x-wav" SupportedContentTypeAudioAiff SupportedContentType = "audio/aiff" SupportedContentTypeAudioXAiff SupportedContentType = "audio/x-aiff" SupportedContentTypeAudioAac SupportedContentType = "audio/aac" SupportedContentTypeAudioXAac SupportedContentType = "audio/x-aac" SupportedContentTypeAudioAmr SupportedContentType = "audio/amr" SupportedContentTypeApplicationPdf SupportedContentType = "application/pdf" SupportedContentTypeTextPlain SupportedContentType = "text/plain" SupportedContentTypeTextMarkdown SupportedContentType = "text/markdown" SupportedContentTypeTextVcard SupportedContentType = "text/vcard" SupportedContentTypeTextXVcard SupportedContentType = "text/x-vcard" SupportedContentTypeTextRtf SupportedContentType = "text/rtf" SupportedContentTypeApplicationRtf SupportedContentType = "application/rtf" SupportedContentTypeTextCsv SupportedContentType = "text/csv" SupportedContentTypeTextHTML SupportedContentType = "text/html" SupportedContentTypeTextCalendar SupportedContentType = "text/calendar" SupportedContentTypeApplicationMsword SupportedContentType = "application/msword" SupportedContentTypeApplicationVndOpenxmlformatsOfficedocumentWordprocessingmlDocument SupportedContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document" SupportedContentTypeApplicationVndMsExcel SupportedContentType = "application/vnd.ms-excel" SupportedContentTypeApplicationVndOpenxmlformatsOfficedocumentSpreadsheetmlSheet SupportedContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" SupportedContentTypeApplicationVndMsPowerpoint SupportedContentType = "application/vnd.ms-powerpoint" SupportedContentTypeApplicationVndOpenxmlformatsOfficedocumentPresentationmlPresentation SupportedContentType = "application/vnd.openxmlformats-officedocument.presentationml.presentation" SupportedContentTypeApplicationVndApplePages SupportedContentType = "application/vnd.apple.pages" SupportedContentTypeApplicationXIworkPagesSffpages SupportedContentType = "application/x-iwork-pages-sffpages" SupportedContentTypeApplicationVndAppleNumbers SupportedContentType = "application/vnd.apple.numbers" SupportedContentTypeApplicationXIworkNumbersSffnumbers SupportedContentType = "application/x-iwork-numbers-sffnumbers" SupportedContentTypeApplicationVndAppleKeynote SupportedContentType = "application/vnd.apple.keynote" SupportedContentTypeApplicationXIworkKeynoteSffkey SupportedContentType = "application/x-iwork-keynote-sffkey" SupportedContentTypeApplicationEpubZip SupportedContentType = "application/epub+zip" SupportedContentTypeApplicationZip SupportedContentType = "application/zip" SupportedContentTypeApplicationXZipCompressed SupportedContentType = "application/x-zip-compressed" )
type TextDecoration ¶ added in v0.8.0
type TextDecoration = shared.TextDecoration
This is an alias to an internal type.
type TextDecorationAnimation ¶ added in v0.8.0
type TextDecorationAnimation = shared.TextDecorationAnimation
Animated text effect to apply. Mutually exclusive with `style`.
This is an alias to an internal type.
type TextDecorationParam ¶ added in v0.8.0
type TextDecorationParam = shared.TextDecorationParam
This is an alias to an internal type.
type TextDecorationStyle ¶ added in v0.8.0
type TextDecorationStyle = shared.TextDecorationStyle
Text style to apply. Mutually exclusive with `animation`.
This is an alias to an internal type.
type TextPartParam ¶ added in v0.2.0
type TextPartParam struct {
// Indicates this is a text message part
//
// Any of "text".
Type TextPartType `json:"type,omitzero" api:"required"`
// The text content of the message. This value is sent as-is with no parsing or
// transformation — Markdown syntax will be delivered as plain text. Use
// `text_decorations` to apply inline formatting and animations (iMessage only).
Value string `json:"value" api:"required"`
// Optional array of text decorations applied to character ranges in the `value`
// field (iMessage only).
//
// Each decoration specifies a character range `[start, end)` and exactly one of
// `style` or `animation`.
//
// **Styles:** `bold`, `italic`, `strikethrough`, `underline` **Animations:**
// `big`, `small`, `shake`, `nod`, `explode`, `ripple`, `bloom`, `jitter`
//
// Style ranges may overlap (e.g. bold + italic on the same text), but animation
// ranges must not overlap with other animations or styles.
//
// _Characters are measured as UTF-16 code units. Most characters count as 1; some
// emoji count as 2._
//
// **Note:** Text decorations only render for iMessage recipients. For SMS/RCS,
// text decorations are not applied.
TextDecorations []shared.TextDecorationParam `json:"text_decorations,omitzero"`
// contains filtered or unexported fields
}
The properties Type, Value are required.
func (TextPartParam) MarshalJSON ¶ added in v0.2.0
func (r TextPartParam) MarshalJSON() (data []byte, err error)
func (*TextPartParam) UnmarshalJSON ¶ added in v0.2.0
func (r *TextPartParam) UnmarshalJSON(data []byte) error
type TextPartResponse ¶ added in v0.2.0
type TextPartResponse = shared.TextPartResponse
A text message part
This is an alias to an internal type.
type TextPartResponseType ¶ added in v0.2.0
type TextPartResponseType = shared.TextPartResponseType
Indicates this is a text message part
This is an alias to an internal type.
type TextPartType ¶
type TextPartType string
Indicates this is a text message part
const (
TextPartTypeText TextPartType = "text"
)
type WebhookEventListResponse ¶
type WebhookEventListResponse struct {
// URL to the webhook events documentation
DocURL constant.HTTPSApidocsLinqappComDocumentationWebhookEvents `json:"doc_url" default:"https://apidocs.linqapp.com/documentation/webhook-events"`
// List of all available webhook event types
Events []WebhookEventType `json:"events" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
DocURL respjson.Field
Events respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebhookEventListResponse) RawJSON ¶
func (r WebhookEventListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookEventListResponse) UnmarshalJSON ¶
func (r *WebhookEventListResponse) UnmarshalJSON(data []byte) error
type WebhookEventService ¶
type WebhookEventService struct {
Options []option.RequestOption
}
Webhook Subscriptions allow you to receive real-time notifications when events occur on your account.
Configure webhook endpoints to receive events such as messages sent/received, delivery status changes, reactions, typing indicators, and more.
Failed deliveries (5xx, 429, network errors) are retried up to 10 times over ~25 minutes with exponential backoff. Each event includes a unique ID for deduplication.
## Webhook Headers
Each webhook request includes the following headers:
| Header | Description | | --------------------------- | --------------------------------------------------------- | | `X-Webhook-Event` | The event type (e.g., `message.sent`, `message.received`) | | `X-Webhook-Subscription-ID` | Your webhook subscription ID | | `X-Webhook-Timestamp` | Unix timestamp (seconds) when the webhook was sent | | `X-Webhook-Signature` | HMAC-SHA256 signature for verification |
## Verifying Webhook Signatures
All webhooks are signed using HMAC-SHA256. You should always verify the signature to ensure the webhook originated from Linq and hasn't been tampered with.
**Signature Construction:**
The signature is computed over a concatenation of the timestamp and payload:
``` {timestamp}.{payload} ```
Where:
- `timestamp` is the value from the `X-Webhook-Timestamp` header - `payload` is the raw JSON request body (exact bytes, not re-serialized)
**Verification Steps:**
1. Extract the `X-Webhook-Timestamp` and `X-Webhook-Signature` headers 2. Get the raw request body bytes (do not parse and re-serialize) 3. Concatenate: `"{timestamp}.{payload}"` 4. Compute HMAC-SHA256 using your signing secret as the key 5. Hex-encode the result and compare with `X-Webhook-Signature` 6. Use constant-time comparison to prevent timing attacks
**Example (Python):**
```python import hmac import hashlib
def verify_webhook(signing_secret, payload, timestamp, signature):
message = f"{timestamp}.{payload.decode('utf-8')}"
expected = hmac.new(
signing_secret.encode('utf-8'),
message.encode('utf-8'),
hashlib.sha256
).hexdigest()
return hmac.compare_digest(expected, signature)
```
**Example (Node.js):**
```javascript const crypto = require("crypto");
function verifyWebhook(signingSecret, payload, timestamp, signature) {
const message = `${timestamp}.${payload}`;
const expected = crypto
.createHmac("sha256", signingSecret)
.update(message)
.digest("hex");
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
}
```
**Security Best Practices:**
- Reject webhooks with timestamps older than 5 minutes to prevent replay attacks
- Always use constant-time comparison for signature verification
- Store your signing secret securely (e.g., environment variable, secrets manager)
- Return a 2xx status code quickly, then process the webhook asynchronously
WebhookEventService contains methods and other services that help with interacting with the linq-api-v3 API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWebhookEventService method instead.
func NewWebhookEventService ¶
func NewWebhookEventService(opts ...option.RequestOption) (r WebhookEventService)
NewWebhookEventService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*WebhookEventService) List ¶
func (r *WebhookEventService) List(ctx context.Context, opts ...option.RequestOption) (res *WebhookEventListResponse, err error)
Returns all available webhook event types that can be subscribed to. Use this endpoint to discover valid values for the `subscribed_events` field when creating or updating webhook subscriptions.
type WebhookEventType ¶
type WebhookEventType string
Valid webhook event types that can be subscribed to.
**Note:** `message.edited` is only delivered to subscriptions using `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025 subscription will not produce any deliveries.
const ( WebhookEventTypeMessageSent WebhookEventType = "message.sent" WebhookEventTypeMessageReceived WebhookEventType = "message.received" WebhookEventTypeMessageRead WebhookEventType = "message.read" WebhookEventTypeMessageDelivered WebhookEventType = "message.delivered" WebhookEventTypeMessageFailed WebhookEventType = "message.failed" WebhookEventTypeMessageEdited WebhookEventType = "message.edited" WebhookEventTypeReactionAdded WebhookEventType = "reaction.added" WebhookEventTypeReactionRemoved WebhookEventType = "reaction.removed" WebhookEventTypeParticipantAdded WebhookEventType = "participant.added" WebhookEventTypeParticipantRemoved WebhookEventType = "participant.removed" WebhookEventTypeChatCreated WebhookEventType = "chat.created" WebhookEventTypeChatGroupNameUpdated WebhookEventType = "chat.group_name_updated" WebhookEventTypeChatGroupIconUpdated WebhookEventType = "chat.group_icon_updated" WebhookEventTypeChatGroupNameUpdateFailed WebhookEventType = "chat.group_name_update_failed" WebhookEventTypeChatGroupIconUpdateFailed WebhookEventType = "chat.group_icon_update_failed" WebhookEventTypeChatTypingIndicatorStarted WebhookEventType = "chat.typing_indicator.started" WebhookEventTypeChatTypingIndicatorStopped WebhookEventType = "chat.typing_indicator.stopped" WebhookEventTypePhoneNumberStatusUpdated WebhookEventType = "phone_number.status_updated" WebhookEventTypeCallInitiated WebhookEventType = "call.initiated" WebhookEventTypeCallRinging WebhookEventType = "call.ringing" WebhookEventTypeCallAnswered WebhookEventType = "call.answered" WebhookEventTypeCallEnded WebhookEventType = "call.ended" WebhookEventTypeCallFailed WebhookEventType = "call.failed" WebhookEventTypeCallDeclined WebhookEventType = "call.declined" WebhookEventTypeCallNoAnswer WebhookEventType = "call.no_answer" )
type WebhookService ¶ added in v0.2.0
type WebhookService struct {
Options []option.RequestOption
}
WebhookService contains methods and other services that help with interacting with the linq-api-v3 API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWebhookService method instead.
func NewWebhookService ¶ added in v0.2.0
func NewWebhookService(opts ...option.RequestOption) (r WebhookService)
NewWebhookService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*WebhookService) Events ¶ added in v0.2.0
func (r *WebhookService) Events(payload []byte, opts ...option.RequestOption) (*EventsWebhookEventUnion, error)
type WebhookSubscription ¶
type WebhookSubscription struct {
// Unique identifier for the webhook subscription
ID string `json:"id" api:"required"`
// When the subscription was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Whether this subscription is currently active
IsActive bool `json:"is_active" api:"required"`
// List of event types this subscription receives
SubscribedEvents []WebhookEventType `json:"subscribed_events" api:"required"`
// URL where webhook events will be sent
TargetURL string `json:"target_url" api:"required" format:"uri"`
// When the subscription was last updated
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// Phone numbers this subscription filters for. If null or empty, events from all
// phone numbers are delivered.
PhoneNumbers []string `json:"phone_numbers" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
IsActive respjson.Field
SubscribedEvents respjson.Field
TargetURL respjson.Field
UpdatedAt respjson.Field
PhoneNumbers respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebhookSubscription) RawJSON ¶
func (r WebhookSubscription) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookSubscription) UnmarshalJSON ¶
func (r *WebhookSubscription) UnmarshalJSON(data []byte) error
type WebhookSubscriptionListResponse ¶
type WebhookSubscriptionListResponse struct {
// List of webhook subscriptions
Subscriptions []WebhookSubscription `json:"subscriptions" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Subscriptions respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebhookSubscriptionListResponse) RawJSON ¶
func (r WebhookSubscriptionListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookSubscriptionListResponse) UnmarshalJSON ¶
func (r *WebhookSubscriptionListResponse) UnmarshalJSON(data []byte) error
type WebhookSubscriptionNewParams ¶
type WebhookSubscriptionNewParams struct {
// List of event types to subscribe to
SubscribedEvents []WebhookEventType `json:"subscribed_events,omitzero" api:"required"`
// URL where webhook events will be sent. Must be HTTPS.
TargetURL string `json:"target_url" api:"required" format:"uri"`
// Optional list of phone numbers to filter events for. Only events originating
// from these phone numbers will be delivered to this subscription. If omitted or
// empty, events from all phone numbers are delivered. Phone numbers must be in
// E.164 format.
PhoneNumbers []string `json:"phone_numbers,omitzero"`
// contains filtered or unexported fields
}
func (WebhookSubscriptionNewParams) MarshalJSON ¶
func (r WebhookSubscriptionNewParams) MarshalJSON() (data []byte, err error)
func (*WebhookSubscriptionNewParams) UnmarshalJSON ¶
func (r *WebhookSubscriptionNewParams) UnmarshalJSON(data []byte) error
type WebhookSubscriptionNewResponse ¶
type WebhookSubscriptionNewResponse struct {
// Unique identifier for the webhook subscription
ID string `json:"id" api:"required"`
// When the subscription was created
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Whether this subscription is currently active
IsActive bool `json:"is_active" api:"required"`
// Secret for verifying webhook signatures. Store this securely - it cannot be
// retrieved again.
SigningSecret string `json:"signing_secret" api:"required"`
// List of event types this subscription receives
SubscribedEvents []WebhookEventType `json:"subscribed_events" api:"required"`
// URL where webhook events will be sent
TargetURL string `json:"target_url" api:"required" format:"uri"`
// When the subscription was last updated
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// Phone numbers this subscription filters for. If null or empty, events from all
// phone numbers are delivered.
PhoneNumbers []string `json:"phone_numbers" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
IsActive respjson.Field
SigningSecret respjson.Field
SubscribedEvents respjson.Field
TargetURL respjson.Field
UpdatedAt respjson.Field
PhoneNumbers respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Response returned when creating a webhook subscription. Includes the signing secret which is only shown once.
func (WebhookSubscriptionNewResponse) RawJSON ¶
func (r WebhookSubscriptionNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookSubscriptionNewResponse) UnmarshalJSON ¶
func (r *WebhookSubscriptionNewResponse) UnmarshalJSON(data []byte) error
type WebhookSubscriptionService ¶
type WebhookSubscriptionService struct {
Options []option.RequestOption
}
Webhook Subscriptions allow you to receive real-time notifications when events occur on your account.
Configure webhook endpoints to receive events such as messages sent/received, delivery status changes, reactions, typing indicators, and more.
Failed deliveries (5xx, 429, network errors) are retried up to 10 times over ~25 minutes with exponential backoff. Each event includes a unique ID for deduplication.
## Webhook Headers
Each webhook request includes the following headers:
| Header | Description | | --------------------------- | --------------------------------------------------------- | | `X-Webhook-Event` | The event type (e.g., `message.sent`, `message.received`) | | `X-Webhook-Subscription-ID` | Your webhook subscription ID | | `X-Webhook-Timestamp` | Unix timestamp (seconds) when the webhook was sent | | `X-Webhook-Signature` | HMAC-SHA256 signature for verification |
## Verifying Webhook Signatures
All webhooks are signed using HMAC-SHA256. You should always verify the signature to ensure the webhook originated from Linq and hasn't been tampered with.
**Signature Construction:**
The signature is computed over a concatenation of the timestamp and payload:
``` {timestamp}.{payload} ```
Where:
- `timestamp` is the value from the `X-Webhook-Timestamp` header - `payload` is the raw JSON request body (exact bytes, not re-serialized)
**Verification Steps:**
1. Extract the `X-Webhook-Timestamp` and `X-Webhook-Signature` headers 2. Get the raw request body bytes (do not parse and re-serialize) 3. Concatenate: `"{timestamp}.{payload}"` 4. Compute HMAC-SHA256 using your signing secret as the key 5. Hex-encode the result and compare with `X-Webhook-Signature` 6. Use constant-time comparison to prevent timing attacks
**Example (Python):**
```python import hmac import hashlib
def verify_webhook(signing_secret, payload, timestamp, signature):
message = f"{timestamp}.{payload.decode('utf-8')}"
expected = hmac.new(
signing_secret.encode('utf-8'),
message.encode('utf-8'),
hashlib.sha256
).hexdigest()
return hmac.compare_digest(expected, signature)
```
**Example (Node.js):**
```javascript const crypto = require("crypto");
function verifyWebhook(signingSecret, payload, timestamp, signature) {
const message = `${timestamp}.${payload}`;
const expected = crypto
.createHmac("sha256", signingSecret)
.update(message)
.digest("hex");
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
}
```
**Security Best Practices:**
- Reject webhooks with timestamps older than 5 minutes to prevent replay attacks
- Always use constant-time comparison for signature verification
- Store your signing secret securely (e.g., environment variable, secrets manager)
- Return a 2xx status code quickly, then process the webhook asynchronously
WebhookSubscriptionService contains methods and other services that help with interacting with the linq-api-v3 API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWebhookSubscriptionService method instead.
func NewWebhookSubscriptionService ¶
func NewWebhookSubscriptionService(opts ...option.RequestOption) (r WebhookSubscriptionService)
NewWebhookSubscriptionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*WebhookSubscriptionService) Delete ¶
func (r *WebhookSubscriptionService) Delete(ctx context.Context, subscriptionID string, opts ...option.RequestOption) (err error)
Delete a webhook subscription.
func (*WebhookSubscriptionService) Get ¶
func (r *WebhookSubscriptionService) Get(ctx context.Context, subscriptionID string, opts ...option.RequestOption) (res *WebhookSubscription, err error)
Retrieve details for a specific webhook subscription including its target URL, subscribed events, and current status.
func (*WebhookSubscriptionService) List ¶
func (r *WebhookSubscriptionService) List(ctx context.Context, opts ...option.RequestOption) (res *WebhookSubscriptionListResponse, err error)
Retrieve all webhook subscriptions for the authenticated partner. Returns a list of active and inactive subscriptions with their configuration and status.
func (*WebhookSubscriptionService) New ¶
func (r *WebhookSubscriptionService) New(ctx context.Context, body WebhookSubscriptionNewParams, opts ...option.RequestOption) (res *WebhookSubscriptionNewResponse, err error)
Create a new webhook subscription to receive events at a target URL. Upon creation, a signing secret is generated for verifying webhook authenticity. **Store this secret securely — it cannot be retrieved later.**
**Phone Number Filtering:**
- Optionally specify `phone_numbers` to only receive events for specific lines
- If omitted, events from all phone numbers are delivered (default behavior)
- Use multiple subscriptions with different `phone_numbers` to route different lines to different endpoints
- Each `target_url` can only be used once per account. To route different lines to different destinations, use a unique URL per subscription (e.g., append a query parameter: `https://example.com/webhook?line=1`)
**Webhook Delivery:**
- Events are sent via HTTP POST to the target URL
- Each request includes `X-Webhook-Signature` and `X-Webhook-Timestamp` headers
- Signature is HMAC-SHA256 over `{timestamp}.{payload}` — see [Webhook Events](/docs/webhook-events) for verification details
- Failed deliveries (5xx, 429, network errors) are retried up to 10 times over ~25 minutes with exponential backoff
- Client errors (4xx except 429) are not retried
func (*WebhookSubscriptionService) Update ¶
func (r *WebhookSubscriptionService) Update(ctx context.Context, subscriptionID string, body WebhookSubscriptionUpdateParams, opts ...option.RequestOption) (res *WebhookSubscription, err error)
Update an existing webhook subscription. You can modify the target URL, subscribed events, or activate/deactivate the subscription.
**Note:** The signing secret cannot be changed via this endpoint.
type WebhookSubscriptionUpdateParams ¶
type WebhookSubscriptionUpdateParams struct {
// Activate or deactivate the subscription
IsActive param.Opt[bool] `json:"is_active,omitzero"`
// New target URL for webhook events
TargetURL param.Opt[string] `json:"target_url,omitzero" format:"uri"`
// Updated list of phone numbers to filter events for. Set to a non-empty array to
// filter events to specific phone numbers. Set to an empty array or null to remove
// the filter and receive events from all phone numbers. Phone numbers must be in
// E.164 format.
PhoneNumbers []string `json:"phone_numbers,omitzero"`
// Updated list of event types to subscribe to
SubscribedEvents []WebhookEventType `json:"subscribed_events,omitzero"`
// contains filtered or unexported fields
}
func (WebhookSubscriptionUpdateParams) MarshalJSON ¶
func (r WebhookSubscriptionUpdateParams) MarshalJSON() (data []byte, err error)
func (*WebhookSubscriptionUpdateParams) UnmarshalJSON ¶
func (r *WebhookSubscriptionUpdateParams) UnmarshalJSON(data []byte) error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
|
Package json implements encoding and decoding of JSON as defined in RFC 7159. |
|
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
|
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package. |
|
packages
|
|