Documentation
¶
Overview ¶
Package linq is a Go client for the Linq Partner API V3.
See https://apidocs.linqapp.com/ for API reference.
Package linq is an unofficial Go client for the Linq Partner API V3.
The Linq Partner API sends and receives iMessage, RCS, and SMS messages. Create a Client with an integration token and call methods grouped by resource: [Client.Chats], [Client.Messages], [Client.Reactions], [Client.Attachments], [Client.PhoneNumbers], and [Client.Webhooks].
See the README for end-to-end examples.
Index ¶
- Constants
- Variables
- func IsNotFound(err error) bool
- func IsRateLimited(err error) bool
- func IsUnauthorized(err error) bool
- func VerifyWebhook(body []byte, timestamp, signature, secret string, tolerance time.Duration) error
- func VerifyWebhookRequest(r *http.Request, secret string, tolerance time.Duration) ([]byte, error)
- type APIError
- type Attachment
- type AttachmentsService
- func (s *AttachmentsService) Create(ctx context.Context, req *CreateAttachmentRequest) (*Attachment, error)
- func (s *AttachmentsService) Get(ctx context.Context, attachmentID string) (*Attachment, error)
- func (s *AttachmentsService) Upload(ctx context.Context, att *Attachment, mimeType string, body io.Reader) error
- type Chat
- type ChatHandle
- type ChatsService
- func (s *ChatsService) AddParticipant(ctx context.Context, chatID, handle string) error
- func (s *ChatsService) Create(ctx context.Context, req *CreateChatRequest) (*CreateChatResult, error)
- func (s *ChatsService) Get(ctx context.Context, chatID string) (*Chat, error)
- func (s *ChatsService) Leave(ctx context.Context, chatID string) error
- func (s *ChatsService) List(ctx context.Context, p *ListChatsParams) (*ListChatsResult, error)
- func (s *ChatsService) MarkRead(ctx context.Context, chatID string) error
- func (s *ChatsService) RemoveParticipant(ctx context.Context, chatID, handle string) error
- func (s *ChatsService) SendVoiceMemo(ctx context.Context, chatID string, req *SendVoiceMemoRequest) (*Message, error)
- func (s *ChatsService) ShareContactCard(ctx context.Context, chatID string) error
- func (s *ChatsService) StartTyping(ctx context.Context, chatID string) error
- func (s *ChatsService) StopTyping(ctx context.Context, chatID string) error
- func (s *ChatsService) Update(ctx context.Context, chatID string, req *UpdateChatRequest) error
- type Client
- type CreateAttachmentRequest
- type CreateChatMessage
- type CreateChatRequest
- type CreateChatResult
- type CreateWebhookSubscriptionRequest
- type DeliveryStatus
- type ErrorCode
- type Event
- type EventType
- type HandleStatus
- type LinkPart
- type ListChatsParams
- type ListChatsResult
- type ListMessagesParams
- type ListMessagesResult
- type ListPhoneNumbersResult
- type ListWebhookSubscriptionsResult
- type MediaPart
- type Message
- type MessageEffect
- type MessagePart
- type MessagesService
- func (s *MessagesService) Delete(ctx context.Context, messageID string) error
- func (s *MessagesService) Get(ctx context.Context, messageID string) (*Message, error)
- func (s *MessagesService) List(ctx context.Context, chatID string, p *ListMessagesParams) (*ListMessagesResult, error)
- func (s *MessagesService) Send(ctx context.Context, chatID string, req *SendMessageRequest) (*Message, error)
- func (s *MessagesService) Thread(ctx context.Context, messageID string) (*ThreadResult, error)
- type Option
- type PhoneNumber
- type PhoneNumbersService
- type Reaction
- type ReactionRequest
- type ReactionType
- type ReactionsService
- type ReplyTo
- type SendMessageRequest
- type SendVoiceMemoRequest
- type ServiceType
- type Sticker
- type TextDecoration
- type TextPart
- type ThreadResult
- type UpdateChatRequest
- type UpdateWebhookSubscriptionRequest
- type WebhookSubscription
- type WebhooksService
- func (s *WebhooksService) Create(ctx context.Context, req *CreateWebhookSubscriptionRequest) (*WebhookSubscription, error)
- func (s *WebhooksService) Delete(ctx context.Context, id string) error
- func (s *WebhooksService) List(ctx context.Context) (*ListWebhookSubscriptionsResult, error)
- func (s *WebhooksService) Update(ctx context.Context, id string, req *UpdateWebhookSubscriptionRequest) (*WebhookSubscription, error)
Examples ¶
Constants ¶
const ( DefaultBaseURL = "https://api.linqapp.com/api/partner" DefaultUserAgent = "linq-go-sdk/0.1" )
const ( HeaderWebhookTimestamp = "X-Webhook-Timestamp" HeaderWebhookSignature = "X-Webhook-Signature" )
Webhook header names set by the Linq signing process.
const DefaultWebhookTolerance = 5 * time.Minute
DefaultWebhookTolerance is the default maximum age accepted by VerifyWebhook. Requests older than this are rejected as possible replays.
Variables ¶
var ( ErrWebhookMissingHeader = errors.New("linq: missing webhook signature header") ErrWebhookInvalidTimestamp = errors.New("linq: invalid webhook timestamp") ErrWebhookStale = errors.New("linq: webhook timestamp outside tolerance") ErrWebhookSignature = errors.New("linq: webhook signature mismatch") )
Errors returned by VerifyWebhook and VerifyWebhookRequest.
Functions ¶
func IsNotFound ¶
IsNotFound reports whether err is a 404 from the API.
func IsRateLimited ¶
IsRateLimited reports whether err is a 429 from the API.
func IsUnauthorized ¶
IsUnauthorized reports whether err is a 401 from the API.
func VerifyWebhook ¶ added in v0.2.0
VerifyWebhook verifies an HMAC-SHA256 webhook signature as specified by Linq.
The signed payload is "{timestamp}.{body}" where body is the raw request bytes (do not re-serialize JSON before calling). signature is the value of the HeaderWebhookSignature header, hex-encoded.
If tolerance is > 0, requests with a timestamp older than tolerance (or more than tolerance in the future) are rejected with ErrWebhookStale. Pass 0 to disable the freshness check — not recommended in production.
func VerifyWebhookRequest ¶ added in v0.2.0
VerifyWebhookRequest reads the full body of r, verifies its signature using VerifyWebhook, and returns the raw body bytes for downstream parsing.
On success the caller can pass the returned bytes to ParseEvent. The body of r is consumed; re-reading r.Body after this call will yield nothing.
Example ¶
// Inside an http.HandlerFunc:
//
// body, err := linq.VerifyWebhookRequest(r, secret, linq.DefaultWebhookTolerance)
// if err != nil {
// http.Error(w, err.Error(), http.StatusUnauthorized)
// return
// }
// evt, _ := linq.ParseEvent(body)
// _ = evt
fmt.Println("ok")
Output: ok
Types ¶
type APIError ¶
type APIError struct {
StatusCode int `json:"-"`
Code ErrorCode `json:"code"`
Message string `json:"message"`
RetryAfter int `json:"retry_after,omitempty"`
TraceID string `json:"-"`
RequestID string `json:"-"`
Raw []byte `json:"-"`
}
APIError represents a non-2xx response from the Linq API.
type Attachment ¶
type Attachment struct {
AttachmentID string `json:"attachment_id"`
UploadURL string `json:"upload_url"`
DownloadURL string `json:"download_url"`
ExpiresAt time.Time `json:"expires_at"`
Status string `json:"status,omitempty"`
}
Attachment is the presigned-upload response.
type AttachmentsService ¶
type AttachmentsService struct {
// contains filtered or unexported fields
}
AttachmentsService groups attachment endpoints.
func (*AttachmentsService) Create ¶
func (s *AttachmentsService) Create(ctx context.Context, req *CreateAttachmentRequest) (*Attachment, error)
Create requests a presigned URL for uploading an attachment.
func (*AttachmentsService) Get ¶
func (s *AttachmentsService) Get(ctx context.Context, attachmentID string) (*Attachment, error)
Get returns the current status of an attachment.
func (*AttachmentsService) Upload ¶
func (s *AttachmentsService) Upload(ctx context.Context, att *Attachment, mimeType string, body io.Reader) error
Upload PUTs the given content to the presigned URL. It reads body fully to set Content-Length, which S3-style presigned PUTs require.
type Chat ¶
type Chat struct {
ID string `json:"id"`
DisplayName *string `json:"display_name,omitempty"`
Service *ServiceType `json:"service,omitempty"`
Handles []ChatHandle `json:"handles,omitempty"`
IsArchived bool `json:"is_archived"`
IsGroup bool `json:"is_group"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Message *Message `json:"message,omitempty"`
}
Chat is a conversation.
Message is populated only on the response from ChatsService.Create; it carries the initial message and is nil on other endpoints.
type ChatHandle ¶
type ChatHandle struct {
ID string `json:"id"`
Handle string `json:"handle"`
Service ServiceType `json:"service"`
Status *HandleStatus `json:"status,omitempty"`
JoinedAt time.Time `json:"joined_at"`
LeftAt *time.Time `json:"left_at,omitempty"`
IsMe *bool `json:"is_me,omitempty"`
}
ChatHandle identifies a participant in a chat.
type ChatsService ¶
type ChatsService struct {
// contains filtered or unexported fields
}
ChatsService groups chat endpoints.
func (*ChatsService) AddParticipant ¶
func (s *ChatsService) AddParticipant(ctx context.Context, chatID, handle string) error
AddParticipant adds a handle (phone or email) to a group chat.
func (*ChatsService) Create ¶
func (s *ChatsService) Create(ctx context.Context, req *CreateChatRequest) (*CreateChatResult, error)
Create creates a new chat with an initial message.
func (*ChatsService) Leave ¶
func (s *ChatsService) Leave(ctx context.Context, chatID string) error
Leave leaves a group chat.
func (*ChatsService) List ¶
func (s *ChatsService) List(ctx context.Context, p *ListChatsParams) (*ListChatsResult, error)
List returns a paginated set of chats.
func (*ChatsService) MarkRead ¶
func (s *ChatsService) MarkRead(ctx context.Context, chatID string) error
MarkRead marks all messages in the chat as read.
func (*ChatsService) RemoveParticipant ¶
func (s *ChatsService) RemoveParticipant(ctx context.Context, chatID, handle string) error
RemoveParticipant removes a handle from a group chat.
func (*ChatsService) SendVoiceMemo ¶
func (s *ChatsService) SendVoiceMemo(ctx context.Context, chatID string, req *SendVoiceMemoRequest) (*Message, error)
SendVoiceMemo sends a voice memo to a chat. The attachment must be pre-uploaded.
func (*ChatsService) ShareContactCard ¶
func (s *ChatsService) ShareContactCard(ctx context.Context, chatID string) error
ShareContactCard shares the authenticated partner's contact card in the chat.
func (*ChatsService) StartTyping ¶
func (s *ChatsService) StartTyping(ctx context.Context, chatID string) error
StartTyping sends a typing-started indicator.
func (*ChatsService) StopTyping ¶
func (s *ChatsService) StopTyping(ctx context.Context, chatID string) error
StopTyping sends a typing-stopped indicator.
func (*ChatsService) Update ¶
func (s *ChatsService) Update(ctx context.Context, chatID string, req *UpdateChatRequest) error
Update updates the display name or icon of a group chat.
type Client ¶
type Client struct {
Chats *ChatsService
Messages *MessagesService
Reactions *ReactionsService
Attachments *AttachmentsService
PhoneNumbers *PhoneNumbersService
Webhooks *WebhooksService
// contains filtered or unexported fields
}
Client is the Linq Partner API client.
type CreateAttachmentRequest ¶
type CreateAttachmentRequest struct {
FileName string `json:"file_name"`
MimeType string `json:"mime_type"`
Size int64 `json:"size,omitempty"`
}
CreateAttachmentRequest requests a presigned upload URL.
type CreateChatMessage ¶
type CreateChatMessage struct {
Parts []MessagePart `json:"parts"`
Effect *MessageEffect `json:"effect,omitempty"`
PreferredService *ServiceType `json:"preferred_service,omitempty"`
ReplyTo *ReplyTo `json:"reply_to,omitempty"`
}
CreateChatMessage is the initial message sent when a chat is created.
type CreateChatRequest ¶
type CreateChatRequest struct {
From string `json:"from"`
To []string `json:"to"`
Message CreateChatMessage `json:"message"`
}
CreateChatRequest is the body for creating a chat with an initial message.
type CreateChatResult ¶
type CreateChatResult struct {
Chat Chat `json:"chat"`
}
CreateChatResult is the 201 response from creating a chat.
The initial message lives at Chat.Message, not at the top level.
type CreateWebhookSubscriptionRequest ¶
type CreateWebhookSubscriptionRequest struct {
TargetURL string `json:"target_url"`
SubscribedEvents []string `json:"subscribed_events"`
PhoneNumbers []string `json:"phone_numbers,omitempty"`
}
CreateWebhookSubscriptionRequest creates a new webhook subscription.
Set PhoneNumbers to scope the subscription to specific sender numbers; leave nil to receive events for all numbers associated with the token.
type DeliveryStatus ¶
type DeliveryStatus string
DeliveryStatus is the lifecycle state of an outbound message.
const ( DeliveryPending DeliveryStatus = "pending" DeliveryQueued DeliveryStatus = "queued" DeliverySent DeliveryStatus = "sent" DeliveryDelivered DeliveryStatus = "delivered" DeliveryFailed DeliveryStatus = "failed" )
type ErrorCode ¶
type ErrorCode int
ErrorCode is the Linq-specific error code returned in the error body.
type Event ¶
type Event struct {
APIVersion string `json:"api_version"`
EventType EventType `json:"event_type"`
EventID string `json:"event_id"`
CreatedAt time.Time `json:"created_at"`
TraceID string `json:"trace_id"`
PartnerID string `json:"partner_id"`
Data json.RawMessage `json:"data"`
}
Event is a webhook envelope. Data holds the raw event payload; decode it with DecodeData into the matching concrete type for the EventType.
func ParseEvent ¶
ParseEvent decodes a webhook request body into an Event.
func (*Event) DecodeData ¶
DecodeData unmarshals Event.Data into out.
type EventType ¶
type EventType string
EventType enumerates webhook event types.
const ( EventMessageSent EventType = "message.sent" EventMessageDelivered EventType = "message.delivered" EventMessageFailed EventType = "message.failed" EventMessageReceived EventType = "message.received" EventMessageRead EventType = "message.read" EventReactionSent EventType = "reaction.sent" EventReactionReceived EventType = "reaction.received" EventTypingIndicatorReceived EventType = "typing_indicator.received" EventTypingIndicatorRemoved EventType = "typing_indicator.removed" EventParticipantAdded EventType = "participant.added" EventParticipantRemoved EventType = "participant.removed" EventChatGroupNameUpdated EventType = "chat.group_name_updated" EventChatGroupIconUpdated EventType = "chat.group_icon_updated" EventChatGroupNameUpdateFailed EventType = "chat.group_name_update_failed" EventChatGroupIconUpdateFailed EventType = "chat.group_icon_update_failed" )
type HandleStatus ¶
type HandleStatus string
HandleStatus is the membership state of a participant in a chat.
const ( HandleActive HandleStatus = "active" HandleLeft HandleStatus = "left" HandleRemoved HandleStatus = "removed" )
type LinkPart ¶
type LinkPart struct {
Value string `json:"value"`
Reactions []Reaction `json:"reactions,omitempty"`
}
LinkPart is a link preview segment.
type ListChatsParams ¶
type ListChatsParams struct {
From string // E.164 phone number
To string // participant handle (phone or email)
Limit int // 1-100
Cursor string
}
ListChatsParams filters the List call.
type ListChatsResult ¶
type ListChatsResult struct {
Chats []Chat `json:"chats"`
NextCursor string `json:"next_cursor,omitempty"`
}
ListChatsResult is a paginated page of chats.
type ListMessagesParams ¶
ListMessagesParams filters the List call.
type ListMessagesResult ¶
type ListMessagesResult struct {
Messages []Message `json:"messages"`
NextCursor string `json:"next_cursor,omitempty"`
}
ListMessagesResult is a paginated page of messages.
type ListPhoneNumbersResult ¶
type ListPhoneNumbersResult struct {
PhoneNumbers []PhoneNumber `json:"phone_numbers"`
}
ListPhoneNumbersResult is the response for List.
type ListWebhookSubscriptionsResult ¶
type ListWebhookSubscriptionsResult struct {
Subscriptions []WebhookSubscription `json:"subscriptions"`
}
ListWebhookSubscriptionsResult is a page of subscriptions.
type MediaPart ¶
type MediaPart struct {
URL *string `json:"url,omitempty"`
AttachmentID *string `json:"attachment_id,omitempty"`
Reactions []Reaction `json:"reactions,omitempty"`
}
MediaPart references an attachment by URL or attachment_id.
type Message ¶
type Message struct {
ID string `json:"id"`
Service *ServiceType `json:"service,omitempty"`
PreferredService *ServiceType `json:"preferred_service,omitempty"`
Parts []MessagePart `json:"parts"`
CreatedAt time.Time `json:"created_at"`
SentAt *time.Time `json:"sent_at,omitempty"`
DeliveredAt *time.Time `json:"delivered_at,omitempty"`
DeliveryStatus DeliveryStatus `json:"delivery_status"`
IsRead bool `json:"is_read"`
Effect *MessageEffect `json:"effect,omitempty"`
FromHandle *ChatHandle `json:"from_handle,omitempty"`
ReplyTo *ReplyTo `json:"reply_to,omitempty"`
}
Message is a chat message.
type MessageEffect ¶
MessageEffect is a screen or bubble effect applied to a message. Type must be "screen" or "bubble".
type MessagePart ¶
MessagePart is a discriminated union: Text, Media, or Link. Exactly one of the pointer fields on the wrapper is set after unmarshal.
func NewMediaPartByID ¶
func NewMediaPartByID(attachmentID string) MessagePart
NewMediaPartByID builds a media MessagePart from an uploaded attachment.
func NewMediaPartByURL ¶
func NewMediaPartByURL(url string) MessagePart
NewMediaPartByURL builds a media MessagePart from an HTTPS URL.
func NewTextPart ¶
func NewTextPart(value string) MessagePart
NewTextPart is a convenience for building a text MessagePart.
func (MessagePart) MarshalJSON ¶
func (p MessagePart) MarshalJSON() ([]byte, error)
MarshalJSON encodes the active variant with its type discriminator.
func (*MessagePart) UnmarshalJSON ¶
func (p *MessagePart) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes a tagged part and populates the matching variant.
type MessagesService ¶
type MessagesService struct {
// contains filtered or unexported fields
}
MessagesService groups message endpoints.
func (*MessagesService) Delete ¶
func (s *MessagesService) Delete(ctx context.Context, messageID string) error
Delete deletes a message.
func (*MessagesService) List ¶
func (s *MessagesService) List(ctx context.Context, chatID string, p *ListMessagesParams) (*ListMessagesResult, error)
List returns messages in a chat.
func (*MessagesService) Send ¶
func (s *MessagesService) Send(ctx context.Context, chatID string, req *SendMessageRequest) (*Message, error)
Send sends a message to the given chat.
func (*MessagesService) Thread ¶
func (s *MessagesService) Thread(ctx context.Context, messageID string) (*ThreadResult, error)
Thread fetches the threaded reply chain for a message.
type Option ¶
type Option func(*Client)
Option configures the Client.
func WithBaseURL ¶
WithBaseURL overrides the API base URL (no trailing slash).
func WithHTTPClient ¶
WithHTTPClient overrides the underlying HTTP client.
func WithUserAgent ¶
WithUserAgent overrides the User-Agent header.
type PhoneNumber ¶
type PhoneNumber struct {
Number string `json:"number"`
Services []string `json:"services,omitempty"`
Label string `json:"label,omitempty"`
IsDefault bool `json:"is_default,omitempty"`
}
PhoneNumber is a sender phone number associated with the partner token.
type PhoneNumbersService ¶
type PhoneNumbersService struct {
// contains filtered or unexported fields
}
PhoneNumbersService groups phone-number endpoints.
func (*PhoneNumbersService) List ¶
func (s *PhoneNumbersService) List(ctx context.Context) (*ListPhoneNumbersResult, error)
List returns the phone numbers the partner token may send from.
type Reaction ¶
type Reaction struct {
IsMe bool `json:"is_me"`
Handle ChatHandle `json:"handle"`
Type ReactionType `json:"type"`
CustomEmoji *string `json:"custom_emoji,omitempty"`
Sticker *Sticker `json:"sticker,omitempty"`
}
Reaction is a reaction attached to a message part.
type ReactionRequest ¶
type ReactionRequest struct {
Type ReactionType `json:"type"`
PartIndex int `json:"part_index,omitempty"`
CustomEmoji *string `json:"custom_emoji,omitempty"`
Sticker *Sticker `json:"sticker,omitempty"`
Remove bool `json:"remove,omitempty"`
}
ReactionRequest adds or removes a reaction on a message part. Set Remove to true to remove; otherwise the reaction is added.
type ReactionType ¶
type ReactionType string
ReactionType enumerates built-in reaction kinds. Use ReactionCustom with CustomEmoji, or ReactionSticker with a Sticker payload.
const ( ReactionLove ReactionType = "love" ReactionLike ReactionType = "like" ReactionDislike ReactionType = "dislike" ReactionLaugh ReactionType = "laugh" ReactionEmphasize ReactionType = "emphasize" ReactionQuestion ReactionType = "question" ReactionCustom ReactionType = "custom" ReactionSticker ReactionType = "sticker" )
type ReactionsService ¶
type ReactionsService struct {
// contains filtered or unexported fields
}
ReactionsService groups reaction endpoints.
func (*ReactionsService) Set ¶
func (s *ReactionsService) Set(ctx context.Context, messageID string, req *ReactionRequest) error
Set adds or removes a reaction on a message.
type ReplyTo ¶
type ReplyTo struct {
MessageID string `json:"message_id"`
PartIndex int `json:"part_index,omitempty"`
}
ReplyTo targets a message (and optional part index) for threaded replies.
type SendMessageRequest ¶
type SendMessageRequest struct {
Parts []MessagePart `json:"parts"`
Effect *MessageEffect `json:"effect,omitempty"`
PreferredService *ServiceType `json:"preferred_service,omitempty"`
ReplyTo *ReplyTo `json:"reply_to,omitempty"`
}
SendMessageRequest is the body for sending a message into a chat.
type SendVoiceMemoRequest ¶
type SendVoiceMemoRequest struct {
AttachmentID string `json:"attachment_id"`
PreferredService *ServiceType `json:"preferred_service,omitempty"`
}
SendVoiceMemoRequest is the body for SendVoiceMemo.
type ServiceType ¶
type ServiceType string
ServiceType identifies the delivery protocol for a chat or message.
const ( ServiceIMessage ServiceType = "iMessage" ServiceSMS ServiceType = "SMS" ServiceRCS ServiceType = "RCS" )
type Sticker ¶
type Sticker struct {
URL string `json:"url"`
MimeType string `json:"mime_type"`
Width int `json:"width"`
Height int `json:"height"`
FileName string `json:"file_name"`
}
Sticker is a custom sticker used in a reaction.
type TextDecoration ¶
type TextDecoration struct {
Range [2]int `json:"range"`
Style *string `json:"style,omitempty"`
Animation *string `json:"animation,omitempty"`
}
TextDecoration applies a style or animation to a character range [Start,End). Set Style or Animation, not both.
type TextPart ¶
type TextPart struct {
Value string `json:"value"`
TextDecorations []TextDecoration `json:"text_decorations,omitempty"`
Reactions []Reaction `json:"reactions,omitempty"`
}
TextPart is a textual segment of a message.
type ThreadResult ¶
type ThreadResult struct {
Messages []Message `json:"messages"`
}
ThreadResult is the threaded-reply list for a given message.
type UpdateChatRequest ¶
type UpdateChatRequest struct {
DisplayName *string `json:"display_name,omitempty"`
GroupChatIcon *string `json:"group_chat_icon,omitempty"`
}
UpdateChatRequest updates mutable properties of a chat.
type UpdateWebhookSubscriptionRequest ¶
type UpdateWebhookSubscriptionRequest struct {
TargetURL *string `json:"target_url,omitempty"`
SubscribedEvents []string `json:"subscribed_events,omitempty"`
PhoneNumbers []string `json:"phone_numbers,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
}
UpdateWebhookSubscriptionRequest updates mutable fields of a subscription.
type WebhookSubscription ¶
type WebhookSubscription struct {
ID string `json:"id"`
TargetURL string `json:"target_url"`
SubscribedEvents []string `json:"subscribed_events"`
SigningSecret string `json:"signing_secret,omitempty"`
PhoneNumbers []string `json:"phone_numbers,omitempty"`
IsActive bool `json:"is_active"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
WebhookSubscription describes a webhook endpoint and its subscribed events.
SigningSecret is the HMAC key for VerifyWebhookRequest; it is returned on Create and Get but may be omitted from List responses. Store it securely.
type WebhooksService ¶
type WebhooksService struct {
// contains filtered or unexported fields
}
WebhooksService groups webhook-subscription endpoints and event parsing.
func (*WebhooksService) Create ¶
func (s *WebhooksService) Create(ctx context.Context, req *CreateWebhookSubscriptionRequest) (*WebhookSubscription, error)
Create registers a new webhook subscription.
func (*WebhooksService) Delete ¶
func (s *WebhooksService) Delete(ctx context.Context, id string) error
Delete removes a webhook subscription.
func (*WebhooksService) List ¶
func (s *WebhooksService) List(ctx context.Context) (*ListWebhookSubscriptionsResult, error)
List returns all webhook subscriptions.
func (*WebhooksService) Update ¶
func (s *WebhooksService) Update(ctx context.Context, id string, req *UpdateWebhookSubscriptionRequest) (*WebhookSubscription, error)
Update modifies a webhook subscription.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
send-message
command
Command send-message is a runnable example that creates a chat and sends one text message via the Linq Partner API.
|
Command send-message is a runnable example that creates a chat and sends one text message via the Linq Partner API. |
|
webhook-server
command
Command webhook-server is a runnable example of a Linq webhook receiver.
|
Command webhook-server is a runnable example of a Linq webhook receiver. |