Documentation
¶
Index ¶
- 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 APIMeta
- type APIResponseOfBrandCampaign
- type APIResponseOfCall
- type APIResponseOfCallRecordings
- type APIResponseOfCallsList
- type APIResponseOfContact
- type APIResponseOfContactMessageSummary
- type APIResponseOfConversationMessagesList
- type APIResponseOfListOfBrandCampaign
- type APIResponseOfListOfCallParticipant
- type APIResponseOfListOfVoiceNumber
- type APIResponseOfProfileDetail
- type APIResponseOfUser
- type APIResponseOfVoiceCallbackTest
- type APIResponseOfVoiceNumber
- type APIResponseOfVoiceNumberCreated
- type APIResponseOfVoiceSecret
- type APIResponseOfVoiceToken
- type APIResponseTemplate
- type APIResponseWebhook
- type AuthenticationConfigParam
- type BillingContactInfoParam
- type BrandBusinessInfoEntityType
- type BrandBusinessInfoParam
- type BrandCampaign
- type BrandCampaignStatus
- type BrandComplianceInfoParam
- type BrandContactInfoParam
- type BrandsBrandDataParam
- type Call
- type CallEvent
- type CallEventPayload
- type CallGetParams
- type CallHangupParams
- type CallListParams
- type CallListRecordingsParams
- type CallParticipant
- type CallParticipantAddParams
- type CallParticipantListParams
- type CallParticipantRemoveAllParams
- type CallParticipantRemoveParams
- type CallParticipantService
- func (r *CallParticipantService) Add(ctx context.Context, id string, params CallParticipantAddParams, ...) (res *APIResponseOfCall, err error)
- func (r *CallParticipantService) List(ctx context.Context, id string, query CallParticipantListParams, ...) (res *APIResponseOfListOfCallParticipant, err error)
- func (r *CallParticipantService) Remove(ctx context.Context, participantID string, params CallParticipantRemoveParams, ...) (err error)
- func (r *CallParticipantService) RemoveAll(ctx context.Context, id string, params CallParticipantRemoveAllParams, ...) (err error)
- func (r *CallParticipantService) Update(ctx context.Context, participantID string, params CallParticipantUpdateParams, ...) (err error)
- type CallParticipantTargetParam
- type CallParticipantUpdateParams
- type CallParty
- type CallRecordParams
- type CallRecording
- type CallRecordings
- type CallService
- func (r *CallService) Get(ctx context.Context, id string, query CallGetParams, ...) (res *APIResponseOfCall, err error)
- func (r *CallService) Hangup(ctx context.Context, id string, params CallHangupParams, ...) (err error)
- func (r *CallService) List(ctx context.Context, params CallListParams, opts ...option.RequestOption) (res *pagination.CallsPage[Call], err error)
- func (r *CallService) ListAutoPaging(ctx context.Context, params CallListParams, opts ...option.RequestOption) *pagination.CallsPageAutoPager[Call]
- func (r *CallService) ListRecordings(ctx context.Context, id string, query CallListRecordingsParams, ...) (res *APIResponseOfCallRecordings, err error)
- func (r *CallService) Record(ctx context.Context, id string, params CallRecordParams, ...) (err error)
- type CallTimelineEntry
- type CallsList
- type CampaignDataParam
- type CampaignUseCase
- type CampaignUseCaseDataParam
- type ChannelEvent
- type ChannelEventPayload
- type ChannelEventPayloadCompliance
- type ChannelEventPayloadComplianceDocument
- type ChannelService
- type ChannelVoiceGetParams
- type ChannelVoiceListParams
- type ChannelVoiceNewParams
- type ChannelVoiceNewTokenParams
- type ChannelVoiceRotateSecretParams
- type ChannelVoiceService
- func (r *ChannelVoiceService) Get(ctx context.Context, number string, query ChannelVoiceGetParams, ...) (res *APIResponseOfVoiceNumber, err error)
- func (r *ChannelVoiceService) List(ctx context.Context, query ChannelVoiceListParams, ...) (res *APIResponseOfListOfVoiceNumber, err error)
- func (r *ChannelVoiceService) New(ctx context.Context, params ChannelVoiceNewParams, ...) (res *APIResponseOfVoiceNumberCreated, err error)
- func (r *ChannelVoiceService) NewToken(ctx context.Context, params ChannelVoiceNewTokenParams, ...) (res *APIResponseOfVoiceToken, err error)
- func (r *ChannelVoiceService) RotateSecret(ctx context.Context, number string, params ChannelVoiceRotateSecretParams, ...) (res *APIResponseOfVoiceSecret, err error)
- func (r *ChannelVoiceService) Test(ctx context.Context, number string, params ChannelVoiceTestParams, ...) (res *APIResponseOfVoiceCallbackTest, err error)
- func (r *ChannelVoiceService) Update(ctx context.Context, number string, params ChannelVoiceUpdateParams, ...) (res *APIResponseOfVoiceNumber, err error)
- type ChannelVoiceTestParams
- type ChannelVoiceUpdateParams
- type ChannelVoiceUpdateParamsStatus
- 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 ContactDeleteParams
- type ContactEvent
- type ContactEventPayload
- type ContactGetMessageSummaryParams
- type ContactGetParams
- type ContactListParams
- type ContactMessageSummary
- type ContactMessageSummaryChannelScore
- type ContactNewParams
- type ContactResponse
- type ContactService
- func (r *ContactService) Delete(ctx context.Context, id string, params ContactDeleteParams, ...) (err error)deprecated
- func (r *ContactService) Get(ctx context.Context, id string, query ContactGetParams, ...) (res *APIResponseOfContact, err error)
- func (r *ContactService) GetMessageSummary(ctx context.Context, contactID string, query ContactGetMessageSummaryParams, ...) (res *APIResponseOfContactMessageSummary, err error)
- func (r *ContactService) List(ctx context.Context, params ContactListParams, opts ...option.RequestOption) (res *pagination.ContactsPage[ContactResponse], err error)
- func (r *ContactService) ListAutoPaging(ctx context.Context, params ContactListParams, opts ...option.RequestOption) *pagination.ContactsPageAutoPager[ContactResponse]
- func (r *ContactService) New(ctx context.Context, params ContactNewParams, opts ...option.RequestOption) (res *APIResponseOfContact, err error)
- func (r *ContactService) Update(ctx context.Context, id string, params ContactUpdateParams, ...) (res *APIResponseOfContact, err error)
- type ContactUpdateParams
- type ConversationListMessagesParams
- type ConversationListParams
- type ConversationMessagesList
- type ConversationMessagesListMessage
- type ConversationMessagesListMessageEvent
- type ConversationMessagesListMessageMessageBody
- type ConversationMessagesListMessageMessageBodyButton
- type ConversationMessagesListMessageMessageBodyHeaderMedia
- type ConversationMessagesListMessageMessageBodyMedia
- type ConversationService
- func (r *ConversationService) List(ctx context.Context, params ConversationListParams, ...) (res *pagination.ConversationsPage[ConversationMessagesListMessage], err error)
- func (r *ConversationService) ListAutoPaging(ctx context.Context, params ConversationListParams, ...) *pagination.ConversationsPageAutoPager[ConversationMessagesListMessage]
- func (r *ConversationService) ListMessages(ctx context.Context, id string, params ConversationListMessagesParams, ...) (res *pagination.ConversationsPage[ConversationMessagesListMessage], err error)
- func (r *ConversationService) ListMessagesAutoPaging(ctx context.Context, id string, params ConversationListMessagesParams, ...) *pagination.ConversationsPageAutoPager[ConversationMessagesListMessage]
- type DestinationCountry
- type DestinationCountryParam
- type Error
- type ErrorDetail
- type InboundMessageEvent
- type InboundMessageEventPayload
- type InboundMessageEventPayloadMedia
- type MeGetParams
- type MeGetResponse
- type MeGetResponseData
- type MeGetResponseDataChannels
- type MeGetResponseDataChannelsRcs
- type MeGetResponseDataChannelsSMS
- type MeGetResponseDataChannelsWhatsapp
- type MeGetResponseDataProfile
- type MeService
- type MessageEvent
- type MessageEventPayload
- type MessageGetActivitiesParams
- type MessageGetActivitiesResponse
- type MessageGetActivitiesResponseData
- type MessageGetActivitiesResponseDataActivity
- type MessageGetStatusParams
- type MessageGetStatusResponse
- type MessageGetStatusResponseData
- type MessageGetStatusResponseDataEvent
- type MessageGetStatusResponseDataMessageBody
- type MessageGetStatusResponseDataMessageBodyButton
- type MessageGetStatusResponseDataMessageBodyHeaderMedia
- type MessageGetStatusResponseDataMessageBodyMedia
- type MessageSendParams
- type MessageSendParamsTemplate
- type MessageSendResponse
- type MessageSendResponseData
- type MessageSendResponseDataRecipient
- type MessageService
- func (r *MessageService) GetActivities(ctx context.Context, id string, query MessageGetActivitiesParams, ...) (res *MessageGetActivitiesResponse, err error)
- func (r *MessageService) GetStatus(ctx context.Context, id string, query MessageGetStatusParams, ...) (res *MessageGetStatusResponse, err error)
- func (r *MessageService) Send(ctx context.Context, params MessageSendParams, opts ...option.RequestOption) (res *MessageSendResponse, err error)
- type MessagingUseCaseUs
- type MutationRequestParam
- type NumberLookupParams
- type NumberLookupResponse
- type NumberLookupResponseData
- type NumberService
- type PaginationMeta
- type PaginationMetaCursorsdeprecated
- type PaymentDetailsParam
- type ProfileCampaignDeleteParams
- type ProfileCampaignListParams
- type ProfileCampaignNewParams
- type ProfileCampaignService
- func (r *ProfileCampaignService) Delete(ctx context.Context, campaignID string, params ProfileCampaignDeleteParams, ...) (err error)deprecated
- func (r *ProfileCampaignService) List(ctx context.Context, profileID string, query ProfileCampaignListParams, ...) (res *APIResponseOfListOfBrandCampaign, err error)deprecated
- func (r *ProfileCampaignService) New(ctx context.Context, profileID string, params ProfileCampaignNewParams, ...) (res *APIResponseOfBrandCampaign, err error)deprecated
- func (r *ProfileCampaignService) Update(ctx context.Context, campaignID string, params ProfileCampaignUpdateParams, ...) (res *APIResponseOfBrandCampaign, err error)deprecated
- type ProfileCampaignUpdateParams
- type ProfileCompleteParams
- type ProfileCompleteResponse
- type ProfileCompleteResponseData
- type ProfileDeleteParams
- type ProfileDetail
- type ProfileDetailBillingContact
- type ProfileDetailBrand
- type ProfileDetailBrandBusiness
- type ProfileDetailBrandCompliance
- type ProfileDetailBrandContact
- type ProfileGetParams
- type ProfileListParams
- type ProfileListResponse
- type ProfileListResponseData
- type ProfileNewParams
- type ProfileNewParamsWhatsappBusinessAccount
- type ProfileService
- func (r *ProfileService) Complete(ctx context.Context, profileID string, params ProfileCompleteParams, ...) (res *ProfileCompleteResponse, err error)deprecated
- func (r *ProfileService) Delete(ctx context.Context, profileID string, params ProfileDeleteParams, ...) (err error)deprecated
- func (r *ProfileService) Get(ctx context.Context, profileID string, query ProfileGetParams, ...) (res *APIResponseOfProfileDetail, err error)deprecated
- func (r *ProfileService) List(ctx context.Context, query ProfileListParams, opts ...option.RequestOption) (res *ProfileListResponse, err error)deprecated
- func (r *ProfileService) New(ctx context.Context, params ProfileNewParams, opts ...option.RequestOption) (res *APIResponseOfProfileDetail, err error)deprecated
- func (r *ProfileService) Update(ctx context.Context, profileID string, params ProfileUpdateParams, ...) (res *APIResponseOfProfileDetail, err error)deprecated
- type ProfileSettings
- type ProfileUpdateParams
- type TcrBrandRelationship
- type TcrVertical
- type Template
- type TemplateBodyContentParam
- type TemplateBodyMmsMediaParam
- type TemplateBodyMmsParam
- type TemplateBodyParam
- type TemplateButtonParam
- type TemplateButtonPropsParam
- type TemplateDefinitionParam
- type TemplateDeleteParams
- type TemplateEvent
- type TemplateEventPayload
- type TemplateFooterParam
- type TemplateGetParams
- type TemplateHeaderLocationParam
- type TemplateHeaderParam
- type TemplateListParams
- type TemplateNewParams
- type TemplateService
- func (r *TemplateService) Delete(ctx context.Context, id string, params TemplateDeleteParams, ...) (err error)
- func (r *TemplateService) Get(ctx context.Context, id string, query TemplateGetParams, ...) (res *APIResponseTemplate, err error)
- func (r *TemplateService) List(ctx context.Context, params TemplateListParams, opts ...option.RequestOption) (res *pagination.TemplatesPage[Template], err error)
- func (r *TemplateService) ListAutoPaging(ctx context.Context, params TemplateListParams, opts ...option.RequestOption) *pagination.TemplatesPageAutoPager[Template]
- func (r *TemplateService) New(ctx context.Context, params TemplateNewParams, opts ...option.RequestOption) (res *APIResponseTemplate, err error)
- func (r *TemplateService) Update(ctx context.Context, id string, params TemplateUpdateParams, ...) (res *APIResponseTemplate, err error)
- type TemplateUpdateParams
- type TemplateVariableParam
- type TemplateVariablePropsParam
- type UserGetParams
- type UserInviteParams
- type UserListParams
- type UserListResponse
- type UserListResponseData
- type UserRemoveParams
- type UserResponse
- type UserService
- func (r *UserService) Get(ctx context.Context, userID string, query UserGetParams, ...) (res *APIResponseOfUser, err error)
- func (r *UserService) Invite(ctx context.Context, params UserInviteParams, opts ...option.RequestOption) (res *APIResponseOfUser, err error)
- func (r *UserService) List(ctx context.Context, query UserListParams, opts ...option.RequestOption) (res *UserListResponse, err error)
- func (r *UserService) Remove(ctx context.Context, userID string, params UserRemoveParams, ...) (err error)
- func (r *UserService) UpdateRole(ctx context.Context, userID string, params UserUpdateRoleParams, ...) (res *APIResponseOfUser, err error)
- type UserUpdateRoleParams
- type VoiceCallbackTest
- type VoiceCallbackTestErrorInfo
- type VoiceCallbackTestRequestInfo
- type VoiceCallbackTestResponseInfo
- type VoiceNumber
- type VoiceNumberCreated
- type VoiceSecret
- type VoiceToken
- type WebhookDeleteParams
- type WebhookEventType
- type WebhookGetParams
- type WebhookListEventTypesParams
- type WebhookListEventTypesResponse
- type WebhookListEventTypesResponseData
- type WebhookListEventsParams
- type WebhookListEventsResponse
- type WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload
- type WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload
- func (r WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload) RawJSON() string
- func (r *WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload) UnmarshalJSON(data []byte) error
- type WebhookListEventsResponseEventDataUnion
- func (u WebhookListEventsResponseEventDataUnion) AsCallEvent() (v CallEvent)
- func (u WebhookListEventsResponseEventDataUnion) AsChannelEvent() (v ChannelEvent)
- func (u WebhookListEventsResponseEventDataUnion) AsContactEvent() (v ContactEvent)
- func (u WebhookListEventsResponseEventDataUnion) AsInboundMessageEvent() (v InboundMessageEvent)
- func (u WebhookListEventsResponseEventDataUnion) AsMessageEvent() (v MessageEvent)
- func (u WebhookListEventsResponseEventDataUnion) AsTemplateEvent() (v TemplateEvent)
- func (u WebhookListEventsResponseEventDataUnion) AsWebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload() (...)
- func (u WebhookListEventsResponseEventDataUnion) RawJSON() string
- func (r *WebhookListEventsResponseEventDataUnion) UnmarshalJSON(data []byte) error
- type WebhookListEventsResponseEventDataUnionPayload
- type WebhookListParams
- type WebhookNewParams
- type WebhookNewParamsSenderProfile
- type WebhookResponse
- type WebhookRotateSecretParams
- type WebhookRotateSecretResponse
- type WebhookRotateSecretResponseData
- type WebhookService
- func (r *WebhookService) Delete(ctx context.Context, id string, body WebhookDeleteParams, ...) (err error)
- func (r *WebhookService) Get(ctx context.Context, id string, query WebhookGetParams, ...) (res *APIResponseWebhook, err error)
- func (r *WebhookService) List(ctx context.Context, params WebhookListParams, opts ...option.RequestOption) (res *pagination.WebhooksPage[WebhookResponse], err error)
- func (r *WebhookService) ListAutoPaging(ctx context.Context, params WebhookListParams, opts ...option.RequestOption) *pagination.WebhooksPageAutoPager[WebhookResponse]
- func (r *WebhookService) ListEventTypes(ctx context.Context, query WebhookListEventTypesParams, ...) (res *WebhookListEventTypesResponse, err error)
- func (r *WebhookService) ListEvents(ctx context.Context, id string, params WebhookListEventsParams, ...) (res *pagination.WebhookEventsPage[WebhookListEventsResponse], err error)
- func (r *WebhookService) ListEventsAutoPaging(ctx context.Context, id string, params WebhookListEventsParams, ...) *pagination.WebhookEventsPageAutoPager[WebhookListEventsResponse]
- func (r *WebhookService) New(ctx context.Context, params WebhookNewParams, opts ...option.RequestOption) (res *APIResponseWebhook, err error)
- func (r *WebhookService) RotateSecret(ctx context.Context, id string, params WebhookRotateSecretParams, ...) (res *WebhookRotateSecretResponse, err error)
- func (r *WebhookService) Test(ctx context.Context, id string, params WebhookTestParams, ...) (res *WebhookTestResponse, err error)
- func (r *WebhookService) ToggleStatus(ctx context.Context, id string, params WebhookToggleStatusParams, ...) (res *APIResponseWebhook, err error)
- func (r *WebhookService) Update(ctx context.Context, id string, params WebhookUpdateParams, ...) (res *APIResponseWebhook, err error)
- type WebhookTestParams
- type WebhookTestResponse
- type WebhookTestResponseData
- type WebhookToggleStatusParams
- type WebhookUpdateParams
- type WebhookUpdateParamsSenderProfile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (SENT_DM_API_KEY, SENT_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type APIMeta ¶ added in v0.7.0
type APIMeta struct {
// Unique identifier for this request (for tracing and support)
RequestID string `json:"request_id"`
// Server timestamp when the response was generated
Timestamp time.Time `json:"timestamp" format:"date-time"`
// API version used for this request
Version string `json:"version"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
RequestID respjson.Field
Timestamp respjson.Field
Version respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Request and response metadata
func (*APIMeta) UnmarshalJSON ¶ added in v0.7.0
type APIResponseOfBrandCampaign ¶ added in v0.30.0
type APIResponseOfBrandCampaign struct {
// A 10DLC campaign registered for a brand.
Data BrandCampaign `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfBrandCampaign) RawJSON ¶ added in v0.30.0
func (r APIResponseOfBrandCampaign) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfBrandCampaign) UnmarshalJSON ¶ added in v0.30.0
func (r *APIResponseOfBrandCampaign) UnmarshalJSON(data []byte) error
type APIResponseOfCall ¶ added in v0.39.0
type APIResponseOfCall struct {
// A call record
Data Call `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfCall) RawJSON ¶ added in v0.39.0
func (r APIResponseOfCall) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfCall) UnmarshalJSON ¶ added in v0.39.0
func (r *APIResponseOfCall) UnmarshalJSON(data []byte) error
type APIResponseOfCallRecordings ¶ added in v0.39.0
type APIResponseOfCallRecordings struct {
// The recordings of a call, each as a short-lived download link
Data CallRecordings `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfCallRecordings) RawJSON ¶ added in v0.39.0
func (r APIResponseOfCallRecordings) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfCallRecordings) UnmarshalJSON ¶ added in v0.39.0
func (r *APIResponseOfCallRecordings) UnmarshalJSON(data []byte) error
type APIResponseOfCallsList ¶ added in v0.39.0
type APIResponseOfCallsList struct {
// Paginated list of calls
Data CallsList `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfCallsList) RawJSON ¶ added in v0.39.0
func (r APIResponseOfCallsList) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfCallsList) UnmarshalJSON ¶ added in v0.39.0
func (r *APIResponseOfCallsList) UnmarshalJSON(data []byte) error
type APIResponseOfContact ¶ added in v0.9.0
type APIResponseOfContact struct {
// Contact response for v3 API Uses snake_case for JSON property names
Data ContactResponse `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfContact) RawJSON ¶ added in v0.9.0
func (r APIResponseOfContact) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfContact) UnmarshalJSON ¶ added in v0.9.0
func (r *APIResponseOfContact) UnmarshalJSON(data []byte) error
type APIResponseOfContactMessageSummary ¶ added in v0.30.0
type APIResponseOfContactMessageSummary struct {
// The response data (null if error)
Data ContactMessageSummary `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfContactMessageSummary) RawJSON ¶ added in v0.30.0
func (r APIResponseOfContactMessageSummary) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfContactMessageSummary) UnmarshalJSON ¶ added in v0.30.0
func (r *APIResponseOfContactMessageSummary) UnmarshalJSON(data []byte) error
type APIResponseOfConversationMessagesList ¶ added in v0.30.0
type APIResponseOfConversationMessagesList struct {
// A paginated list of messages — used by both conversation read endpoints.
Data ConversationMessagesList `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfConversationMessagesList) RawJSON ¶ added in v0.30.0
func (r APIResponseOfConversationMessagesList) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfConversationMessagesList) UnmarshalJSON ¶ added in v0.30.0
func (r *APIResponseOfConversationMessagesList) UnmarshalJSON(data []byte) error
type APIResponseOfListOfBrandCampaign ¶ added in v0.30.0
type APIResponseOfListOfBrandCampaign struct {
// The response data (null if error)
Data []BrandCampaign `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfListOfBrandCampaign) RawJSON ¶ added in v0.30.0
func (r APIResponseOfListOfBrandCampaign) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfListOfBrandCampaign) UnmarshalJSON ¶ added in v0.30.0
func (r *APIResponseOfListOfBrandCampaign) UnmarshalJSON(data []byte) error
type APIResponseOfListOfCallParticipant ¶ added in v0.39.0
type APIResponseOfListOfCallParticipant struct {
// The response data (null if error)
Data []CallParticipant `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfListOfCallParticipant) RawJSON ¶ added in v0.39.0
func (r APIResponseOfListOfCallParticipant) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfListOfCallParticipant) UnmarshalJSON ¶ added in v0.39.0
func (r *APIResponseOfListOfCallParticipant) UnmarshalJSON(data []byte) error
type APIResponseOfListOfVoiceNumber ¶ added in v0.39.0
type APIResponseOfListOfVoiceNumber struct {
// The response data (null if error)
Data []VoiceNumber `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfListOfVoiceNumber) RawJSON ¶ added in v0.39.0
func (r APIResponseOfListOfVoiceNumber) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfListOfVoiceNumber) UnmarshalJSON ¶ added in v0.39.0
func (r *APIResponseOfListOfVoiceNumber) UnmarshalJSON(data []byte) error
type APIResponseOfProfileDetail ¶ added in v0.7.0
type APIResponseOfProfileDetail struct {
// Detailed profile response for v3 API
Data ProfileDetail `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfProfileDetail) RawJSON ¶ added in v0.7.0
func (r APIResponseOfProfileDetail) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfProfileDetail) UnmarshalJSON ¶ added in v0.7.0
func (r *APIResponseOfProfileDetail) UnmarshalJSON(data []byte) error
type APIResponseOfUser ¶ added in v0.7.0
type APIResponseOfUser struct {
// User response for v3 API
Data UserResponse `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfUser) RawJSON ¶ added in v0.7.0
func (r APIResponseOfUser) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfUser) UnmarshalJSON ¶ added in v0.7.0
func (r *APIResponseOfUser) UnmarshalJSON(data []byte) error
type APIResponseOfVoiceCallbackTest ¶ added in v0.39.0
type APIResponseOfVoiceCallbackTest struct {
// The verdict of a test question sent to your callback URL
Data VoiceCallbackTest `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfVoiceCallbackTest) RawJSON ¶ added in v0.39.0
func (r APIResponseOfVoiceCallbackTest) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfVoiceCallbackTest) UnmarshalJSON ¶ added in v0.39.0
func (r *APIResponseOfVoiceCallbackTest) UnmarshalJSON(data []byte) error
type APIResponseOfVoiceNumber ¶ added in v0.39.0
type APIResponseOfVoiceNumber struct {
// One number the profile carries phone calls on.
Data VoiceNumber `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfVoiceNumber) RawJSON ¶ added in v0.39.0
func (r APIResponseOfVoiceNumber) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfVoiceNumber) UnmarshalJSON ¶ added in v0.39.0
func (r *APIResponseOfVoiceNumber) UnmarshalJSON(data []byte) error
type APIResponseOfVoiceNumberCreated ¶ added in v0.39.0
type APIResponseOfVoiceNumberCreated struct {
// The response data (null if error)
Data VoiceNumberCreated `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfVoiceNumberCreated) RawJSON ¶ added in v0.39.0
func (r APIResponseOfVoiceNumberCreated) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfVoiceNumberCreated) UnmarshalJSON ¶ added in v0.39.0
func (r *APIResponseOfVoiceNumberCreated) UnmarshalJSON(data []byte) error
type APIResponseOfVoiceSecret ¶ added in v0.39.0
type APIResponseOfVoiceSecret struct {
// A freshly rotated callback signing secret
Data VoiceSecret `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfVoiceSecret) RawJSON ¶ added in v0.39.0
func (r APIResponseOfVoiceSecret) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfVoiceSecret) UnmarshalJSON ¶ added in v0.39.0
func (r *APIResponseOfVoiceSecret) UnmarshalJSON(data []byte) error
type APIResponseOfVoiceToken ¶ added in v0.39.0
type APIResponseOfVoiceToken struct {
// A short-lived token your app passes to the voice client SDK to register
Data VoiceToken `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseOfVoiceToken) RawJSON ¶ added in v0.39.0
func (r APIResponseOfVoiceToken) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseOfVoiceToken) UnmarshalJSON ¶ added in v0.39.0
func (r *APIResponseOfVoiceToken) UnmarshalJSON(data []byte) error
type APIResponseTemplate ¶ added in v0.7.0
type APIResponseTemplate struct {
// Template response for v3 API
Data Template `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseTemplate) RawJSON ¶ added in v0.7.0
func (r APIResponseTemplate) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseTemplate) UnmarshalJSON ¶ added in v0.7.0
func (r *APIResponseTemplate) UnmarshalJSON(data []byte) error
type APIResponseWebhook ¶ added in v0.7.0
type APIResponseWebhook struct {
// The response data (null if error)
Data WebhookResponse `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (APIResponseWebhook) RawJSON ¶ added in v0.7.0
func (r APIResponseWebhook) RawJSON() string
Returns the unmodified JSON received from the API
func (*APIResponseWebhook) UnmarshalJSON ¶ added in v0.7.0
func (r *APIResponseWebhook) UnmarshalJSON(data []byte) error
type AuthenticationConfigParam ¶ added in v0.30.0
type AuthenticationConfigParam struct {
// Code expiration time in minutes (1-90). If set, adds footer: "This code expires
// in X minutes."
CodeExpirationMinutes param.Opt[int64] `json:"codeExpirationMinutes,omitzero"`
// Whether to add the security recommendation text: "For your security, do not
// share this code."
AddSecurityRecommendation param.Opt[bool] `json:"addSecurityRecommendation,omitzero"`
// contains filtered or unexported fields
}
Configuration for AUTHENTICATION category templates
func (AuthenticationConfigParam) MarshalJSON ¶ added in v0.30.0
func (r AuthenticationConfigParam) MarshalJSON() (data []byte, err error)
func (*AuthenticationConfigParam) UnmarshalJSON ¶ added in v0.30.0
func (r *AuthenticationConfigParam) UnmarshalJSON(data []byte) error
type BillingContactInfoParam ¶ added in v0.9.0
type BillingContactInfoParam struct {
// Email address where invoices will be sent (required)
Email string `json:"email" api:"required" format:"email"`
// Full name of the billing contact or company (required)
Name string `json:"name" api:"required"`
// Billing address (optional). Free-form text including street, city, state, postal
// code, and country.
Address param.Opt[string] `json:"address,omitzero"`
// Phone number for the billing contact (optional)
Phone param.Opt[string] `json:"phone,omitzero"`
// contains filtered or unexported fields
}
Billing contact information for a profile. Required when billing_model is "profile" or "profile_and_organization".
The properties Email, Name are required.
func (BillingContactInfoParam) MarshalJSON ¶ added in v0.9.0
func (r BillingContactInfoParam) MarshalJSON() (data []byte, err error)
func (*BillingContactInfoParam) UnmarshalJSON ¶ added in v0.9.0
func (r *BillingContactInfoParam) UnmarshalJSON(data []byte) error
type BrandBusinessInfoEntityType ¶ added in v0.30.0
type BrandBusinessInfoEntityType string
const ( BrandBusinessInfoEntityTypePrivateProfit BrandBusinessInfoEntityType = "PRIVATE_PROFIT" BrandBusinessInfoEntityTypePublicProfit BrandBusinessInfoEntityType = "PUBLIC_PROFIT" BrandBusinessInfoEntityTypeNonProfit BrandBusinessInfoEntityType = "NON_PROFIT" BrandBusinessInfoEntityTypeSoleProprietor BrandBusinessInfoEntityType = "SOLE_PROPRIETOR" BrandBusinessInfoEntityTypeGovernment BrandBusinessInfoEntityType = "GOVERNMENT" )
type BrandBusinessInfoParam ¶ added in v0.30.0
type BrandBusinessInfoParam struct {
// City
City param.Opt[string] `json:"city,omitzero"`
// Country code (e.g., US, CA)
Country param.Opt[string] `json:"country,omitzero"`
// Country where the business is registered
CountryOfRegistration param.Opt[string] `json:"countryOfRegistration,omitzero"`
// Legal business name
LegalName param.Opt[string] `json:"legalName,omitzero"`
// Postal/ZIP code
PostalCode param.Opt[string] `json:"postalCode,omitzero"`
// State/province code
State param.Opt[string] `json:"state,omitzero"`
// Street address
Street param.Opt[string] `json:"street,omitzero"`
// Tax ID/EIN number
TaxID param.Opt[string] `json:"taxId,omitzero"`
// Type of tax ID (e.g., us_ein, ca_bn)
TaxIDType param.Opt[string] `json:"taxIdType,omitzero"`
// Business website URL
URL param.Opt[string] `json:"url,omitzero" format:"uri"`
// Any of "PRIVATE_PROFIT", "PUBLIC_PROFIT", "NON_PROFIT", "SOLE_PROPRIETOR",
// "GOVERNMENT".
EntityType BrandBusinessInfoEntityType `json:"entityType,omitzero"`
// contains filtered or unexported fields
}
Business details and address for brand KYC
func (BrandBusinessInfoParam) MarshalJSON ¶ added in v0.30.0
func (r BrandBusinessInfoParam) MarshalJSON() (data []byte, err error)
func (*BrandBusinessInfoParam) UnmarshalJSON ¶ added in v0.30.0
func (r *BrandBusinessInfoParam) UnmarshalJSON(data []byte) error
type BrandCampaign ¶ added in v0.30.0
type BrandCampaign struct {
ID string `json:"id" format:"uuid"`
BilledDate time.Time `json:"billedDate" api:"nullable" format:"date-time"`
BrandID string `json:"brandId" api:"nullable" format:"uuid"`
Cost float64 `json:"cost" api:"nullable" format:"decimal"`
CreatedAt time.Time `json:"createdAt" format:"date-time"`
CustomerID string `json:"customerId" format:"uuid"`
// True once every carrier has completed its DCA election and the campaign is
// operationally ready for traffic.
DcaElectionsComplete bool `json:"dcaElectionsComplete" api:"nullable"`
DcaElectionsCompletedAt time.Time `json:"dcaElectionsCompletedAt" api:"nullable" format:"date-time"`
Description string `json:"description"`
// True when the one-time campaign submission fee has already been charged.
HasSubmissionTransaction bool `json:"hasSubmissionTransaction"`
HelpKeywords string `json:"helpKeywords" api:"nullable"`
HelpMessage string `json:"helpMessage" api:"nullable"`
MessageFlow string `json:"messageFlow" api:"nullable"`
Name string `json:"name"`
OptinKeywords string `json:"optinKeywords" api:"nullable"`
OptinMessage string `json:"optinMessage" api:"nullable"`
OptoutKeywords string `json:"optoutKeywords" api:"nullable"`
OptoutMessage string `json:"optoutMessage" api:"nullable"`
PrivacyPolicyLink string `json:"privacyPolicyLink" api:"nullable"`
// Any of "SENT_CREATED", "ACTIVE", "EXPIRED".
Status BrandCampaignStatus `json:"status" api:"nullable"`
SubmittedAt time.Time `json:"submittedAt" api:"nullable" format:"date-time"`
SubmittedToTcr bool `json:"submittedToTCR"`
// The Campaign Registry identifier, once the campaign has been accepted.
TcrCampaignID string `json:"tcrCampaignId" api:"nullable"`
// Surfaced so customers can see why a submission did not reach the registry.
TcrSyncError string `json:"tcrSyncError" api:"nullable"`
TermsAndConditionsLink string `json:"termsAndConditionsLink" api:"nullable"`
// Campaign type (for example KYC or App).
Type string `json:"type"`
UpdatedAt time.Time `json:"updatedAt" api:"nullable" format:"date-time"`
UseCases []CampaignUseCase `json:"useCases"`
// Expected messaging volume for this campaign — customer-supplied on
// create/update, and the input to both the TCR usecase classification (LOW_VOLUME
// vs MIXED/specific) and the campaign fee tier. Surfaced so customers can read
// back the value they set.
Volume string `json:"volume" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
BilledDate respjson.Field
BrandID respjson.Field
Cost respjson.Field
CreatedAt respjson.Field
CustomerID respjson.Field
DcaElectionsComplete respjson.Field
DcaElectionsCompletedAt respjson.Field
Description respjson.Field
HasSubmissionTransaction respjson.Field
HelpKeywords respjson.Field
HelpMessage respjson.Field
MessageFlow respjson.Field
Name respjson.Field
OptinKeywords respjson.Field
OptinMessage respjson.Field
OptoutKeywords respjson.Field
OptoutMessage respjson.Field
PrivacyPolicyLink respjson.Field
Status respjson.Field
SubmittedAt respjson.Field
SubmittedToTcr respjson.Field
TcrCampaignID respjson.Field
TcrSyncError respjson.Field
TermsAndConditionsLink respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
UseCases respjson.Field
Volume respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A 10DLC campaign registered for a brand.
func (BrandCampaign) RawJSON ¶ added in v0.30.0
func (r BrandCampaign) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandCampaign) UnmarshalJSON ¶ added in v0.30.0
func (r *BrandCampaign) UnmarshalJSON(data []byte) error
type BrandCampaignStatus ¶ added in v0.30.0
type BrandCampaignStatus string
const ( BrandCampaignStatusSentCreated BrandCampaignStatus = "SENT_CREATED" BrandCampaignStatusActive BrandCampaignStatus = "ACTIVE" BrandCampaignStatusExpired BrandCampaignStatus = "EXPIRED" )
type BrandComplianceInfoParam ¶ added in v0.30.0
type BrandComplianceInfoParam struct {
// Any of "BASIC_ACCOUNT", "MEDIUM_ACCOUNT", "LARGE_ACCOUNT", "SMALL_ACCOUNT",
// "KEY_ACCOUNT".
BrandRelationship TcrBrandRelationship `json:"brandRelationship,omitzero" api:"required"`
// Any of "PROFESSIONAL", "REAL_ESTATE", "HEALTHCARE", "HUMAN_RESOURCES", "ENERGY",
// "ENTERTAINMENT", "RETAIL", "TRANSPORTATION", "AGRICULTURE", "INSURANCE",
// "POSTAL", "EDUCATION", "HOSPITALITY", "FINANCIAL", "POLITICAL", "GAMBLING",
// "LEGAL", "CONSTRUCTION", "NGO", "MANUFACTURING", "GOVERNMENT", "TECHNOLOGY",
// "COMMUNICATION".
Vertical TcrVertical `json:"vertical,omitzero" api:"required"`
// Whether this is a TCR (Campaign Registry) application
IsTcrApplication param.Opt[bool] `json:"isTcrApplication,omitzero"`
// Additional notes about the business or use case
Notes param.Opt[string] `json:"notes,omitzero"`
// Phone number prefix for messaging (e.g., "+1")
PhoneNumberPrefix param.Opt[string] `json:"phoneNumberPrefix,omitzero"`
// List of destination countries for messaging
DestinationCountries []DestinationCountryParam `json:"destinationCountries,omitzero"`
// contains filtered or unexported fields
}
Compliance and TCR information for brand registration
The properties BrandRelationship, Vertical are required.
func (BrandComplianceInfoParam) MarshalJSON ¶ added in v0.30.0
func (r BrandComplianceInfoParam) MarshalJSON() (data []byte, err error)
func (*BrandComplianceInfoParam) UnmarshalJSON ¶ added in v0.30.0
func (r *BrandComplianceInfoParam) UnmarshalJSON(data []byte) error
type BrandContactInfoParam ¶ added in v0.30.0
type BrandContactInfoParam struct {
// Primary contact name (required)
Name string `json:"name" api:"required"`
// Business/brand name
BusinessName param.Opt[string] `json:"businessName,omitzero"`
// Contact email address
Email param.Opt[string] `json:"email,omitzero" format:"email"`
// Contact phone number in E.164 format
Phone param.Opt[string] `json:"phone,omitzero"`
// Contact phone country code (e.g., "1" for US)
PhoneCountryCode param.Opt[string] `json:"phoneCountryCode,omitzero"`
// Contact's role in the business
Role param.Opt[string] `json:"role,omitzero"`
// contains filtered or unexported fields
}
Contact information for brand KYC
The property Name is required.
func (BrandContactInfoParam) MarshalJSON ¶ added in v0.30.0
func (r BrandContactInfoParam) MarshalJSON() (data []byte, err error)
func (*BrandContactInfoParam) UnmarshalJSON ¶ added in v0.30.0
func (r *BrandContactInfoParam) UnmarshalJSON(data []byte) error
type BrandsBrandDataParam ¶ added in v0.9.0
type BrandsBrandDataParam struct {
// Compliance and TCR information for brand registration
Compliance BrandComplianceInfoParam `json:"compliance,omitzero" api:"required"`
// Contact information for brand KYC
Contact BrandContactInfoParam `json:"contact,omitzero" api:"required"`
// Business details and address for brand KYC
Business BrandBusinessInfoParam `json:"business,omitzero"`
// contains filtered or unexported fields
}
Brand and KYC data grouped into contact, business, and compliance sections
The properties Compliance, Contact are required.
func (BrandsBrandDataParam) MarshalJSON ¶ added in v0.9.0
func (r BrandsBrandDataParam) MarshalJSON() (data []byte, err error)
func (*BrandsBrandDataParam) UnmarshalJSON ¶ added in v0.9.0
func (r *BrandsBrandDataParam) UnmarshalJSON(data []byte) error
type Call ¶ added in v0.39.0
type Call struct {
// The call id, the same one carried by the call.request question and every call
// webhook
ID string `json:"id"`
// When the call was answered (UTC). Null until then, and always null for a call
// between two of your app users
AnsweredAt time.Time `json:"answered_at" api:"nullable" format:"date-time"`
// outbound for a call placed from your app, inbound for a call to one of your
// numbers
Direction string `json:"direction"`
// Billable duration in seconds. Null while the call is live
DurationSeconds int64 `json:"duration_seconds" api:"nullable"`
// When the call ended (UTC). Null while the call is live
EndedAt time.Time `json:"ended_at" api:"nullable" format:"date-time"`
// Why the call did not complete: callback_timeout, invalid_answer,
// insufficient_balance, destination_blocked, rejected or no_answer. Null while the
// call is live, when it completed, and when it failed without a recorded reason
FailureReason string `json:"failure_reason" api:"nullable"`
// One end of a call
From CallParty `json:"from"`
// Your number that owns the call, in E.164 format: the dialed number for an
// inbound call, the caller's bound number for a call placed from your app
Number string `json:"number"`
// What the call cost. Null until it has been priced
Price float64 `json:"price" api:"nullable" format:"decimal"`
// True once a recording of the call is available
RecordingAvailable bool `json:"recording_available"`
// When the call was placed (UTC)
StartedAt time.Time `json:"started_at" format:"date-time"`
// initiated, ringing, answered, completed, failed, no_answer or rejected
Status string `json:"status"`
// When the call entered each status, oldest first. Only returned when reading one
// call
Timeline []CallTimelineEntry `json:"timeline" api:"nullable"`
// One end of a call
To CallParty `json:"to"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
AnsweredAt respjson.Field
Direction respjson.Field
DurationSeconds respjson.Field
EndedAt respjson.Field
FailureReason respjson.Field
From respjson.Field
Number respjson.Field
Price respjson.Field
RecordingAvailable respjson.Field
StartedAt respjson.Field
Status respjson.Field
Timeline respjson.Field
To respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A call record
func (*Call) UnmarshalJSON ¶ added in v0.39.0
type CallEvent ¶ added in v0.39.0
type CallEvent struct {
// The specific event within the family, for example message.delivered,
// message.received or contact.opt_out. Absent on events that have no subtype, so
// treat it as optional.
Event string `json:"event" api:"nullable"`
// The event family, for example message, templates or contact. Route on this
// first, then on event for the specific change.
Field string `json:"field"`
// Body of a call.initiated, call.answered, call.completed, call.failed or
// call.recording_ready event. Which of them occurred is the envelope's event.
//
// Shaped like the message, inbound, template and channel payloads: account_id
// names the account the event is about, channel names the channel, and updated_at
// is when the change happened on the call, in the same yyyy-MM-ddTHH:mm:ssZ form.
// duration_seconds and price are added on call.completed, reason on call.failed
// and recording_id on call.recording_ready; each is omitted rather than sent as
// null when it does not apply.
//
// Casing is snake_case because these ride the same webhook stream customers
// already parse message_id from; the question/answer contract is a separate
// surface and stays camelCase. Nothing here is provider-shaped: no provider call
// id, no namespaced identity.
Payload CallEventPayload `json:"payload" api:"nullable"`
// The event-specific body.
RequestID string `json:"request_id" api:"nullable"`
// When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
// time, not the time the underlying change happened. Use the timestamp inside the
// payload for the latter.
Timestamp string `json:"timestamp"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Event respjson.Field
Field respjson.Field
Payload respjson.Field
RequestID respjson.Field
Timestamp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares this shape and varies only in Payload.
func (*CallEvent) UnmarshalJSON ¶ added in v0.39.0
type CallEventPayload ¶ added in v0.39.0
type CallEventPayload struct {
// Sent's call id, the same one the customer saw on the first question.
CallID string `json:"call_id" api:"required"`
// The account the call belongs to: the key's own customer, or the sender profile
// it acted as.
AccountID string `json:"account_id" format:"uuid"`
// Always voice.
Channel string `json:"channel"`
// How long the call lasted. Only on call.completed.
DurationSeconds int64 `json:"duration_seconds" api:"nullable"`
// The customer number that owns the call, in E.164 format.
Number string `json:"number"`
// What the call was charged. Only on call.completed, and omitted there until
// billing has recorded the charge.
Price float64 `json:"price" api:"nullable" format:"decimal"`
// The machine-readable reason the call did not complete. Only on call.failed, and
// omitted when no reason was recorded.
Reason string `json:"reason" api:"nullable"`
// The recording that became available, the same id GET /v3/calls/{id}/recordings
// lists it under. Only on call.recording_ready, which is sent once per recording.
RecordingID string `json:"recording_id" api:"nullable" format:"uuid"`
// When the change happened on the call, as opposed to when the event was emitted.
UpdatedAt string `json:"updated_at"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CallID respjson.Field
AccountID respjson.Field
Channel respjson.Field
DurationSeconds respjson.Field
Number respjson.Field
Price respjson.Field
Reason respjson.Field
RecordingID respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Body of a call.initiated, call.answered, call.completed, call.failed or call.recording_ready event. Which of them occurred is the envelope's event.
Shaped like the message, inbound, template and channel payloads: account_id names the account the event is about, channel names the channel, and updated_at is when the change happened on the call, in the same yyyy-MM-ddTHH:mm:ssZ form. duration_seconds and price are added on call.completed, reason on call.failed and recording_id on call.recording_ready; each is omitted rather than sent as null when it does not apply.
Casing is snake_case because these ride the same webhook stream customers already parse message_id from; the question/answer contract is a separate surface and stays camelCase. Nothing here is provider-shaped: no provider call id, no namespaced identity.
func (CallEventPayload) RawJSON ¶ added in v0.39.0
func (r CallEventPayload) RawJSON() string
Returns the unmodified JSON received from the API
func (*CallEventPayload) UnmarshalJSON ¶ added in v0.39.0
func (r *CallEventPayload) UnmarshalJSON(data []byte) error
type CallGetParams ¶ added in v0.39.0
type CallHangupParams ¶ added in v0.39.0
type CallHangupParams struct {
MutationRequest MutationRequestParam
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (CallHangupParams) MarshalJSON ¶ added in v0.39.0
func (r CallHangupParams) MarshalJSON() (data []byte, err error)
func (*CallHangupParams) UnmarshalJSON ¶ added in v0.39.0
func (r *CallHangupParams) UnmarshalJSON(data []byte) error
type CallListParams ¶ added in v0.39.0
type CallListParams struct {
// Optional direction filter: outbound for calls placed from your app, inbound for
// calls to one of your numbers
Direction param.Opt[string] `query:"direction,omitzero" json:"-"`
// Only calls started at or after this time (ISO 8601)
From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
// Optional filter on the number that owns the call, one of your voice-enabled
// numbers in E.164 format
Number param.Opt[string] `query:"number,omitzero" json:"-"`
// Optional status filter: initiated, ringing, answered, completed, failed,
// no_answer or rejected
Status param.Opt[string] `query:"status,omitzero" json:"-"`
// Only calls started at or before this time (ISO 8601)
To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
// Page number (1-indexed)
Page param.Opt[int64] `query:"page,omitzero" json:"-"`
// Number of items per page
PageSize param.Opt[int64] `query:"page_size,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (CallListParams) URLQuery ¶ added in v0.39.0
func (r CallListParams) URLQuery() (v url.Values, err error)
URLQuery serializes CallListParams's query parameters as `url.Values`.
type CallListRecordingsParams ¶ added in v0.39.0
type CallParticipant ¶ added in v0.39.0
type CallParticipant struct {
// The participant's own call id: what the mute and remove endpoints take, and what
// GET /v3/calls/{id} accepts
ID string `json:"id"`
// How long the participant has been connected to the room, in seconds
DurationSeconds int64 `json:"duration_seconds"`
// user for one of your app users, number for a phone number, anonymous for a
// caller who withheld their number
Kind string `json:"kind"`
// True while the room mutes this participant
Muted bool `json:"muted"`
// The app user's identity or the phone number in E.164 format. Null when the kind
// is anonymous
Value string `json:"value" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
DurationSeconds respjson.Field
Kind respjson.Field
Muted respjson.Field
Value respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A participant of a conference call
func (CallParticipant) RawJSON ¶ added in v0.39.0
func (r CallParticipant) RawJSON() string
Returns the unmodified JSON received from the API
func (*CallParticipant) UnmarshalJSON ¶ added in v0.39.0
func (r *CallParticipant) UnmarshalJSON(data []byte) error
type CallParticipantAddParams ¶ added in v0.39.0
type CallParticipantAddParams struct {
// The number shown to a phone participant as the caller, in E.164 format. Must be
// one of your numbers. The call's owning number when omitted
CallerID param.Opt[string] `json:"caller_id,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// A participant to add to a call
To CallParticipantTargetParam `json:"to,omitzero"`
// contains filtered or unexported fields
}
func (CallParticipantAddParams) MarshalJSON ¶ added in v0.39.0
func (r CallParticipantAddParams) MarshalJSON() (data []byte, err error)
func (*CallParticipantAddParams) UnmarshalJSON ¶ added in v0.39.0
func (r *CallParticipantAddParams) UnmarshalJSON(data []byte) error
type CallParticipantListParams ¶ added in v0.39.0
type CallParticipantRemoveAllParams ¶ added in v0.39.0
type CallParticipantRemoveAllParams struct {
MutationRequest MutationRequestParam
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (CallParticipantRemoveAllParams) MarshalJSON ¶ added in v0.39.0
func (r CallParticipantRemoveAllParams) MarshalJSON() (data []byte, err error)
func (*CallParticipantRemoveAllParams) UnmarshalJSON ¶ added in v0.39.0
func (r *CallParticipantRemoveAllParams) UnmarshalJSON(data []byte) error
type CallParticipantRemoveParams ¶ added in v0.39.0
type CallParticipantRemoveParams struct {
ID string `path:"id" api:"required" json:"-"`
MutationRequest MutationRequestParam
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (CallParticipantRemoveParams) MarshalJSON ¶ added in v0.39.0
func (r CallParticipantRemoveParams) MarshalJSON() (data []byte, err error)
func (*CallParticipantRemoveParams) UnmarshalJSON ¶ added in v0.39.0
func (r *CallParticipantRemoveParams) UnmarshalJSON(data []byte) error
type CallParticipantService ¶ added in v0.39.0
type CallParticipantService struct {
Options []option.RequestOption
}
Phone calls from the numbers you hold, driven by your own callback URL.
`POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/channels/voice/tokens` mints a short-lived token that lets a user of your app place and receive calls as that number. When a call arrives or a caller presses a key, a signed question is POSTed to the callback URL and the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events themselves (`call.completed` and the rest) arrive through your webhooks.
Every call is a record under `/v3/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
CallParticipantService contains methods and other services that help with interacting with the Sent 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 NewCallParticipantService method instead.
func NewCallParticipantService ¶ added in v0.39.0
func NewCallParticipantService(opts ...option.RequestOption) (r CallParticipantService)
NewCallParticipantService 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 (*CallParticipantService) Add ¶ added in v0.39.0
func (r *CallParticipantService) Add(ctx context.Context, id string, params CallParticipantAddParams, opts ...option.RequestOption) (res *APIResponseOfCall, err error)
Dials one of your app users or a phone number into a call that is in a conference room, and answers with the participant's own call record. The participant is a call of their own: it has its own id, can be looked up and hung up, and is billed and reported through call.completed and call.failed like any other call. A phone participant is called from caller_id, which must be one of your numbers, or from the call's owning number when omitted, and needs a destination you may call and a positive balance. Only a call your answer connected to a conference can take participants: a call connected to a user or a number answers 409.
func (*CallParticipantService) List ¶ added in v0.39.0
func (r *CallParticipantService) List(ctx context.Context, id string, query CallParticipantListParams, opts ...option.RequestOption) (res *APIResponseOfListOfCallParticipant, err error)
Lists who is in the conference room one of your live calls is in: each participant's own call id, who they are, whether the room mutes them, and how long they have been connected. The call itself is one of the participants. Use a participant's id to mute or remove them; it is also a call id, so GET /v3/calls/{id} accepts it. A call that has ended answers 409, as does a call that is not in a conference.
func (*CallParticipantService) Remove ¶ added in v0.39.0
func (r *CallParticipantService) Remove(ctx context.Context, participantID string, params CallParticipantRemoveParams, opts ...option.RequestOption) (err error)
Removes one participant from the conference room a live call is in, named by the participant's own call id from the participants list. Their leg ends and is reported through call.completed like any other call; everyone else stays connected. A participant who is not in this call's room answers 404. A call that has ended answers 409, as does a call that is not in a conference.
func (*CallParticipantService) RemoveAll ¶ added in v0.39.0
func (r *CallParticipantService) RemoveAll(ctx context.Context, id string, params CallParticipantRemoveAllParams, opts ...option.RequestOption) (err error)
Removes every participant from the conference room a live call is in, the call itself included. Every leg ends and is reported through call.completed like any other call. A room that is already empty answers 204 as well. A call that has ended answers 409, as does a call that is not in a conference.
func (*CallParticipantService) Update ¶ added in v0.39.0
func (r *CallParticipantService) Update(ctx context.Context, participantID string, params CallParticipantUpdateParams, opts ...option.RequestOption) (err error)
Mutes or unmutes one participant of the conference room a live call is in, named by the participant's own call id from the participants list: send muted true to silence them, muted false to let them be heard again. Muting a participant who is already muted succeeds, as does unmuting one who is not. A participant who is not in this call's room answers 404. A call that has ended answers 409, as does a call that is not in a conference.
type CallParticipantTargetParam ¶ added in v0.39.0
type CallParticipantTargetParam struct {
// user for one of your app users, number for a phone number
Kind param.Opt[string] `json:"kind,omitzero"`
// The app user's identity, or the phone number in E.164 format
Value param.Opt[string] `json:"value,omitzero"`
// contains filtered or unexported fields
}
A participant to add to a call
func (CallParticipantTargetParam) MarshalJSON ¶ added in v0.39.0
func (r CallParticipantTargetParam) MarshalJSON() (data []byte, err error)
func (*CallParticipantTargetParam) UnmarshalJSON ¶ added in v0.39.0
func (r *CallParticipantTargetParam) UnmarshalJSON(data []byte) error
type CallParticipantUpdateParams ¶ added in v0.39.0
type CallParticipantUpdateParams struct {
ID string `path:"id" api:"required" json:"-"`
// true to mute the participant, false to unmute them
Muted param.Opt[bool] `json:"muted,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (CallParticipantUpdateParams) MarshalJSON ¶ added in v0.39.0
func (r CallParticipantUpdateParams) MarshalJSON() (data []byte, err error)
func (*CallParticipantUpdateParams) UnmarshalJSON ¶ added in v0.39.0
func (r *CallParticipantUpdateParams) UnmarshalJSON(data []byte) error
type CallParty ¶ added in v0.39.0
type CallParty struct {
// user for one of your app users, number for a phone number, conference for a
// room, anonymous for a caller who withheld their number
Kind string `json:"kind"`
// The app user's identity, the phone number in E.164 format, or the room name.
// Null when the kind is anonymous
Value string `json:"value" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Kind respjson.Field
Value respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
One end of a call
func (*CallParty) UnmarshalJSON ¶ added in v0.39.0
type CallRecordParams ¶ added in v0.39.0
type CallRecordParams struct {
// start to begin recording, stop to end it
Action param.Opt[string] `json:"action,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (CallRecordParams) MarshalJSON ¶ added in v0.39.0
func (r CallRecordParams) MarshalJSON() (data []byte, err error)
func (*CallRecordParams) UnmarshalJSON ¶ added in v0.39.0
func (r *CallRecordParams) UnmarshalJSON(data []byte) error
type CallRecording ¶ added in v0.39.0
type CallRecording struct {
// A pre-signed link that downloads the recording as an MP3 file. Anyone holding it
// can download the recording until it expires
DownloadURL string `json:"download_url"`
// The recording's id, the one the call.recording_ready webhook announced it under
RecordingID string `json:"recording_id" format:"uuid"`
// When the link stops working (UTC). Request the recordings again for a fresh link
URLExpiresAt time.Time `json:"url_expires_at" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
DownloadURL respjson.Field
RecordingID respjson.Field
URLExpiresAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A short-lived link to a call recording
func (CallRecording) RawJSON ¶ added in v0.39.0
func (r CallRecording) RawJSON() string
Returns the unmodified JSON received from the API
func (*CallRecording) UnmarshalJSON ¶ added in v0.39.0
func (r *CallRecording) UnmarshalJSON(data []byte) error
type CallRecordings ¶ added in v0.39.0
type CallRecordings struct {
// Every recording of the call, oldest first. Empty until the first
// call.recording_ready webhook has been sent, and for a call that was never
// recorded
Recordings []CallRecording `json:"recordings"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Recordings respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The recordings of a call, each as a short-lived download link
func (CallRecordings) RawJSON ¶ added in v0.39.0
func (r CallRecordings) RawJSON() string
Returns the unmodified JSON received from the API
func (*CallRecordings) UnmarshalJSON ¶ added in v0.39.0
func (r *CallRecordings) UnmarshalJSON(data []byte) error
type CallService ¶ added in v0.39.0
type CallService struct {
Options []option.RequestOption
// Phone calls from the numbers you hold, driven by your own callback URL.
//
// `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent
// asks what to do with each call on it, and `POST /v3/channels/voice/tokens` mints
// a short-lived token that lets a user of your app place and receive calls as that
// number. When a call arrives or a caller presses a key, a signed question is
// POSTed to the callback URL and the answer decides the call;
// `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
// before a real call reaches it, and
// `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret.
// The call events themselves (`call.completed` and the rest) arrive through your
// webhooks.
//
// Every call is a record under `/v3/calls`: read it, list its recordings once one
// is ready, hang it up, start or stop recording, and add, mute or remove
// conference participants while it is live. A leg to a phone number runs for at
// most what your balance affords at the destination's rate.
Participants CallParticipantService
}
Phone calls from the numbers you hold, driven by your own callback URL.
`POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/channels/voice/tokens` mints a short-lived token that lets a user of your app place and receive calls as that number. When a call arrives or a caller presses a key, a signed question is POSTed to the callback URL and the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events themselves (`call.completed` and the rest) arrive through your webhooks.
Every call is a record under `/v3/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
CallService contains methods and other services that help with interacting with the Sent 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 NewCallService method instead.
func NewCallService ¶ added in v0.39.0
func NewCallService(opts ...option.RequestOption) (r CallService)
NewCallService 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 (*CallService) Get ¶ added in v0.39.0
func (r *CallService) Get(ctx context.Context, id string, query CallGetParams, opts ...option.RequestOption) (res *APIResponseOfCall, err error)
Retrieves one of your calls by id: the parties, the owning number, the current status with its failure reason, duration, price, recording availability, and a timeline of when the call entered each status.
func (*CallService) Hangup ¶ added in v0.39.0
func (r *CallService) Hangup(ctx context.Context, id string, params CallHangupParams, opts ...option.RequestOption) (err error)
Ends one of your live calls. The call then ends the way any other call does: its status moves to completed and call.completed is sent once the disconnect is reported. A call that has already ended answers 409, and so does a call with no phone leg, such as one between two app users.
func (*CallService) List ¶ added in v0.39.0
func (r *CallService) List(ctx context.Context, params CallListParams, opts ...option.RequestOption) (res *pagination.CallsPage[Call], err error)
Retrieves a paginated list of your calls, most recent first. Filter by direction, status, the owning number, and the time the call started (from and to are inclusive). Use the call webhooks for real-time updates; this list is for looking calls up afterwards.
func (*CallService) ListAutoPaging ¶ added in v0.39.0
func (r *CallService) ListAutoPaging(ctx context.Context, params CallListParams, opts ...option.RequestOption) *pagination.CallsPageAutoPager[Call]
Retrieves a paginated list of your calls, most recent first. Filter by direction, status, the owning number, and the time the call started (from and to are inclusive). Use the call webhooks for real-time updates; this list is for looking calls up afterwards.
func (*CallService) ListRecordings ¶ added in v0.39.0
func (r *CallService) ListRecordings(ctx context.Context, id string, query CallListRecordingsParams, opts ...option.RequestOption) (res *APIResponseOfCallRecordings, err error)
Returns pre-signed links to the recordings of one of your calls, each valid until its url_expires_at. A recording appears once the call was recorded, by a connect answer with record set, a startRecording instruction or the recordings command, and the call.recording_ready webhook has been sent; until then, and for a call that was never recorded, the list is empty. A call recorded more than once lists every recording, oldest first, each under the recording_id its call.recording_ready webhook carried.
func (*CallService) Record ¶ added in v0.39.0
func (r *CallService) Record(ctx context.Context, id string, params CallRecordParams, opts ...option.RequestOption) (err error)
Starts or stops recording one of your live calls. Use start to begin recording mid-call, or stop to end a recording, whether it was started here or by a connect answer with record set. A call that has already ended answers 409, and so does a call with no phone leg, such as one between two app users, which can't be recorded.
type CallTimelineEntry ¶ added in v0.39.0
type CallTimelineEntry struct {
// initiated, ringing, answered, completed, failed, no_answer or rejected
Status string `json:"status"`
// When the call entered this status (UTC)
Timestamp time.Time `json:"timestamp" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Status respjson.Field
Timestamp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
When a call entered a status
func (CallTimelineEntry) RawJSON ¶ added in v0.39.0
func (r CallTimelineEntry) RawJSON() string
Returns the unmodified JSON received from the API
func (*CallTimelineEntry) UnmarshalJSON ¶ added in v0.39.0
func (r *CallTimelineEntry) UnmarshalJSON(data []byte) error
type CallsList ¶ added in v0.39.0
type CallsList struct {
// The calls on this page, most recent first
Calls []Call `json:"calls"`
// Pagination metadata for list responses
Pagination PaginationMeta `json:"pagination"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Calls respjson.Field
Pagination respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Paginated list of calls
func (*CallsList) UnmarshalJSON ¶ added in v0.39.0
type CampaignDataParam ¶ added in v0.7.0
type CampaignDataParam struct {
// Campaign description
Description string `json:"description" api:"required"`
// Campaign name
Name string `json:"name" api:"required"`
// Campaign type (e.g., "KYC", "App").
//
// Still required of a caller, and consulted by nothing. It named the signup path
// that produced the campaign, was written to a column no query filters on, no TCR
// payload carries and no fee or status decision reads, and is now defaulted at the
// entity instead. It stays required so that a request which was valid before is
// still valid — dropping it would be the client-visible change, not keeping it.
Type string `json:"type" api:"required"`
// List of use cases with sample messages
UseCases []CampaignUseCaseDataParam `json:"useCases,omitzero" api:"required"`
// Comma-separated keywords that trigger help message (e.g., "HELP, INFO, SUPPORT")
HelpKeywords param.Opt[string] `json:"helpKeywords,omitzero"`
// Message sent when user requests help
HelpMessage param.Opt[string] `json:"helpMessage,omitzero"`
// Description of how messages flow in the campaign
MessageFlow param.Opt[string] `json:"messageFlow,omitzero"`
// Comma-separated keywords that trigger opt-in (e.g., "YES, START, SUBSCRIBE")
OptinKeywords param.Opt[string] `json:"optinKeywords,omitzero"`
// Message sent when user opts in
OptinMessage param.Opt[string] `json:"optinMessage,omitzero"`
// Comma-separated keywords that trigger opt-out (e.g., "STOP, UNSUBSCRIBE, END")
OptoutKeywords param.Opt[string] `json:"optoutKeywords,omitzero"`
// Message sent when user opts out
OptoutMessage param.Opt[string] `json:"optoutMessage,omitzero"`
// URL to privacy policy
PrivacyPolicyLink param.Opt[string] `json:"privacyPolicyLink,omitzero" format:"uri"`
// URL to terms and conditions
TermsAndConditionsLink param.Opt[string] `json:"termsAndConditionsLink,omitzero" format:"uri"`
// Expected messaging volume for this campaign. Numeric string (e.g. "1999",
// "5000"). Values below 2000 bill at the low-volume tier.
Volume param.Opt[string] `json:"volume,omitzero"`
// contains filtered or unexported fields
}
Campaign data for create or update operation
The properties Description, Name, Type, UseCases are required.
func (CampaignDataParam) MarshalJSON ¶ added in v0.7.0
func (r CampaignDataParam) MarshalJSON() (data []byte, err error)
func (*CampaignDataParam) UnmarshalJSON ¶ added in v0.7.0
func (r *CampaignDataParam) UnmarshalJSON(data []byte) error
type CampaignUseCase ¶ added in v0.30.0
type CampaignUseCase struct {
ID string `json:"id" format:"uuid"`
CampaignID string `json:"campaignId" format:"uuid"`
CreatedAt time.Time `json:"createdAt" format:"date-time"`
CustomerID string `json:"customerId" format:"uuid"`
// Any of "MARKETING", "ACCOUNT_NOTIFICATION", "CUSTOMER_CARE", "FRAUD_ALERT",
// "TWO_FA", "DELIVERY_NOTIFICATION", "SECURITY_ALERT", "M2M", "MIXED",
// "HIGHER_EDUCATION", "POLLING_VOTING", "PUBLIC_SERVICE_ANNOUNCEMENT",
// "LOW_VOLUME".
MessagingUseCaseUs MessagingUseCaseUs `json:"messagingUseCaseUs"`
// Sample messages submitted to the registry for this use case.
SampleMessages []string `json:"sampleMessages"`
UpdatedAt time.Time `json:"updatedAt" api:"nullable" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CampaignID respjson.Field
CreatedAt respjson.Field
CustomerID respjson.Field
MessagingUseCaseUs respjson.Field
SampleMessages respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Customer-facing use-case representation for the public v3 campaign contract. Exists for the same reason as BrandCampaignV3Response: nesting the TcrCampaignUseCase database entity in a public response means any column added to that table silently becomes part of the customer-facing contract. This DTO is an explicit allowlist, so a new column stays invisible until it is added here on purpose. This mirrors exactly the fields the entity already serialized, so it removes nothing from the current response shape. It only closes the future-leak path.
func (CampaignUseCase) RawJSON ¶ added in v0.30.0
func (r CampaignUseCase) RawJSON() string
Returns the unmodified JSON received from the API
func (*CampaignUseCase) UnmarshalJSON ¶ added in v0.30.0
func (r *CampaignUseCase) UnmarshalJSON(data []byte) error
type CampaignUseCaseDataParam ¶ added in v0.30.0
type CampaignUseCaseDataParam struct {
// Any of "MARKETING", "ACCOUNT_NOTIFICATION", "CUSTOMER_CARE", "FRAUD_ALERT",
// "TWO_FA", "DELIVERY_NOTIFICATION", "SECURITY_ALERT", "M2M", "MIXED",
// "HIGHER_EDUCATION", "POLLING_VOTING", "PUBLIC_SERVICE_ANNOUNCEMENT",
// "LOW_VOLUME".
MessagingUseCaseUs MessagingUseCaseUs `json:"messagingUseCaseUs,omitzero" api:"required"`
// Sample messages for this use case (1-5 messages, max 1024 characters each)
SampleMessages []string `json:"sampleMessages,omitzero" api:"required"`
// contains filtered or unexported fields
}
Campaign use case with sample messages
The properties MessagingUseCaseUs, SampleMessages are required.
func (CampaignUseCaseDataParam) MarshalJSON ¶ added in v0.30.0
func (r CampaignUseCaseDataParam) MarshalJSON() (data []byte, err error)
func (*CampaignUseCaseDataParam) UnmarshalJSON ¶ added in v0.30.0
func (r *CampaignUseCaseDataParam) UnmarshalJSON(data []byte) error
type ChannelEvent ¶ added in v0.36.0
type ChannelEvent struct {
// The specific event within the family, for example message.delivered,
// message.received or contact.opt_out. Absent on events that have no subtype, so
// treat it as optional.
Event string `json:"event" api:"nullable"`
// The event family, for example message, templates or contact. Route on this
// first, then on event for the specific change.
Field string `json:"field"`
// Body of a channel event: where one of the customer's channels stands in
// provisioning and compliance. Delivered when a milestone moves — a registration
// filed, a verdict returned, a resubmission asked for, a sender gone live — so a
// customer's own onboarding UI does not have to poll GET /v3/channels.
//
// The subject is one item, never the account. A customer's "SMS channel" has no
// status; a market does. Country, NumberType and SenderValue name which one, so a
// customer terminating only to Kosovo never receives an event about US 10DLC.
//
// Status is the stable half of the contract. It is the same four-value set GET
// /v3/channels publishes, computed through the same code, so an event and a read
// of the same market cannot disagree. A subscriber that reads nothing but the
// status and the subject fields is a correct subscriber. The sub-type on the
// envelope names the specific milestone and is additive — that vocabulary comes
// from registries and carriers, which are parties Sent does not control.
//
// Status means provisioning and compliance are complete, not that a send will
// succeed right now. An account can be suspended, or a destination blocked by a
// routing rule, without either showing up here. Those are separate surfaces and
// deliberately not modelled on this payload.
Payload ChannelEventPayload `json:"payload" api:"nullable"`
// The event-specific body.
RequestID string `json:"request_id" api:"nullable"`
// When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
// time, not the time the underlying change happened. Use the timestamp inside the
// payload for the latter.
Timestamp string `json:"timestamp"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Event respjson.Field
Field respjson.Field
Payload respjson.Field
RequestID respjson.Field
Timestamp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares this shape and varies only in Payload.
func (ChannelEvent) RawJSON ¶ added in v0.36.0
func (r ChannelEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChannelEvent) UnmarshalJSON ¶ added in v0.36.0
func (r *ChannelEvent) UnmarshalJSON(data []byte) error
type ChannelEventPayload ¶ added in v0.36.0
type ChannelEventPayload struct {
// The market's destination country as an ISO 3166-1 alpha-2 code, for example XK.
// Always present, and the property that identifies this payload among the
// delivered envelopes — see DeliveredWebhookEvents. Every event in this family
// reports one market, and a market has a country.
Country string `json:"country" api:"required"`
// The account whose market this is, named as on every other family. When an
// organization receives an event for one of its sender profiles this is the
// profile, so a reseller compares it with its own id and anything different is one
// of its profiles. Matches customer_id on GET /v3/channels and the sender
// profile's id. Together with channel, country, and number_type, it identifies the
// market.
AccountID string `json:"account_id" format:"uuid"`
// The channel this market belongs to: sms, whatsapp, or rcs. Never sent — that
// value belongs to message events, where it names the smart-routing brand rather
// than a channel that can be provisioned.
Channel string `json:"channel"`
// What a market has been given: the identity it registers under, its programme,
// and any documents attached.
//
// What it does not carry is what the market asks for. That is the subject of GET
// /v3/compliance/requirements, and it is the same answer for every caller — a
// description of what a compliance regime wants, not a record of one customer's
// progress through it. It was reported here as well for a while, which put the
// same array in six response shapes and left a caller deciding which of two
// sources to believe.
//
// Present on a list read for markets that register (carrying brand and campaign),
// but with documents absent — documents are not fetched for a list, because a
// catalog lookup and a document read per market would multiply across a page.
// Absent documents is distinct from an empty list: absent says they were not
// fetched; empty says the market has been given none. The parent object is null
// only when the market registers with nobody and compliance was not computed —
// nothing to show at all.
Compliance ChannelEventPayloadCompliance `json:"compliance" api:"nullable"`
// The kind of sender the market uses, for example TEN_DLC, LOCAL, or ALPHANUMERIC.
// Omitted when the subject has no sender type of its own.
NumberType string `json:"number_type" api:"nullable"`
// Why the market reached this state, as a sentence to show a person: the specific
// explanation when one was given (a correction explained, a campaign lapse),
// otherwise what reason_code means for this market. Not a value to branch on.
Reason string `json:"reason" api:"nullable"`
// Why the market is not ACTIVE, as a stable code: an ErrorCodes CHANNEL_xxx value
// such as CHANNEL_001 (something you owe) or CHANNEL_002 (a correction was
// requested). The same code the channels resource reports for the market. Switch
// on this rather than on reason. Omitted while ACTIVE.
ReasonCode string `json:"reason_code" api:"nullable"`
// The sender itself — a number in E.164, or an alphanumeric sender ID.
//
// Always present, and null until a sender exists. The key is on every delivery so
// a subscriber reads one shape rather than branching on whether the field arrived
// — the same choice template_id makes on the message payload.
//
// It can carry a value at any point in the lifecycle, not only once the market is
// live: a number ordered and not yet active at the carrier is already known during
// PROVISIONING, and an alphanumeric sender the customer chose themselves is known
// before anything is filed. It is null while the market is still waiting on a
// number, which for a US 10DLC registration is every event up to
// channel.activated.
SenderValue string `json:"sender_value" api:"nullable"`
// Where the market stands: PENDING_REVIEW, ACTION_NEEDED, PROVISIONING, ACTIVE or
// INACTIVE. PENDING_REVIEW means a registry or a carrier holds it and the wait is
// theirs; ACTION_NEEDED means it is yours; PROVISIONING means the verdict is in
// and Sent is acquiring the sender; INACTIVE means it had a working sender and no
// longer does.
//
// Each event name is the transition into one of these, but the two are separate
// fields and may legitimately differ. A resubmission filed against a market whose
// sender is already live is channel.submitted carrying ACTIVE: a correction is
// with the registry and the sender keeps working. Read both.
Status string `json:"status"`
// When the transition happened, in UTC (yyyy-MM-ddTHH:mm:ssZ).
UpdatedAt string `json:"updated_at"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Country respjson.Field
AccountID respjson.Field
Channel respjson.Field
Compliance respjson.Field
NumberType respjson.Field
Reason respjson.Field
ReasonCode respjson.Field
SenderValue respjson.Field
Status respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Body of a channel event: where one of the customer's channels stands in provisioning and compliance. Delivered when a milestone moves — a registration filed, a verdict returned, a resubmission asked for, a sender gone live — so a customer's own onboarding UI does not have to poll GET /v3/channels.
The subject is one item, never the account. A customer's "SMS channel" has no status; a market does. Country, NumberType and SenderValue name which one, so a customer terminating only to Kosovo never receives an event about US 10DLC.
Status is the stable half of the contract. It is the same four-value set GET /v3/channels publishes, computed through the same code, so an event and a read of the same market cannot disagree. A subscriber that reads nothing but the status and the subject fields is a correct subscriber. The sub-type on the envelope names the specific milestone and is additive — that vocabulary comes from registries and carriers, which are parties Sent does not control.
Status means provisioning and compliance are complete, not that a send will succeed right now. An account can be suspended, or a destination blocked by a routing rule, without either showing up here. Those are separate surfaces and deliberately not modelled on this payload.
func (ChannelEventPayload) RawJSON ¶ added in v0.36.0
func (r ChannelEventPayload) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChannelEventPayload) UnmarshalJSON ¶ added in v0.36.0
func (r *ChannelEventPayload) UnmarshalJSON(data []byte) error
type ChannelEventPayloadCompliance ¶ added in v0.37.0
type ChannelEventPayloadCompliance struct {
// The identity this market registers under, with inherit saying whose it is.
//
// Reported here rather than on the profile because it belongs to the registration
// this market files, and only one market files one. It was a top-level block for a
// while, which put a per-registration value beside a list of markets and left a
// caller to work out which market it belonged to.
//
// Absent for a market that registers with nobody — such a market asks for no
// identity, so there is none to report. Absent and null mean different things:
// absent says this market does not ask, null would say it asks and nothing was
// supplied.
//
// Untyped, like the request side, because its members are declared by the market's
// own schema rather than by a C# class. A typed pair here would be a second
// definition of what a market wants, free to drift from the one that validates.
Brand map[string]any `json:"brand" api:"nullable"`
// The programme this market registers, with inherit saying whose it is.
//
// One, not a list. TcrCampaigns permits several and an account built on the admin
// side may hold them, but this surface offers one — which is what lets the
// market's PATCH be an upsert rather than a collection with an addressable create
// behind it. An account holding several is reported as its first and refused on
// write, rather than half-edited.
//
// Carries no id. Nothing addresses a campaign, and an undeclared key would be
// refused if the caller sent this object back — which it is meant to be able to
// do.
Campaign map[string]any `json:"campaign" api:"nullable"`
// What has been supplied for this market.
//
// Files, not values — the declared halves above carry the values. A document
// cannot be a JSON value, so it is sent as multipart on the channel call and
// reported here as a reference.
//
// Absent on a list read, which fetches identity but does not compute compliance
// documents per market. Absent and empty mean different things: absent says the
// documents were not fetched; empty says the market has been given none.
Documents []ChannelEventPayloadComplianceDocument `json:"documents" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Brand respjson.Field
Campaign respjson.Field
Documents respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
What a market has been given: the identity it registers under, its programme, and any documents attached.
What it does not carry is what the market asks for. That is the subject of GET /v3/compliance/requirements, and it is the same answer for every caller — a description of what a compliance regime wants, not a record of one customer's progress through it. It was reported here as well for a while, which put the same array in six response shapes and left a caller deciding which of two sources to believe.
Present on a list read for markets that register (carrying brand and campaign), but with documents absent — documents are not fetched for a list, because a catalog lookup and a document read per market would multiply across a page. Absent documents is distinct from an empty list: absent says they were not fetched; empty says the market has been given none. The parent object is null only when the market registers with nobody and compliance was not computed — nothing to show at all.
func (ChannelEventPayloadCompliance) RawJSON ¶ added in v0.37.0
func (r ChannelEventPayloadCompliance) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChannelEventPayloadCompliance) UnmarshalJSON ¶ added in v0.37.0
func (r *ChannelEventPayloadCompliance) UnmarshalJSON(data []byte) error
type ChannelEventPayloadComplianceDocument ¶ added in v0.37.0
type ChannelEventPayloadComplianceDocument struct {
// Identifier of the upload, for fetching it back through the documents endpoints.
DocumentID string `json:"document_id" api:"nullable" format:"uuid"`
FileName string `json:"file_name" api:"nullable"`
// The catalog's name for this document, matching the requirement it satisfies.
Key string `json:"key"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
DocumentID respjson.Field
FileName respjson.Field
Key respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A document a market asked for and has been given.
func (ChannelEventPayloadComplianceDocument) RawJSON ¶ added in v0.37.0
func (r ChannelEventPayloadComplianceDocument) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChannelEventPayloadComplianceDocument) UnmarshalJSON ¶ added in v0.37.0
func (r *ChannelEventPayloadComplianceDocument) UnmarshalJSON(data []byte) error
type ChannelService ¶ added in v0.39.0
type ChannelService struct {
Options []option.RequestOption
// The senders you send from, one per channel.
//
// **SMS is a list of markets**, each keyed by `(country, number_type)` — a
// customer can hold `us/10dlc` and `gb/alphanumeric` at once, so a market is
// addressed by the pair rather than by country alone. **WhatsApp and RCS are
// single**: a customer has one business account and one agent. **Voice is per
// number**: each number you hold can carry phone calls on its own
// (`POST /v3/channels/voice`), each with the callback URL Sent asks what to do
// with its calls, one of them is the default line for calls placed from your app,
// and voice tokens are minted under `POST /v3/channels/voice/tokens`. Read your
// voice numbers with `GET /v3/channels/voice` and change one with
// `PATCH /v3/channels/voice/{number}`.
//
// ## Compliance lives on the market
//
// Adding a market records everything that market registers with, in its
// `compliance` object. Only **US `TEN_DLC`** registers with a regime — The
// Campaign Registry — and it is the only market whose compliance carries `brand`
// and `campaign`. Everywhere else compliance is documents, and many markets ask
// for none at all.
//
// `GET` and `PATCH` on a market return and accept the same shape, so what comes
// back can be sent back: an omitted key is left alone, and a key reported in
// `requirements` is the path into the body that clears it.
//
// Call `GET /v3/compliance/requirements` first — it answers what a market demands
// before you hold it, with a body you can fill in and post.
Voice ChannelVoiceService
}
ChannelService contains methods and other services that help with interacting with the Sent 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 NewChannelService method instead.
func NewChannelService ¶ added in v0.39.0
func NewChannelService(opts ...option.RequestOption) (r ChannelService)
NewChannelService 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.
type ChannelVoiceGetParams ¶ added in v0.39.0
type ChannelVoiceListParams ¶ added in v0.39.0
type ChannelVoiceNewParams ¶ added in v0.39.0
type ChannelVoiceNewParams struct {
// Where Sent asks what to do with each call on this number: an absolute HTTP or
// HTTPS URL on a public host. A signed question is POSTed here when a call arrives
// or a caller presses a key, and the answer decides the call. Every question is
// signed with the callback_secret the response returns, the same way your webhooks
// are signed. Turning the number on again with a different URL replaces it and
// keeps the secret.
CallbackURL string `json:"callback_url" api:"required"`
// The US area code a new number should be in, as 212. Only for a request that
// leaves number out — sending both says two different things about which number to
// use, and is refused. Omit it too and the number comes from anywhere in the
// country.
AreaCode param.Opt[string] `json:"area_code,omitzero"`
// Make this the line app-originated calls are placed from when a voice token names
// no number. Omit it and your first voice number takes that role; a later one
// leaves it where it is.
DefaultForAppCalls param.Opt[bool] `json:"default_for_app_calls,omitzero"`
// One of your phone numbers, in E.164 format. Leave the field out entirely to be
// given a new one instead; sending it empty is a refused request rather than a
// request for a new number.
Number param.Opt[string] `json:"number,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (ChannelVoiceNewParams) MarshalJSON ¶ added in v0.39.0
func (r ChannelVoiceNewParams) MarshalJSON() (data []byte, err error)
func (*ChannelVoiceNewParams) UnmarshalJSON ¶ added in v0.39.0
func (r *ChannelVoiceNewParams) UnmarshalJSON(data []byte) error
type ChannelVoiceNewTokenParams ¶ added in v0.39.0
type ChannelVoiceNewTokenParams struct {
// One of your voice-enabled phone numbers in E.164 format. Calls placed by this
// identity are routed through that number. Omit to use your default app-call
// number.
Number param.Opt[string] `json:"number,omitzero"`
// Token lifetime in seconds. Defaults to 600 and cannot exceed 3600.
Ttl param.Opt[int64] `json:"ttl,omitzero"`
// Your identifier for the app user, such as an agent or account id. Letters,
// digits, hyphens and underscores only, up to 200 characters.
Identity param.Opt[string] `json:"identity,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (ChannelVoiceNewTokenParams) MarshalJSON ¶ added in v0.39.0
func (r ChannelVoiceNewTokenParams) MarshalJSON() (data []byte, err error)
func (*ChannelVoiceNewTokenParams) UnmarshalJSON ¶ added in v0.39.0
func (r *ChannelVoiceNewTokenParams) UnmarshalJSON(data []byte) error
type ChannelVoiceRotateSecretParams ¶ added in v0.39.0
type ChannelVoiceRotateSecretParams struct {
MutationRequest MutationRequestParam
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (ChannelVoiceRotateSecretParams) MarshalJSON ¶ added in v0.39.0
func (r ChannelVoiceRotateSecretParams) MarshalJSON() (data []byte, err error)
func (*ChannelVoiceRotateSecretParams) UnmarshalJSON ¶ added in v0.39.0
func (r *ChannelVoiceRotateSecretParams) UnmarshalJSON(data []byte) error
type ChannelVoiceService ¶ added in v0.39.0
type ChannelVoiceService struct {
Options []option.RequestOption
}
The senders you send from, one per channel.
**SMS is a list of markets**, each keyed by `(country, number_type)` — a customer can hold `us/10dlc` and `gb/alphanumeric` at once, so a market is addressed by the pair rather than by country alone. **WhatsApp and RCS are single**: a customer has one business account and one agent. **Voice is per number**: each number you hold can carry phone calls on its own (`POST /v3/channels/voice`), each with the callback URL Sent asks what to do with its calls, one of them is the default line for calls placed from your app, and voice tokens are minted under `POST /v3/channels/voice/tokens`. Read your voice numbers with `GET /v3/channels/voice` and change one with `PATCH /v3/channels/voice/{number}`.
## Compliance lives on the market
Adding a market records everything that market registers with, in its `compliance` object. Only **US `TEN_DLC`** registers with a regime — The Campaign Registry — and it is the only market whose compliance carries `brand` and `campaign`. Everywhere else compliance is documents, and many markets ask for none at all.
`GET` and `PATCH` on a market return and accept the same shape, so what comes back can be sent back: an omitted key is left alone, and a key reported in `requirements` is the path into the body that clears it.
Call `GET /v3/compliance/requirements` first — it answers what a market demands before you hold it, with a body you can fill in and post.
ChannelVoiceService contains methods and other services that help with interacting with the Sent 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 NewChannelVoiceService method instead.
func NewChannelVoiceService ¶ added in v0.39.0
func NewChannelVoiceService(opts ...option.RequestOption) (r ChannelVoiceService)
NewChannelVoiceService 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 (*ChannelVoiceService) Get ¶ added in v0.39.0
func (r *ChannelVoiceService) Get(ctx context.Context, number string, query ChannelVoiceGetParams, opts ...option.RequestOption) (res *APIResponseOfVoiceNumber, err error)
Reads one of your voice numbers, active or inactive: its status, whether it is the default line for calls placed from your app, and its callback URL. The signing secret is not on this read.
The same shape `GET /v3/channels/voice` lists, and the same shape `PATCH` on this path accepts and returns, so what comes back can be sent back.
The number is the E.164 value in the path with the plus sign URL-encoded (`%2B`).
func (*ChannelVoiceService) List ¶ added in v0.39.0
func (r *ChannelVoiceService) List(ctx context.Context, query ChannelVoiceListParams, opts ...option.RequestOption) (res *APIResponseOfListOfVoiceNumber, err error)
Every number you turned phone calls on for, active or inactive, oldest first. Each entry carries the number's status, whether it is the default line for calls placed from your app, and its callback URL. The signing secret is never on a read; it is shown when voice is turned on and by `POST /v3/channels/voice/{number}/rotate-secret`.
The same entries `GET /v3/channels` reports under `voice`, and the same shape `GET /v3/channels/voice/{number}` returns for one of them. Change a number with `PATCH /v3/channels/voice/{number}`.
func (*ChannelVoiceService) New ¶ added in v0.39.0
func (r *ChannelVoiceService) New(ctx context.Context, params ChannelVoiceNewParams, opts ...option.RequestOption) (res *APIResponseOfVoiceNumberCreated, err error)
Adds voice to one of the numbers you hold, or gives you a new one. Send `number` for a number that is already yours (see `GET /v3/channels`); leave it out to be given a new US number, optionally in a particular `area_code`. Sending both is refused. Nothing registers, so the number can carry calls as soon as this returns.
What happens on a call is decided by your `callback_url`: when a call arrives on the number, or a caller presses a key on a menu, Sent POSTs a signed question there and follows the answer. The response carries the `callback_secret` the questions are signed with, the one time it is shown without rotating; verify a question the way you verify a webhook. `POST /v3/channels/voice/{number}/test` sends a test question and reports the verdict.
Your first voice number becomes the line app-originated calls are placed from when a voice token names no number; send `default_for_app_calls: true` to give that role to another number. A number you turned off earlier is turned back on, and the same number with a different `callback_url` has its URL replaced and keeps its secret.
Read the number's settings with `GET /v3/channels/voice` and change them with `PATCH /v3/channels/voice/{number}`.
With `sandbox: true` the request is validated and a simulated number reported with `202`; nothing is written and no number is bought.
func (*ChannelVoiceService) NewToken ¶ added in v0.39.0
func (r *ChannelVoiceService) NewToken(ctx context.Context, params ChannelVoiceNewTokenParams, opts ...option.RequestOption) (res *APIResponseOfVoiceToken, err error)
Mints a short-lived token for one of your app users. Call this from your backend and return the token to your app, which passes it to the voice client SDK to register. The identity is bound to the given number, or to your default app-call number when omitted, and calls placed by that identity are routed through the bound number. Minting again re-binds the identity, so an identity can move between numbers.
func (*ChannelVoiceService) RotateSecret ¶ added in v0.39.0
func (r *ChannelVoiceService) RotateSecret(ctx context.Context, number string, params ChannelVoiceRotateSecretParams, opts ...option.RequestOption) (res *APIResponseOfVoiceSecret, err error)
Generates a new signing secret for the questions Sent sends to this number's callback URL and returns it. The previous secret stops signing immediately, so update your backend before the next call reaches it. The number is the E.164 value in the path with the plus sign URL-encoded (`%2B`).
With `sandbox: true` a secret is generated and returned with `202`, and nothing is written.
func (*ChannelVoiceService) Test ¶ added in v0.39.0
func (r *ChannelVoiceService) Test(ctx context.Context, number string, params ChannelVoiceTestParams, opts ...option.RequestOption) (res *APIResponseOfVoiceCallbackTest, err error)
Sends a synthetic call.request question, flagged "test": true, to the number's callback URL, signed with that number's real secret, and reports what came back. Use it to build and debug your callback endpoint without placing calls: no call is placed, nothing is billed, and nothing is stored. One attempt with the same deadline as a live call, no retry. The outcome is ok when your endpoint answered 2xx with a valid answer; otherwise it is timeout, connection_failed, http_error or invalid_answer, with the reason and, for an invalid answer, the field at fault. The number is the E.164 value in the path with the plus sign URL-encoded (`%2B`).
With `sandbox: true` nothing is sent: the verdict comes back ok with `202` and no request or response in it.
func (*ChannelVoiceService) Update ¶ added in v0.39.0
func (r *ChannelVoiceService) Update(ctx context.Context, number string, params ChannelVoiceUpdateParams, opts ...option.RequestOption) (res *APIResponseOfVoiceNumber, err error)
Changes one of your voice numbers and answers with the number as stored, the same shape `GET` on this path returns, so what comes back can be sent back.
## What it changes
| Body | Effect | | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | `"status": "ACTIVE"` | turns calls on again for a number you turned off; the callback URL and the secret it had are kept | | `"status": "INACTIVE"` | turns calls off; the callback URL and the secret stay on the number | | `"default_for_app_calls": true` | makes this the line app-originated calls are placed from when a voice token names no number | | `"callback_url": "https://example.com/voice"` | replaces where Sent asks what to do with each call on the number; the signing secret is kept, and a number that was waiting for its first URL is turned on | | key omitted | left exactly as it is |
`status` is matched ignoring case. Any combination is accepted: `status: "ACTIVE"` with `default_for_app_calls: true` turns a number on as the new default, and a `callback_url` sent with either status is written too. A body that names none of the three is refused.
## What it will refuse
**`default_for_app_calls: false` is `400`.** An account with active voice numbers always has exactly one default, so the default moves by giving it to another number.
**Turning the default line off is `409`** while other active voice numbers remain. Move the default to another number first. Turning off your last voice number is allowed; that turns phone calls off.
**Making an inactive number the default is `400`.** Send `status: "ACTIVE"` in the same call.
A number added without a `callback_url` is `INACTIVE` for that one reason, so sending it a `callback_url` turns it on by itself, and it becomes your default line if you have no other active voice number. A number you turned off while it had a URL stays off.
**A number you never turned voice on for is `404`.** Add it with `POST /v3/channels/voice`.
The number is the E.164 value in the path with the plus sign URL-encoded (`%2B`).
With `sandbox: true` nothing is written: the request is validated against the stored number and the number is reported with `200` as it would read after the change.
type ChannelVoiceTestParams ¶ added in v0.39.0
type ChannelVoiceTestParams struct {
MutationRequest MutationRequestParam
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (ChannelVoiceTestParams) MarshalJSON ¶ added in v0.39.0
func (r ChannelVoiceTestParams) MarshalJSON() (data []byte, err error)
func (*ChannelVoiceTestParams) UnmarshalJSON ¶ added in v0.39.0
func (r *ChannelVoiceTestParams) UnmarshalJSON(data []byte) error
type ChannelVoiceUpdateParams ¶ added in v0.39.0
type ChannelVoiceUpdateParams struct {
// A new callback URL for the number, active or not: an absolute HTTP or HTTPS URL
// on a public host, where Sent asks what to do with each call. The signing secret
// is kept.
CallbackURL param.Opt[string] `json:"callback_url,omitzero"`
// true makes this the line app-originated calls are placed from when a voice token
// names no number. false is refused: an account with active voice numbers always
// has exactly one default, so the default moves by giving it to another number.
DefaultForAppCalls param.Opt[bool] `json:"default_for_app_calls,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// ACTIVE turns calls on for the number again, INACTIVE turns them off. Matched
// ignoring case. Turning the default line off is refused while other active voice
// numbers remain.
//
// Any of "ACTIVE", "INACTIVE".
Status ChannelVoiceUpdateParamsStatus `json:"status,omitzero"`
// contains filtered or unexported fields
}
func (ChannelVoiceUpdateParams) MarshalJSON ¶ added in v0.39.0
func (r ChannelVoiceUpdateParams) MarshalJSON() (data []byte, err error)
func (*ChannelVoiceUpdateParams) UnmarshalJSON ¶ added in v0.39.0
func (r *ChannelVoiceUpdateParams) UnmarshalJSON(data []byte) error
type ChannelVoiceUpdateParamsStatus ¶ added in v0.39.0
type ChannelVoiceUpdateParamsStatus string
ACTIVE turns calls on for the number again, INACTIVE turns them off. Matched ignoring case. Turning the default line off is refused while other active voice numbers remain.
const ( ChannelVoiceUpdateParamsStatusActive ChannelVoiceUpdateParamsStatus = "ACTIVE" ChannelVoiceUpdateParamsStatusInactive ChannelVoiceUpdateParamsStatus = "INACTIVE" )
type Client ¶
type Client struct {
Options []option.RequestOption
// Delivery reports and inbound messages, pushed to you.
//
// Subscribe an endpoint to the event types you care about —
// `GET /v3/webhooks/event-types` lists them — and we POST each one as it happens,
// retrying on failure. Polling `GET /v3/messages/{id}` works and does not scale.
//
// **Verify the signature.** Every delivery is signed with your endpoint's secret;
// an unverified endpoint is one anybody can post to. `rotate-secret` replaces it,
// `test` sends a specimen event, and `GET /v3/webhooks/{id}/events` shows what we
// tried to deliver and what your endpoint answered — which is the first place to
// look when something appears to be missing.
Webhooks WebhookService
// The people who can sign in to your organization, and what each may do.
//
// Users are dashboard access and nothing else — they do not send, and removing one
// does not affect traffic. An API key is not a user: it belongs to the
// organization or to a sender profile, so revoking a person's access leaves your
// integration running.
Users UserService
// Reusable message bodies with named variables.
//
// A template is substituted at send time from the values you pass, so the copy
// lives here rather than in your application. WhatsApp templates additionally need
// Meta's approval before they can be sent, and a template's channel status reports
// where that stands — an approved SMS template and an unapproved WhatsApp one are
// the same template in two states.
Templates TemplateService
// **Deprecated — use Sender Profiles.**
//
// The original profile resource, kept because it has live callers. It still works,
// and its replacement is `/v3/sender-profiles`, which takes the identity and the
// campaign in one call instead of across three.
//
// New integrations should not start here.
Profiles ProfileService
// What a phone number actually is, before you send to it.
//
// A lookup returns the number's country, line type and carrier, which is what
// decides whether it is reachable on a channel and what it costs. Worth doing on
// import rather than on send: a landline in a contact list is a message that can
// never be delivered.
Numbers NumberService
// Send a message and follow what happened to it.
//
// One endpoint sends on any channel: pass `channel: "sent"` and we pick between
// SMS, WhatsApp and RCS per recipient using your routing rules, or name a channel
// to pin it. A send is accepted asynchronously — `POST /v3/messages` returns an
// id, and delivery is reported through `GET /v3/messages/{id}`, its activities, or
// a webhook.
//
// **A message needs a sender.** What you can send, where, and at what cost is
// decided by the markets under **Channels** — so a recipient in a country you hold
// no sender for is refused here rather than queued.
//
// **A message can be resent on its id.** `POST /v3/messages/{id}/resend` puts a
// finished message — typically one BLOCKED for insufficient balance — back through
// the send pipeline. It is a new attempt, not a free retry: every policy runs
// again, the message is billed again, and its status webhooks fire again. A
// FILTERED message is never resendable.
Messages MessageService
// The people you message, and their channel identities.
//
// A contact holds one identity per channel — a phone number, a WhatsApp number —
// so routing can choose between them for the same person. Opt-out is recorded
// against the contact and honoured on every send, whichever channel it came
// through.
//
// `GET /v3/contacts/{id}/message-summary` is the per-contact view of what you have
// sent and what happened to it.
Contacts ContactService
// Inbound and outbound messages, grouped by the person they are with.
//
// A conversation is the thread for one contact across every channel — a reply by
// SMS and one by WhatsApp belong to the same conversation, because they are the
// same person talking to you.
//
// Read-only. Sending is **Messages**; a reply arrives here and through your
// webhooks.
Conversations ConversationService
// Phone calls from the numbers you hold, driven by your own callback URL.
//
// `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent
// asks what to do with each call on it, and `POST /v3/channels/voice/tokens` mints
// a short-lived token that lets a user of your app place and receive calls as that
// number. When a call arrives or a caller presses a key, a signed question is
// POSTed to the callback URL and the answer decides the call;
// `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
// before a real call reaches it, and
// `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret.
// The call events themselves (`call.completed` and the rest) arrive through your
// webhooks.
//
// Every call is a record under `/v3/calls`: read it, list its recordings once one
// is ready, hang it up, start or stop recording, and add, mute or remove
// conference participants while it is live. A leg to a phone number runs for at
// most what your balance affords at the destination's rate.
Calls CallService
Channels ChannelService
// Who the current key is.
//
// `GET /v3/me` answers with the account the key authenticates as, which is the
// quickest way to tell a live key from a test one, an organization key from a
// sender profile's, and to confirm `x-profile-id` resolved to the profile you
// meant.
Me MeService
}
Client creates a struct with services and top level methods that help with interacting with the Sent 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 (SENT_DM_API_KEY, SENT_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 ContactDeleteParams ¶ added in v0.7.0
type ContactDeleteParams struct {
MutationRequest MutationRequestParam
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (ContactDeleteParams) MarshalJSON ¶ added in v0.7.0
func (r ContactDeleteParams) MarshalJSON() (data []byte, err error)
func (*ContactDeleteParams) UnmarshalJSON ¶ added in v0.7.0
func (r *ContactDeleteParams) UnmarshalJSON(data []byte) error
type ContactEvent ¶ added in v0.36.0
type ContactEvent struct {
// The specific event within the family, for example message.delivered,
// message.received or contact.opt_out. Absent on events that have no subtype, so
// treat it as optional.
Event string `json:"event" api:"nullable"`
// The event family, for example message, templates or contact. Route on this
// first, then on event for the specific change.
Field string `json:"field"`
// Body of a contact.opt_in, contact.opt_out, contact.help or
// contact.custom_keyword event. Delivered when a contact signals a consent change,
// asks for help, or sends one of your own auto-reply keywords.
//
// These events state the signal outright, so you do not have to recognise keywords
// in the text of a message.received event. They also cover cases that produce no
// inbound message at all, such as a network handling an opt-out on your behalf.
//
// Two of the four change consent and two do not: contact.help and
// contact.custom_keyword report the state the contact already had. Read opt_out
// for the state and the envelope's event for what happened, rather than inferring
// one from the other.
//
// Fields are ordered identity → resulting state → provenance → join keys. The two
// parties are from and to. Note that the message family has not moved to those
// names yet — message.received still calls the same two parties inbound_number and
// outbound_number. Nothing here restates the envelope: which signal occurred is
// the envelope's event, and when it was emitted is its timestamp. Retries carry
// the same X-Webhook-Event-ID header, which is what to deduplicate on.
Payload ContactEventPayload `json:"payload" api:"nullable"`
// The event-specific body.
RequestID string `json:"request_id" api:"nullable"`
// When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
// time, not the time the underlying change happened. Use the timestamp inside the
// payload for the latter.
Timestamp string `json:"timestamp"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Event respjson.Field
Field respjson.Field
Payload respjson.Field
RequestID respjson.Field
Timestamp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares this shape and varies only in Payload.
func (ContactEvent) RawJSON ¶ added in v0.36.0
func (r ContactEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ContactEvent) UnmarshalJSON ¶ added in v0.36.0
func (r *ContactEvent) UnmarshalJSON(data []byte) error
type ContactEventPayload ¶ added in v0.36.0
type ContactEventPayload struct {
// Whether the contact is opted out after this signal — the state to write to your
// own record. Same meaning as opt_out on the contact resource. On contact.help and
// contact.custom_keyword this reports the contact's existing state, which neither
// changes.
//
// Two signals from the same contact can arrive out of order, because each one is
// queued on its own rather than against the contact. Compare the envelope's
// timestamp before you overwrite a newer state with an older one. That timestamp
// is second-precision, so treat two signals stamped in the same second as
// unordered and read the contact resource to settle them.
OptOut bool `json:"opt_out" api:"required"`
// How the signal reached us. INBOUND_KEYWORD means the contact sent a message
// whose text matched one of the keywords; PROVIDER_SIGNAL means the network
// reported it. A provider signal usually carries no message_id or text, so read
// both for null rather than inferring them from this field.
Source string `json:"source" api:"required"`
// The account the contact belongs to. Present so one endpoint can serve several
// accounts.
AccountID string `json:"account_id" format:"uuid"`
// The RCS agent the signal reached, when it reached one.
//
// Omitted entirely on channels that have no agent, rather than sent as null — an
// SMS or WhatsApp payload does not carry this key at all. On RCS it is the
// counterpart to To: a contact reaches an agent rather than a number, so exactly
// one of the two is populated and never both. If you run more than one agent, this
// is what tells you which of them the contact acted on.
AgentID string `json:"agent_id" api:"nullable"`
// The channel the signal arrived on, for example sms or whatsapp.
Channel string `json:"channel"`
// The contact who raised the signal. Always populated, including for contact.help
// or contact.custom_keyword from a number you have not messaged before — the
// contact is created if it does not exist yet, so this identifier is always
// resolvable against the contacts API.
ContactID string `json:"contact_id" format:"uuid"`
// The contact's number, in E.164 format with the leading + — who raised the
// signal. The same party message.received publishes as inbound_number.
From string `json:"from"`
// The inbound message that carried the signal, matching message_id on the
// corresponding message.received event so the two can be joined.
//
// Sent as null when the signal did not arrive as a message — for example when a
// network processed an opt-out on your behalf — and also when the message belongs
// to a different account than this event, which can happen on a shared WhatsApp
// number. The field is always present, so read it and check for null rather than
// checking whether the key exists.
MessageID string `json:"message_id" api:"nullable" format:"uuid"`
// The auto-reply template whose keyword the contact matched, joinable against the
// templates API.
//
// This is what identifies which signal arrived on contact.custom_keyword: every
// custom template reports the same event name, so the event alone cannot tell your
// booking keyword from your opening-hours one. One template holds as many keywords
// as you configured, so this is steadier to switch on than text.
//
// Populated on the compliance sub-types too, where it names the template that
// replied. Sent as null when no template was involved — a network-reported opt-out
// matches no keyword. The field is always present, so read it and check for null.
TemplateID string `json:"template_id" api:"nullable" format:"uuid"`
// The text the contact sent, for example STOP or UNSUBSCRIBE. Sent as null when
// the signal did not arrive as text. The field is always present, so read it and
// check for null rather than checking whether the key exists.
Text string `json:"text" api:"nullable"`
// The number of yours that received the signal, in E.164 format with the leading
// +. Tells a multi-number account which of its senders the contact acted on, which
// nothing else on this payload answers.
//
// This is your number, not the contact's. That is the opposite of what to means on
// POST /v3/messages, where it is the list of recipients you are sending to. Reply
// to From, not to this field, or the message goes back to yourself.
//
// Sent as null when the signal did not arrive at a number of yours — an RCS signal
// terminates at an agent rather than a number, and a provider-reported opt-out may
// name no receiving number at all. The field is always present, so read it and
// check for null rather than checking whether the key exists.
To string `json:"to" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
OptOut respjson.Field
Source respjson.Field
AccountID respjson.Field
AgentID respjson.Field
Channel respjson.Field
ContactID respjson.Field
From respjson.Field
MessageID respjson.Field
TemplateID respjson.Field
Text respjson.Field
To respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Body of a contact.opt_in, contact.opt_out, contact.help or contact.custom_keyword event. Delivered when a contact signals a consent change, asks for help, or sends one of your own auto-reply keywords.
These events state the signal outright, so you do not have to recognise keywords in the text of a message.received event. They also cover cases that produce no inbound message at all, such as a network handling an opt-out on your behalf.
Two of the four change consent and two do not: contact.help and contact.custom_keyword report the state the contact already had. Read opt_out for the state and the envelope's event for what happened, rather than inferring one from the other.
Fields are ordered identity → resulting state → provenance → join keys. The two parties are from and to. Note that the message family has not moved to those names yet — message.received still calls the same two parties inbound_number and outbound_number. Nothing here restates the envelope: which signal occurred is the envelope's event, and when it was emitted is its timestamp. Retries carry the same X-Webhook-Event-ID header, which is what to deduplicate on.
func (ContactEventPayload) RawJSON ¶ added in v0.36.0
func (r ContactEventPayload) RawJSON() string
Returns the unmodified JSON received from the API
func (*ContactEventPayload) UnmarshalJSON ¶ added in v0.36.0
func (r *ContactEventPayload) UnmarshalJSON(data []byte) error
type ContactGetMessageSummaryParams ¶ added in v0.30.0
type ContactGetParams ¶ added in v0.8.0
type ContactListParams ¶
type ContactListParams struct {
// Optional channel filter (sms, whatsapp)
Channel param.Opt[string] `query:"channel,omitzero" json:"-"`
// Optional phone number filter (alternative to list view)
Phone param.Opt[string] `query:"phone,omitzero" json:"-"`
// Optional search term for filtering contacts
Search param.Opt[string] `query:"search,omitzero" json:"-"`
// Page number (1-indexed)
Page param.Opt[int64] `query:"page,omitzero" json:"-"`
// Number of items per page
PageSize param.Opt[int64] `query:"page_size,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (ContactListParams) URLQuery ¶
func (r ContactListParams) URLQuery() (v url.Values, err error)
URLQuery serializes ContactListParams's query parameters as `url.Values`.
type ContactMessageSummary ¶ added in v0.30.0
type ContactMessageSummary struct {
ChannelScores []ContactMessageSummaryChannelScore `json:"channel_scores"`
ChannelsUsed []string `json:"channels_used"`
ContactID string `json:"contact_id" format:"uuid"`
FirstMessageAt time.Time `json:"first_message_at" api:"nullable" format:"date-time"`
LastMessageAt time.Time `json:"last_message_at" api:"nullable" format:"date-time"`
MessageCount int64 `json:"message_count"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ChannelScores respjson.Field
ChannelsUsed respjson.Field
ContactID respjson.Field
FirstMessageAt respjson.Field
LastMessageAt respjson.Field
MessageCount respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ContactMessageSummary) RawJSON ¶ added in v0.30.0
func (r ContactMessageSummary) RawJSON() string
Returns the unmodified JSON received from the API
func (*ContactMessageSummary) UnmarshalJSON ¶ added in v0.30.0
func (r *ContactMessageSummary) UnmarshalJSON(data []byte) error
type ContactMessageSummaryChannelScore ¶ added in v0.30.0
type ContactMessageSummaryChannelScore struct {
Channel string `json:"channel"`
// Percentage (0-100) of messages on this channel that ended in FAILED.
FailScore int64 `json:"fail_score"`
// Percentage (0-100) of messages on this channel that reached a successful
// terminal state: SENT/DELIVERED/READ for outbound, RECEIVED for inbound.
SuccessScore int64 `json:"success_score"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Channel respjson.Field
FailScore respjson.Field
SuccessScore respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ContactMessageSummaryChannelScore) RawJSON ¶ added in v0.30.0
func (r ContactMessageSummaryChannelScore) RawJSON() string
Returns the unmodified JSON received from the API
func (*ContactMessageSummaryChannelScore) UnmarshalJSON ¶ added in v0.30.0
func (r *ContactMessageSummaryChannelScore) UnmarshalJSON(data []byte) error
type ContactNewParams ¶ added in v0.7.0
type ContactNewParams struct {
// Phone number of the contact to create
PhoneNumber string `json:"phone_number" api:"required"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (ContactNewParams) MarshalJSON ¶ added in v0.7.0
func (r ContactNewParams) MarshalJSON() (data []byte, err error)
func (*ContactNewParams) UnmarshalJSON ¶ added in v0.7.0
func (r *ContactNewParams) UnmarshalJSON(data []byte) error
type ContactResponse ¶ added in v0.9.0
type ContactResponse struct {
// Unique identifier for the contact
ID string `json:"id" format:"uuid"`
// Comma-separated list of available messaging channels (e.g., "sms,whatsapp")
AvailableChannels string `json:"available_channels"`
// Country calling code (e.g., 1 for US/Canada)
CountryCode string `json:"country_code"`
// When the contact was created
CreatedAt time.Time `json:"created_at" format:"date-time"`
// Which customer owns this — the key's own, or the profile named in x-profile-id.
// Says whose resource this is, which the resource's own id does not.
CustomerID string `json:"customer_id" format:"uuid"`
// Default messaging channel to use (e.g., "sms" or "whatsapp")
DefaultChannel string `json:"default_channel"`
// Phone number in E.164 format (e.g., +1234567890)
FormatE164 string `json:"format_e164"`
// Phone number in international format (e.g., +1 234-567-890)
FormatInternational string `json:"format_international"`
// Phone number in national format (e.g., (234) 567-890)
FormatNational string `json:"format_national"`
// Phone number in RFC 3966 format (e.g., tel:+1-234-567-890)
FormatRfc string `json:"format_rfc"`
// Always false. Contacts are no longer shared or inherited between sender profiles
// — a profile sees only the contacts it owns. Retained so existing v3 clients
// reading is_inherited keep deserializing; it carries no information.
//
// Deprecated: deprecated
IsInherited bool `json:"is_inherited"`
// Whether the contact has opted out of messaging. Single source of truth — opt-out
// is per-contact, not per-channel.
OptOut bool `json:"opt_out"`
// Phone number in original format
PhoneNumber string `json:"phone_number"`
// ISO 3166-1 alpha-2 country code (e.g., US, CA, GB)
RegionCode string `json:"region_code"`
// When the contact was last updated
UpdatedAt time.Time `json:"updated_at" api:"nullable" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
AvailableChannels respjson.Field
CountryCode respjson.Field
CreatedAt respjson.Field
CustomerID respjson.Field
DefaultChannel respjson.Field
FormatE164 respjson.Field
FormatInternational respjson.Field
FormatNational respjson.Field
FormatRfc respjson.Field
IsInherited respjson.Field
OptOut respjson.Field
PhoneNumber respjson.Field
RegionCode respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Contact response for v3 API Uses snake_case for JSON property names
func (ContactResponse) RawJSON ¶ added in v0.9.0
func (r ContactResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ContactResponse) UnmarshalJSON ¶ added in v0.9.0
func (r *ContactResponse) UnmarshalJSON(data []byte) error
type ContactService ¶
type ContactService struct {
Options []option.RequestOption
}
The people you message, and their channel identities.
A contact holds one identity per channel — a phone number, a WhatsApp number — so routing can choose between them for the same person. Opt-out is recorded against the contact and honoured on every send, whichever channel it came through.
`GET /v3/contacts/{id}/message-summary` is the per-contact view of what you have sent and what happened to it.
ContactService contains methods and other services that help with interacting with the Sent 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 NewContactService method instead.
func NewContactService ¶
func NewContactService(opts ...option.RequestOption) (r ContactService)
NewContactService 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 (*ContactService) Delete
deprecated
added in
v0.7.0
func (r *ContactService) Delete(ctx context.Context, id string, params ContactDeleteParams, opts ...option.RequestOption) (err error)
**Deprecated.** Use `PATCH /v3/contacts/{id}` with `{"opt_out": true}` instead, and expect this to be removed in a future release. It still behaves exactly as before, so nothing needs to change today.
Opting a contact out stops every send to them, which is what deleting one was mostly used for — and it keeps the record of who they were and that they asked. A delete discards the consent history along with the contact, which is the part you need if anyone ever asks why you stopped, or why you started again.
Dissociates a contact from the authenticated customer.
Deprecated: deprecated
func (*ContactService) Get ¶ added in v0.7.0
func (r *ContactService) Get(ctx context.Context, id string, query ContactGetParams, opts ...option.RequestOption) (res *APIResponseOfContact, err error)
Retrieves a specific contact by their unique identifier. Returns detailed contact information including phone formats, available channels, and opt-out status.
func (*ContactService) GetMessageSummary ¶ added in v0.30.0
func (r *ContactService) GetMessageSummary(ctx context.Context, contactID string, query ContactGetMessageSummaryParams, opts ...option.RequestOption) (res *APIResponseOfContactMessageSummary, err error)
Returns aggregate message counts, time bounds, channels used, and per-channel success/fail scores (each as a percentage 0-100 of messages on that channel) for one of your contacts. Successful terminal states: SENT/DELIVERED/READ for outbound, RECEIVED for inbound. Fail: FAILED.
func (*ContactService) List ¶
func (r *ContactService) List(ctx context.Context, params ContactListParams, opts ...option.RequestOption) (res *pagination.ContactsPage[ContactResponse], err error)
Retrieves a paginated list of contacts for the authenticated customer. Supports filtering by search term, channel, or phone number.
func (*ContactService) ListAutoPaging ¶ added in v0.35.0
func (r *ContactService) ListAutoPaging(ctx context.Context, params ContactListParams, opts ...option.RequestOption) *pagination.ContactsPageAutoPager[ContactResponse]
Retrieves a paginated list of contacts for the authenticated customer. Supports filtering by search term, channel, or phone number.
func (*ContactService) New ¶ added in v0.7.0
func (r *ContactService) New(ctx context.Context, params ContactNewParams, opts ...option.RequestOption) (res *APIResponseOfContact, err error)
Creates a new contact by phone number and associates it with the authenticated customer.
func (*ContactService) Update ¶ added in v0.7.0
func (r *ContactService) Update(ctx context.Context, id string, params ContactUpdateParams, opts ...option.RequestOption) (res *APIResponseOfContact, err error)
Updates a contact's default channel and/or opt-out status.
type ContactUpdateParams ¶ added in v0.7.0
type ContactUpdateParams struct {
// Default messaging channel: "sms" or "whatsapp"
DefaultChannel param.Opt[string] `json:"default_channel,omitzero"`
// Whether the contact has opted out of messaging. Single source of truth — opt-out
// is per-contact, not per-channel.
OptOut param.Opt[bool] `json:"opt_out,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (ContactUpdateParams) MarshalJSON ¶ added in v0.7.0
func (r ContactUpdateParams) MarshalJSON() (data []byte, err error)
func (*ContactUpdateParams) UnmarshalJSON ¶ added in v0.7.0
func (r *ContactUpdateParams) UnmarshalJSON(data []byte) error
type ConversationListMessagesParams ¶ added in v0.30.0
type ConversationListMessagesParams struct {
Page param.Opt[int64] `query:"page,omitzero" json:"-"`
PageSize param.Opt[int64] `query:"page_size,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (ConversationListMessagesParams) URLQuery ¶ added in v0.30.0
func (r ConversationListMessagesParams) URLQuery() (v url.Values, err error)
URLQuery serializes ConversationListMessagesParams's query parameters as `url.Values`.
type ConversationListParams ¶ added in v0.30.0
type ConversationListParams struct {
Page param.Opt[int64] `query:"page,omitzero" json:"-"`
PageSize param.Opt[int64] `query:"page_size,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (ConversationListParams) URLQuery ¶ added in v0.30.0
func (r ConversationListParams) URLQuery() (v url.Values, err error)
URLQuery serializes ConversationListParams's query parameters as `url.Values`.
type ConversationMessagesList ¶ added in v0.30.0
type ConversationMessagesList struct {
// The messages on this page.
Messages []ConversationMessagesListMessage `json:"messages"`
// Pagination metadata for list responses
Pagination PaginationMeta `json:"pagination"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Messages respjson.Field
Pagination respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A paginated list of messages — used by both conversation read endpoints.
func (ConversationMessagesList) RawJSON ¶ added in v0.30.0
func (r ConversationMessagesList) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationMessagesList) UnmarshalJSON ¶ added in v0.30.0
func (r *ConversationMessagesList) UnmarshalJSON(data []byte) error
type ConversationMessagesListMessage ¶ added in v0.30.0
type ConversationMessagesListMessage struct {
ID string `json:"id" format:"uuid"`
ActiveContactPrice float64 `json:"active_contact_price" api:"nullable" format:"decimal"`
Channel string `json:"channel"`
ContactID string `json:"contact_id" format:"uuid"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
CustomerID string `json:"customer_id" format:"uuid"`
Direction string `json:"direction"`
Events []ConversationMessagesListMessageEvent `json:"events" api:"nullable"`
// Structured message body format for database storage. Preserves channel-specific
// components (header, header media, body, footer, buttons, MMS subject and media).
//
// Persisted as the messageBody jsonb column on Messages. Every write path goes
// through MessageUtils.MessageBodyJsonOptions, which writes nulls, so the envelope
// shape is stable regardless of channel or status. Anything that rebuilds this
// object field by field — the four IMessageBodyStrategy implementations and
// MessageUtils.BuildSegmentBody — has to carry every member, or that member is
// silently dropped on whichever path forgot it.
MessageBody ConversationMessagesListMessageMessageBody `json:"message_body" api:"nullable"`
Phone string `json:"phone"`
PhoneInternational string `json:"phone_international"`
Price float64 `json:"price" api:"nullable" format:"decimal"`
// A human-readable sentence for reason_code, for example "Insufficient balance".
// Omitted whenever reason_code is.
Reason string `json:"reason" api:"nullable"`
// Why the message is at its current status, as a stable platform code such as
// DELIVERY_007, BUSINESS_003 or DELIVERY_003. Present when the current status is
// FAILED, FILTERED or BLOCKED and the lifecycle was loaded; omitted otherwise.
// Switch on this rather than on reason: the code is stable, the wording may be
// improved. It is the platform's classification of the outcome, never a carrier or
// vendor code.
ReasonCode string `json:"reason_code" api:"nullable"`
RegionCode string `json:"region_code"`
Status string `json:"status"`
TemplateCategory string `json:"template_category" api:"nullable"`
TemplateID string `json:"template_id" api:"nullable" format:"uuid"`
TemplateName string `json:"template_name" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ActiveContactPrice respjson.Field
Channel respjson.Field
ContactID respjson.Field
CreatedAt respjson.Field
CustomerID respjson.Field
Direction respjson.Field
Events respjson.Field
MessageBody respjson.Field
Phone respjson.Field
PhoneInternational respjson.Field
Price respjson.Field
Reason respjson.Field
ReasonCode respjson.Field
RegionCode respjson.Field
Status respjson.Field
TemplateCategory respjson.Field
TemplateID respjson.Field
TemplateName respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Message response for v3 API — same shape as v2 with snake_case JSON conventions.
The shape of a message that was sent immediately: it never has a scheduled_at key. A message that is or was held for a later instant is a ScheduledMessageResponse, and the endpoint decides which of the two to answer with. From always returns this type.
func (ConversationMessagesListMessage) RawJSON ¶ added in v0.30.0
func (r ConversationMessagesListMessage) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationMessagesListMessage) UnmarshalJSON ¶ added in v0.30.0
func (r *ConversationMessagesListMessage) UnmarshalJSON(data []byte) error
type ConversationMessagesListMessageEvent ¶ added in v0.30.0
type ConversationMessagesListMessageEvent struct {
Status string `json:"status" api:"required"`
Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"`
Description string `json:"description" api:"nullable"`
// A human-readable sentence for reason_code. Omitted whenever reason_code is.
Reason string `json:"reason" api:"nullable"`
// Why the message reached this status, as a stable platform code such as
// DELIVERY_007. Present on FAILED, FILTERED and BLOCKED events; omitted on every
// status that needs no explanation. Same wire name and vocabulary as on the
// activities list and the webhook.
ReasonCode string `json:"reason_code" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Status respjson.Field
Timestamp respjson.Field
Description respjson.Field
Reason respjson.Field
ReasonCode respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Represents a status change event in a message's lifecycle (v3)
func (ConversationMessagesListMessageEvent) RawJSON ¶ added in v0.30.0
func (r ConversationMessagesListMessageEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationMessagesListMessageEvent) UnmarshalJSON ¶ added in v0.30.0
func (r *ConversationMessagesListMessageEvent) UnmarshalJSON(data []byte) error
type ConversationMessagesListMessageMessageBody ¶ added in v0.30.0
type ConversationMessagesListMessageMessageBody struct {
Buttons []ConversationMessagesListMessageMessageBodyButton `json:"buttons" api:"nullable"`
Content string `json:"content"`
Header string `json:"header" api:"nullable"`
// The media asset that rode a message's header, recorded as sent.
HeaderMedia ConversationMessagesListMessageMessageBodyHeaderMedia `json:"headerMedia" api:"nullable"`
// MMS attachments, as the publicly fetchable URLs handed to the carrier. Null on
// every other channel.
//
// Persisted rather than derived because a resend and a curfew release rebuild the
// send from the stored row — MessageReplayCommandBuilder reads templateId and
// templateVariables and nothing else — so media that lives only on the original
// request would silently turn a replayed MMS into a text message.
Media []ConversationMessagesListMessageMessageBodyMedia `json:"media" api:"nullable"`
// MMS subject line. Null on every other channel.
Subject string `json:"subject" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Buttons respjson.Field
Content respjson.Field
Footer respjson.Field
Header respjson.Field
HeaderMedia respjson.Field
Media respjson.Field
Subject respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Structured message body format for database storage. Preserves channel-specific components (header, header media, body, footer, buttons, MMS subject and media).
Persisted as the messageBody jsonb column on Messages. Every write path goes through MessageUtils.MessageBodyJsonOptions, which writes nulls, so the envelope shape is stable regardless of channel or status. Anything that rebuilds this object field by field — the four IMessageBodyStrategy implementations and MessageUtils.BuildSegmentBody — has to carry every member, or that member is silently dropped on whichever path forgot it.
func (ConversationMessagesListMessageMessageBody) RawJSON ¶ added in v0.30.0
func (r ConversationMessagesListMessageMessageBody) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationMessagesListMessageMessageBody) UnmarshalJSON ¶ added in v0.30.0
func (r *ConversationMessagesListMessageMessageBody) UnmarshalJSON(data []byte) error
type ConversationMessagesListMessageMessageBodyButton ¶ added in v0.30.0
type ConversationMessagesListMessageMessageBodyButton struct {
PostbackData string `json:"postbackData" api:"nullable"`
Text string `json:"text" api:"nullable"`
Type string `json:"type"`
Value string `json:"value"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
PostbackData respjson.Field
Text respjson.Field
Type respjson.Field
Value respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ConversationMessagesListMessageMessageBodyButton) RawJSON ¶ added in v0.30.0
func (r ConversationMessagesListMessageMessageBodyButton) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationMessagesListMessageMessageBodyButton) UnmarshalJSON ¶ added in v0.30.0
func (r *ConversationMessagesListMessageMessageBodyButton) UnmarshalJSON(data []byte) error
type ConversationMessagesListMessageMessageBodyHeaderMedia ¶ added in v0.37.0
type ConversationMessagesListMessageMessageBodyHeaderMedia struct {
// "image", "video" or "document" — taken from the header's media variable.
Type string `json:"type"`
// The https URL the caller supplied for this send. Never the template's stored
// props.sample, which is Meta's expiring header_handle rather than what was
// delivered.
URL string `json:"url"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The media asset that rode a message's header, recorded as sent.
func (ConversationMessagesListMessageMessageBodyHeaderMedia) RawJSON ¶ added in v0.37.0
func (r ConversationMessagesListMessageMessageBodyHeaderMedia) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationMessagesListMessageMessageBodyHeaderMedia) UnmarshalJSON ¶ added in v0.37.0
func (r *ConversationMessagesListMessageMessageBodyHeaderMedia) UnmarshalJSON(data []byte) error
type ConversationMessagesListMessageMessageBodyMedia ¶ added in v0.37.0
type ConversationMessagesListMessageMessageBodyMedia struct {
// One of MmsMediaTypes when the content type is known. Advisory — a reader should
// trust the fetched object's own Content-Type.
MediaType string `json:"mediaType" api:"nullable"`
// Content type as the provider declared it. Null when it declared none.
MimeType string `json:"mimeType" api:"nullable"`
// Size as the provider declared it. Never measured here — nothing downloads the
// file.
SizeBytes int64 `json:"sizeBytes" api:"nullable"`
// Inbound only: the SHA-256 the provider declared alongside the attachment, when
// it declared one. Relayed to the customer so they can verify what they fetch
// matches what the carrier said it sent. It is the only integrity signal available
// on an attachment nobody here has read.
SourceHashSha256 string `json:"sourceHashSha256" api:"nullable"`
// Where the file lives. Outbound: the URL the customer gave us and the carrier
// fetched. Inbound: the URL the carrier hosts it at, relayed unchanged.
URL string `json:"url" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MediaType respjson.Field
MimeType respjson.Field
SizeBytes respjson.Field
SourceHashSha256 respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
One attachment on a message, in either direction — and in both, a URL somebody else hosts.
Outbound: the customer supplied a public URL and we handed it to the carrier. Inbound: the carrier hosts the file and we record where. sent.dm never holds the bytes, so there is no key, no expiry bookkeeping and nothing minted per read — what is stored is what is served.
An inbound link expires on the carrier's own schedule and is unauthenticated. That is the customer's to manage, and it is documented where they will see it rather than only here — a recipient who needs an attachment to outlive that window copies it on receipt.
Storing a presigned URL is the specific mistake this shape still avoids: M260826130000 and M260826140000 exist because RCS assets were stored as signed URLs and went stale. Nothing here is signed.
func (ConversationMessagesListMessageMessageBodyMedia) RawJSON ¶ added in v0.37.0
func (r ConversationMessagesListMessageMessageBodyMedia) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationMessagesListMessageMessageBodyMedia) UnmarshalJSON ¶ added in v0.37.0
func (r *ConversationMessagesListMessageMessageBodyMedia) UnmarshalJSON(data []byte) error
type ConversationService ¶ added in v0.30.0
type ConversationService struct {
Options []option.RequestOption
}
Inbound and outbound messages, grouped by the person they are with.
A conversation is the thread for one contact across every channel — a reply by SMS and one by WhatsApp belong to the same conversation, because they are the same person talking to you.
Read-only. Sending is **Messages**; a reply arrives here and through your webhooks.
ConversationService contains methods and other services that help with interacting with the Sent 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 NewConversationService method instead.
func NewConversationService ¶ added in v0.30.0
func NewConversationService(opts ...option.RequestOption) (r ConversationService)
NewConversationService 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 (*ConversationService) List ¶ added in v0.30.0
func (r *ConversationService) List(ctx context.Context, params ConversationListParams, opts ...option.RequestOption) (res *pagination.ConversationsPage[ConversationMessagesListMessage], err error)
Retrieves a paginated list of the authenticated customer's messages across all conversations, ordered by created date (most recent first).
func (*ConversationService) ListAutoPaging ¶ added in v0.35.0
func (r *ConversationService) ListAutoPaging(ctx context.Context, params ConversationListParams, opts ...option.RequestOption) *pagination.ConversationsPageAutoPager[ConversationMessagesListMessage]
Retrieves a paginated list of the authenticated customer's messages across all conversations, ordered by created date (most recent first).
func (*ConversationService) ListMessages ¶ added in v0.30.0
func (r *ConversationService) ListMessages(ctx context.Context, id string, params ConversationListMessagesParams, opts ...option.RequestOption) (res *pagination.ConversationsPage[ConversationMessagesListMessage], err error)
Retrieves a paginated list of the messages in a single conversation (scoped to the authenticated customer), ordered by created date (most recent first).
func (*ConversationService) ListMessagesAutoPaging ¶ added in v0.35.0
func (r *ConversationService) ListMessagesAutoPaging(ctx context.Context, id string, params ConversationListMessagesParams, opts ...option.RequestOption) *pagination.ConversationsPageAutoPager[ConversationMessagesListMessage]
Retrieves a paginated list of the messages in a single conversation (scoped to the authenticated customer), ordered by created date (most recent first).
type DestinationCountry ¶ added in v0.7.0
type DestinationCountry struct {
ID string `json:"id"`
IsMain bool `json:"isMain"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
IsMain respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (DestinationCountry) RawJSON ¶ added in v0.7.0
func (r DestinationCountry) RawJSON() string
Returns the unmodified JSON received from the API
func (DestinationCountry) ToParam ¶ added in v0.7.0
func (r DestinationCountry) ToParam() DestinationCountryParam
ToParam converts this DestinationCountry to a DestinationCountryParam.
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 DestinationCountryParam.Overrides()
func (*DestinationCountry) UnmarshalJSON ¶ added in v0.7.0
func (r *DestinationCountry) UnmarshalJSON(data []byte) error
type DestinationCountryParam ¶ added in v0.7.0
type DestinationCountryParam struct {
ID param.Opt[string] `json:"id,omitzero"`
IsMain param.Opt[bool] `json:"isMain,omitzero"`
// contains filtered or unexported fields
}
func (DestinationCountryParam) MarshalJSON ¶ added in v0.7.0
func (r DestinationCountryParam) MarshalJSON() (data []byte, err error)
func (*DestinationCountryParam) UnmarshalJSON ¶ added in v0.7.0
func (r *DestinationCountryParam) UnmarshalJSON(data []byte) error
type ErrorDetail ¶ added in v0.12.0
type ErrorDetail struct {
// Machine-readable error code (e.g., "RESOURCE_001")
Code string `json:"code"`
// Additional validation error details (field-level errors)
Details map[string][]string `json:"details" api:"nullable"`
// URL to documentation about this error
DocURL string `json:"doc_url" api:"nullable"`
// Human-readable error message
Message string `json:"message"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Details respjson.Field
DocURL respjson.Field
Message respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Error information
func (ErrorDetail) RawJSON ¶ added in v0.12.0
func (r ErrorDetail) RawJSON() string
Returns the unmodified JSON received from the API
func (*ErrorDetail) UnmarshalJSON ¶ added in v0.12.0
func (r *ErrorDetail) UnmarshalJSON(data []byte) error
type InboundMessageEvent ¶ added in v0.31.0
type InboundMessageEvent struct {
// The specific event within the family, for example message.delivered,
// message.received or contact.opt_out. Absent on events that have no subtype, so
// treat it as optional.
Event string `json:"event" api:"nullable"`
// The event family, for example message, templates or contact. Route on this
// first, then on event for the specific change.
Field string `json:"field"`
// Body of a message.received event. Delivered when a contact messages one of your
// numbers.
Payload InboundMessageEventPayload `json:"payload" api:"nullable"`
// The event-specific body.
RequestID string `json:"request_id" api:"nullable"`
// When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
// time, not the time the underlying change happened. Use the timestamp inside the
// payload for the latter.
Timestamp string `json:"timestamp"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Event respjson.Field
Field respjson.Field
Payload respjson.Field
RequestID respjson.Field
Timestamp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares this shape and varies only in Payload.
func (InboundMessageEvent) RawJSON ¶ added in v0.31.0
func (r InboundMessageEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*InboundMessageEvent) UnmarshalJSON ¶ added in v0.31.0
func (r *InboundMessageEvent) UnmarshalJSON(data []byte) error
type InboundMessageEventPayload ¶ added in v0.31.0
type InboundMessageEventPayload struct {
// The contact's number in E.164 format, meaning the number the message came from.
InboundNumber string `json:"inbound_number" api:"required"`
// When the message was received, in UTC (yyyy-MM-ddTHH:mm:ssZ).
ReceivedAt string `json:"received_at" api:"required"`
// The account the message belongs to.
AccountID string `json:"account_id" format:"uuid"`
// The channel the message arrived on, for example sms or mms.
Channel string `json:"channel"`
// Attachments the contact sent, present only on channels that carry them (mms
// today) and omitted entirely otherwise.
//
// Each url points at the carrier's own copy of the file — sent.dm records where
// the attachment is, not the attachment itself. The link is unauthenticated and
// expires on the carrier's schedule, which differs between them: assume days, not
// months. Download what you need on receipt; re-reading the message through GET
// /v3/messages/{id} returns the same stored link, not a fresh one, so once it
// lapses the entry remains with whatever the carrier declared about the file but
// the file is no longer reachable.
Media []InboundMessageEventPayloadMedia `json:"media" api:"nullable"`
// The inbound message.
MessageID string `json:"message_id" format:"uuid"`
// Your number in E.164 format, meaning the number the message was addressed to.
OutboundNumber string `json:"outbound_number"`
// The message body. Sent as null when the inbound message carried no text, for
// example a media-only message. The field is always present, so read it and check
// for null rather than checking whether the key exists.
Text string `json:"text" api:"nullable"`
// When the message was received, in UTC (yyyy-MM-ddTHH:mm:ssZ). Same value as
// ReceivedAt, kept for envelope consistency with outbound events.
UpdatedAt string `json:"updated_at"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
InboundNumber respjson.Field
ReceivedAt respjson.Field
AccountID respjson.Field
Channel respjson.Field
Media respjson.Field
MessageID respjson.Field
OutboundNumber respjson.Field
Text respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Body of a message.received event. Delivered when a contact messages one of your numbers.
func (InboundMessageEventPayload) RawJSON ¶ added in v0.31.0
func (r InboundMessageEventPayload) RawJSON() string
Returns the unmodified JSON received from the API
func (*InboundMessageEventPayload) UnmarshalJSON ¶ added in v0.31.0
func (r *InboundMessageEventPayload) UnmarshalJSON(data []byte) error
type InboundMessageEventPayloadMedia ¶ added in v0.38.0
type InboundMessageEventPayloadMedia struct {
// SHA-256 of the file as the carrier declared it, when it declares one. Verify
// what you download against this — sent.dm never reads the bytes, so it is the
// only integrity signal available.
HashSha256 string `json:"hash_sha256" api:"nullable"`
// Content type as the carrier reported it, for example image/jpeg.
MimeType string `json:"mime_type" api:"nullable"`
// Size in bytes as the carrier declared it. Absent when it declared none.
SizeBytes int64 `json:"size_bytes" api:"nullable"`
// Where the carrier hosts the attachment.
//
// This link expires and is not authenticated. sent.dm relays it rather than
// copying the file, so how long it stays fetchable is the carrier's decision and
// differs between them — assume days, not months. Anyone holding the URL can fetch
// it until it lapses. Copy the file on receipt if you need it to outlive that
// window; do not store this URL as a permanent reference.
URL string `json:"url" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
HashSha256 respjson.Field
MimeType respjson.Field
SizeBytes respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
One attachment on an inbound message.
func (InboundMessageEventPayloadMedia) RawJSON ¶ added in v0.38.0
func (r InboundMessageEventPayloadMedia) RawJSON() string
Returns the unmodified JSON received from the API
func (*InboundMessageEventPayloadMedia) UnmarshalJSON ¶ added in v0.38.0
func (r *InboundMessageEventPayloadMedia) UnmarshalJSON(data []byte) error
type MeGetParams ¶ added in v0.8.0
type MeGetResponse ¶ added in v0.7.0
type MeGetResponse struct {
// Account response for GET /v3/me endpoint. Returns organization (with profiles),
// user (standalone), or profile (child of an organization) data depending on the
// API key type. Always includes messaging channel configuration.
Data MeGetResponseData `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (MeGetResponse) RawJSON ¶ added in v0.7.0
func (r MeGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MeGetResponse) UnmarshalJSON ¶ added in v0.7.0
func (r *MeGetResponse) UnmarshalJSON(data []byte) error
type MeGetResponseData ¶ added in v0.7.0
type MeGetResponseData struct {
// Customer ID (organization, account, or profile)
ID string `json:"id" format:"uuid"`
// Messaging channel configuration. All three channels are always present. Each
// channel has a "configured" flag; configured channels expose additional details.
Channels MeGetResponseDataChannels `json:"channels"`
// When the account was created
CreatedAt time.Time `json:"created_at" format:"date-time"`
// Account description
Description string `json:"description" api:"nullable"`
// Contact email address
Email string `json:"email" api:"nullable"`
// Whether this account may mark a template for automatic creation on its sender
// profiles. Granted by Sent per account and off by default, so it is what a
// template-create form reads to decide whether to offer the option at all —
// marking a template without it does nothing.
//
// Top-level rather than inside settings, which is written for type: "profile" only
// and so would never carry it to the account type that can act on it.
//
// This is the capability, not the stored flag: a profile reports false whatever
// its own row holds. A sender profile owns no sender profiles, so a template it
// marked would have nothing to be created on and the fan-out would never read the
// flag. The admin GET /customers/{id} reports the stored value instead, because
// that is the one an operator granted.
EnableTemplateAutoCreationForSp bool `json:"enable_template_auto_creation_for_sp"`
// Account icon URL
Icon string `json:"icon" api:"nullable"`
// Account name
Name string `json:"name"`
// Organization ID (only for profile type — the parent organization)
OrganizationID string `json:"organization_id" api:"nullable" format:"uuid"`
// List of profiles (populated for organization type, empty for user and profile
// types)
Profiles []MeGetResponseDataProfile `json:"profiles"`
// The SMS sender this account sends from in the United States, in E.164 form. Null
// when the account has no US SMS sender.
//
// The same value as channels.sms.phone_number, published under both names on
// purpose: sending_phone_number is what this value is already called on GET
// /v3/profiles, so the same key answers the same question whichever of the two
// endpoints you ask. Neither name is preferred over the other and neither is
// deprecated.
//
// The same value, not the same presence: this key is always written, including as
// null, whereas channels.sms.phone_number is left out entirely when there is no
// sender.
SendingPhoneNumber string `json:"sending_phone_number" api:"nullable"`
// The account that holds sending_phone_number in number inventory: normally this
// account itself, and a different account when the number is held elsewhere. Null
// when there is no US sender, or when the sender is not a number drawn from
// inventory — an alphanumeric sender ID or a short code.
SendingPhoneNumberProfileID string `json:"sending_phone_number_profile_id" api:"nullable" format:"uuid"`
// Profile configuration settings
Settings ProfileSettings `json:"settings" api:"nullable"`
// Short name / abbreviation (only for profile type)
ShortName string `json:"short_name" api:"nullable"`
// Profile status (only for profile type): incomplete, pending_review, approved,
// etc.
Status string `json:"status" api:"nullable"`
// Account type: "organization" (has profiles), "user" (no profiles), or "profile"
// (child of an organization)
Type string `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Channels respjson.Field
CreatedAt respjson.Field
Description respjson.Field
Email respjson.Field
EnableTemplateAutoCreationForSp respjson.Field
Icon respjson.Field
Name respjson.Field
OrganizationID respjson.Field
Profiles respjson.Field
SendingPhoneNumber respjson.Field
SendingPhoneNumberProfileID respjson.Field
Settings respjson.Field
ShortName respjson.Field
Status respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Account response for GET /v3/me endpoint. Returns organization (with profiles), user (standalone), or profile (child of an organization) data depending on the API key type. Always includes messaging channel configuration.
func (MeGetResponseData) RawJSON ¶ added in v0.7.0
func (r MeGetResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*MeGetResponseData) UnmarshalJSON ¶ added in v0.7.0
func (r *MeGetResponseData) UnmarshalJSON(data []byte) error
type MeGetResponseDataChannels ¶ added in v0.8.0
type MeGetResponseDataChannels struct {
// RCS channel configuration. When configured, includes the RCS phone number.
Rcs MeGetResponseDataChannelsRcs `json:"rcs"`
// SMS channel configuration. When configured, includes the sending phone number.
SMS MeGetResponseDataChannelsSMS `json:"sms"`
// WhatsApp Business channel configuration. When configured, includes the WhatsApp
// phone number and business name.
Whatsapp MeGetResponseDataChannelsWhatsapp `json:"whatsapp"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Rcs respjson.Field
SMS respjson.Field
Whatsapp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Messaging channel configuration. All three channels are always present. Each channel has a "configured" flag; configured channels expose additional details.
func (MeGetResponseDataChannels) RawJSON ¶ added in v0.8.0
func (r MeGetResponseDataChannels) RawJSON() string
Returns the unmodified JSON received from the API
func (*MeGetResponseDataChannels) UnmarshalJSON ¶ added in v0.8.0
func (r *MeGetResponseDataChannels) UnmarshalJSON(data []byte) error
type MeGetResponseDataChannelsRcs ¶ added in v0.8.0
type MeGetResponseDataChannelsRcs struct {
// Whether RCS is configured for this account
Configured bool `json:"configured"`
// RCS-enabled phone number in E.164 format
PhoneNumber string `json:"phone_number" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Configured respjson.Field
PhoneNumber respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
RCS channel configuration. When configured, includes the RCS phone number.
func (MeGetResponseDataChannelsRcs) RawJSON ¶ added in v0.8.0
func (r MeGetResponseDataChannelsRcs) RawJSON() string
Returns the unmodified JSON received from the API
func (*MeGetResponseDataChannelsRcs) UnmarshalJSON ¶ added in v0.8.0
func (r *MeGetResponseDataChannelsRcs) UnmarshalJSON(data []byte) error
type MeGetResponseDataChannelsSMS ¶ added in v0.8.0
type MeGetResponseDataChannelsSMS struct {
// Whether SMS is configured for this account
Configured bool `json:"configured"`
// Sending phone number in E.164 format
PhoneNumber string `json:"phone_number" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Configured respjson.Field
PhoneNumber respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
SMS channel configuration. When configured, includes the sending phone number.
func (MeGetResponseDataChannelsSMS) RawJSON ¶ added in v0.8.0
func (r MeGetResponseDataChannelsSMS) RawJSON() string
Returns the unmodified JSON received from the API
func (*MeGetResponseDataChannelsSMS) UnmarshalJSON ¶ added in v0.8.0
func (r *MeGetResponseDataChannelsSMS) UnmarshalJSON(data []byte) error
type MeGetResponseDataChannelsWhatsapp ¶ added in v0.8.0
type MeGetResponseDataChannelsWhatsapp struct {
// WhatsApp Business display name
BusinessName string `json:"business_name" api:"nullable"`
// Whether WhatsApp is configured for this account
Configured bool `json:"configured"`
// WhatsApp phone number in E.164 format
PhoneNumber string `json:"phone_number" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
BusinessName respjson.Field
Configured respjson.Field
PhoneNumber respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WhatsApp Business channel configuration. When configured, includes the WhatsApp phone number and business name.
func (MeGetResponseDataChannelsWhatsapp) RawJSON ¶ added in v0.8.0
func (r MeGetResponseDataChannelsWhatsapp) RawJSON() string
Returns the unmodified JSON received from the API
func (*MeGetResponseDataChannelsWhatsapp) UnmarshalJSON ¶ added in v0.8.0
func (r *MeGetResponseDataChannelsWhatsapp) UnmarshalJSON(data []byte) error
type MeGetResponseDataProfile ¶ added in v0.7.0
type MeGetResponseDataProfile struct {
// Profile unique identifier
ID string `json:"id" format:"uuid"`
// When the profile was created
CreatedAt time.Time `json:"created_at" format:"date-time"`
// Profile description
Description string `json:"description" api:"nullable"`
// Profile icon URL
Icon string `json:"icon" api:"nullable"`
// Profile name
Name string `json:"name"`
// User's role in this profile: admin, billing, developer (inherited from
// organization if not explicitly set)
Role string `json:"role" api:"nullable"`
// Profile configuration settings
Settings ProfileSettings `json:"settings"`
// Profile short name (abbreviation)
ShortName string `json:"short_name" api:"nullable"`
// Profile setup status: incomplete, pending_review, approved, rejected
Status string `json:"status" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Description respjson.Field
Icon respjson.Field
Name respjson.Field
Role respjson.Field
Settings respjson.Field
ShortName respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Profile (sender profile) response for v3 API
func (MeGetResponseDataProfile) RawJSON ¶ added in v0.7.0
func (r MeGetResponseDataProfile) RawJSON() string
Returns the unmodified JSON received from the API
func (*MeGetResponseDataProfile) UnmarshalJSON ¶ added in v0.7.0
func (r *MeGetResponseDataProfile) UnmarshalJSON(data []byte) error
type MeService ¶ added in v0.7.0
type MeService struct {
Options []option.RequestOption
}
Who the current key is.
`GET /v3/me` answers with the account the key authenticates as, which is the quickest way to tell a live key from a test one, an organization key from a sender profile's, and to confirm `x-profile-id` resolved to the profile you meant.
MeService contains methods and other services that help with interacting with the Sent 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 NewMeService method instead.
func NewMeService ¶ added in v0.7.0
func NewMeService(opts ...option.RequestOption) (r MeService)
NewMeService 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 (*MeService) Get ¶ added in v0.7.0
func (r *MeService) Get(ctx context.Context, query MeGetParams, opts ...option.RequestOption) (res *MeGetResponse, err error)
Returns the account associated with the provided API key. The response includes account identity, contact information, messaging channel configuration, and — depending on the account type — either a list of child profiles or the profile's own settings.
**Account types:**
- `organization` — Has child profiles. The `profiles` array is populated.
- `user` — Standalone account with no profiles.
- `profile` — Child of an organization. Includes `organization_id`, `short_name`, `status`, and `settings`.
**Channels:** The `channels` object always includes `sms`, `whatsapp`, and `rcs`. Each channel has a `configured` boolean. Configured channels expose additional details such as `phone_number`.
**Sending number:** `sending_phone_number` is the account's US SMS sender. It is intentionally the same value as `channels.sms.phone_number` — the two are kept in step, and it is published under both names because `sending_phone_number` is what this value is called on `GET /v3/profiles`. Read either. One difference: `sending_phone_number` is always present, including as `null`, while `channels.sms.phone_number` is omitted when there is no sender.
`sending_phone_number_profile_id` names the account that holds that number in inventory — normally this account, and a different one where a number is shared. Both are `null` when the account has no US SMS sender.
**Template auto-creation:** `enable_template_auto_creation_for_sp` reports whether this account may mark a template for automatic creation on its sender profiles. It is granted by Sent and off by default. A `profile` reports `false`, having no sender profiles of its own to create anything on.
type MessageEvent ¶ added in v0.31.0
type MessageEvent struct {
// The specific event within the family, for example message.delivered,
// message.received or contact.opt_out. Absent on events that have no subtype, so
// treat it as optional.
Event string `json:"event" api:"nullable"`
// The event family, for example message, templates or contact. Route on this
// first, then on event for the specific change.
Field string `json:"field"`
// Body of an outbound message lifecycle event. Delivered once per status change,
// so a single message produces several of these as it moves toward a terminal
// status.
Payload MessageEventPayload `json:"payload" api:"nullable"`
// The event-specific body.
RequestID string `json:"request_id" api:"nullable"`
// When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
// time, not the time the underlying change happened. Use the timestamp inside the
// payload for the latter.
Timestamp string `json:"timestamp"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Event respjson.Field
Field respjson.Field
Payload respjson.Field
RequestID respjson.Field
Timestamp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares this shape and varies only in Payload.
func (MessageEvent) RawJSON ¶ added in v0.31.0
func (r MessageEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageEvent) UnmarshalJSON ¶ added in v0.31.0
func (r *MessageEvent) UnmarshalJSON(data []byte) error
type MessageEventPayload ¶ added in v0.31.0
type MessageEventPayload struct {
// The status the message just reached, for example SENT, DELIVERED, or FAILED.
// Sent means dispatched and delivered means confirmed, so treat them as distinct
// outcomes.
MessageStatus string `json:"message_status" api:"required"`
// The account the message belongs to.
AccountID string `json:"account_id" format:"uuid"`
// The agent attributed to the send, when the send was attributed to one.
AgentID string `json:"agent_id" api:"nullable"`
// The rendered message body, as plain text. Sent as null when we aren't asserting
// a body for this event. The field is always present, so read it and check for
// null rather than checking whether the key exists. Truncated to 3072 characters.
Body string `json:"body" api:"nullable"`
// The channel the message went out on, for example sms or whatsapp. A message that
// falls back to another channel reports the channel actually used.
Channel string `json:"channel"`
// The message this event describes. Stable across every event in the message's
// lifecycle, so use it to correlate them.
MessageID string `json:"message_id" format:"uuid"`
// The recipient's number in E.164 format.
OutboundNumber string `json:"outbound_number"`
// A human-readable sentence for ReasonCode, for example "The recipient is not
// registered on this channel". Omitted whenever reason_code is.
Reason string `json:"reason" api:"nullable"`
// Why the message reached this status, as a stable platform code such as
// DELIVERY_007 or BUSINESS_003. Present on message.failed, message.filtered and
// message.blocked; omitted on every status that needs no explanation. Switch on
// this rather than on Reason: the code is stable, the wording may be improved. It
// is the platform's classification of the outcome and never a carrier or vendor
// code.
ReasonCode string `json:"reason_code" api:"nullable"`
// message.scheduled only: why the message is held, either because you scheduled it
// or because the recipient is inside a protected quiet-hours window. Omitted on
// every other event.
ScheduleReason string `json:"schedule_reason" api:"nullable"`
// message.scheduled only: when the held message will be released for delivery, in
// UTC (yyyy-MM-ddTHH:mm:ssZ). Omitted on every other event.
ScheduledAt string `json:"scheduled_at" api:"nullable"`
// The template the message was sent from, when it was sent from one.
TemplateID string `json:"template_id" api:"nullable" format:"uuid"`
// Name of the template the message was sent from. Omitted when the message wasn't
// template-based.
TemplateName string `json:"template_name" api:"nullable"`
// When the message reached MessageStatus, in UTC (yyyy-MM-ddTHH:mm:ssZ).
UpdatedAt string `json:"updated_at"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MessageStatus respjson.Field
AccountID respjson.Field
AgentID respjson.Field
Body respjson.Field
Channel respjson.Field
MessageID respjson.Field
OutboundNumber respjson.Field
Reason respjson.Field
ReasonCode respjson.Field
ScheduleReason respjson.Field
ScheduledAt respjson.Field
TemplateID respjson.Field
TemplateName respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Body of an outbound message lifecycle event. Delivered once per status change, so a single message produces several of these as it moves toward a terminal status.
func (MessageEventPayload) RawJSON ¶ added in v0.31.0
func (r MessageEventPayload) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageEventPayload) UnmarshalJSON ¶ added in v0.31.0
func (r *MessageEventPayload) UnmarshalJSON(data []byte) error
type MessageGetActivitiesParams ¶ added in v0.8.0
type MessageGetActivitiesResponse ¶ added in v0.7.0
type MessageGetActivitiesResponse struct {
// Response for GET /messages/{id}/activities
Data MessageGetActivitiesResponseData `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (MessageGetActivitiesResponse) RawJSON ¶ added in v0.7.0
func (r MessageGetActivitiesResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageGetActivitiesResponse) UnmarshalJSON ¶ added in v0.7.0
func (r *MessageGetActivitiesResponse) UnmarshalJSON(data []byte) error
type MessageGetActivitiesResponseData ¶ added in v0.7.0
type MessageGetActivitiesResponseData struct {
// List of activity events ordered by most recent first
Activities []MessageGetActivitiesResponseDataActivity `json:"activities"`
// The message ID these activities belong to
MessageID string `json:"message_id" format:"uuid"`
// Pagination metadata for list responses
Pagination PaginationMeta `json:"pagination"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Activities respjson.Field
MessageID respjson.Field
Pagination respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Response for GET /messages/{id}/activities
func (MessageGetActivitiesResponseData) RawJSON ¶ added in v0.7.0
func (r MessageGetActivitiesResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageGetActivitiesResponseData) UnmarshalJSON ¶ added in v0.7.0
func (r *MessageGetActivitiesResponseData) UnmarshalJSON(data []byte) error
type MessageGetActivitiesResponseDataActivity ¶ added in v0.7.0
type MessageGetActivitiesResponseDataActivity struct {
// Active contact markup applied on top of the channel cost, formatted to 4 decimal
// places.
ActiveContactPrice string `json:"active_contact_price" api:"nullable"`
// Human-readable description of the activity
Description string `json:"description"`
// Sender phone number for this activity (the customer's sending number for
// outbound, the external sender for inbound). Null when not reported by the
// provider.
From string `json:"from" api:"nullable"`
// Channel cost for this activity (e.g., SMS/WhatsApp provider cost), formatted to
// 4 decimal places.
Price string `json:"price" api:"nullable"`
// A human-readable sentence for reason_code, for example "The recipient is not
// registered on this channel" Omitted whenever reason_code is.
Reason string `json:"reason" api:"nullable"`
// Why the message reached this status, as a stable platform code such as
// DELIVERY_007 or BUSINESS_003. Present on FAILED, FILTERED and BLOCKED
// activities; omitted on every status that needs no explanation. Switch on this
// rather than on reason: the code is stable, the wording may be improved. Same
// wire name and vocabulary as on the message and the webhook.
ReasonCode string `json:"reason_code" api:"nullable"`
// SCHEDULED activities only: when the held message will be released for delivery,
// in UTC. Same wire name as on the send response, the message and the webhook.
// Omitted on every other activity. A message that quiet hours moved at release has
// two SCHEDULED entries, each carrying the instant as it stood at that moment.
ScheduledAt time.Time `json:"scheduled_at" api:"nullable" format:"date-time"`
// Activity status. Outbound: QUEUED, PROCESSED, ROUTED, SCHEDULED, SENT,
// DELIVERED, READ, FAILED. Inbound (from contact): RECEIVED (terminal).
Status string `json:"status"`
// When this activity occurred
Timestamp time.Time `json:"timestamp" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ActiveContactPrice respjson.Field
Description respjson.Field
From respjson.Field
Price respjson.Field
Reason respjson.Field
ReasonCode respjson.Field
ScheduledAt respjson.Field
Status respjson.Field
Timestamp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A single message activity event for v3 API.
The activity list mixes statuses, so unlike a message it is one shape rather than two: a SCHEDULED entry carries scheduled_at, and every other entry has no such key.
func (MessageGetActivitiesResponseDataActivity) RawJSON ¶ added in v0.7.0
func (r MessageGetActivitiesResponseDataActivity) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageGetActivitiesResponseDataActivity) UnmarshalJSON ¶ added in v0.7.0
func (r *MessageGetActivitiesResponseDataActivity) UnmarshalJSON(data []byte) error
type MessageGetStatusParams ¶ added in v0.8.0
type MessageGetStatusResponse ¶ added in v0.7.0
type MessageGetStatusResponse struct {
// Message response for v3 API — same shape as v2 with snake_case JSON conventions.
//
// The shape of a message that was sent immediately: it never has a scheduled_at
// key. A message that is or was held for a later instant is a
// ScheduledMessageResponse, and the endpoint decides which of the two to answer
// with. From always returns this type.
Data MessageGetStatusResponseData `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (MessageGetStatusResponse) RawJSON ¶ added in v0.7.0
func (r MessageGetStatusResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageGetStatusResponse) UnmarshalJSON ¶ added in v0.7.0
func (r *MessageGetStatusResponse) UnmarshalJSON(data []byte) error
type MessageGetStatusResponseData ¶ added in v0.7.0
type MessageGetStatusResponseData struct {
ID string `json:"id" format:"uuid"`
ActiveContactPrice float64 `json:"active_contact_price" api:"nullable" format:"decimal"`
Channel string `json:"channel"`
ContactID string `json:"contact_id" format:"uuid"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
CustomerID string `json:"customer_id" format:"uuid"`
Direction string `json:"direction"`
Events []MessageGetStatusResponseDataEvent `json:"events" api:"nullable"`
// Structured message body format for database storage. Preserves channel-specific
// components (header, header media, body, footer, buttons, MMS subject and media).
//
// Persisted as the messageBody jsonb column on Messages. Every write path goes
// through MessageUtils.MessageBodyJsonOptions, which writes nulls, so the envelope
// shape is stable regardless of channel or status. Anything that rebuilds this
// object field by field — the four IMessageBodyStrategy implementations and
// MessageUtils.BuildSegmentBody — has to carry every member, or that member is
// silently dropped on whichever path forgot it.
MessageBody MessageGetStatusResponseDataMessageBody `json:"message_body" api:"nullable"`
Phone string `json:"phone"`
PhoneInternational string `json:"phone_international"`
Price float64 `json:"price" api:"nullable" format:"decimal"`
// A human-readable sentence for reason_code, for example "Insufficient balance".
// Omitted whenever reason_code is.
Reason string `json:"reason" api:"nullable"`
// Why the message is at its current status, as a stable platform code such as
// DELIVERY_007, BUSINESS_003 or DELIVERY_003. Present when the current status is
// FAILED, FILTERED or BLOCKED and the lifecycle was loaded; omitted otherwise.
// Switch on this rather than on reason: the code is stable, the wording may be
// improved. It is the platform's classification of the outcome, never a carrier or
// vendor code.
ReasonCode string `json:"reason_code" api:"nullable"`
RegionCode string `json:"region_code"`
Status string `json:"status"`
TemplateCategory string `json:"template_category" api:"nullable"`
TemplateID string `json:"template_id" api:"nullable" format:"uuid"`
TemplateName string `json:"template_name" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ActiveContactPrice respjson.Field
Channel respjson.Field
ContactID respjson.Field
CreatedAt respjson.Field
CustomerID respjson.Field
Direction respjson.Field
Events respjson.Field
MessageBody respjson.Field
Phone respjson.Field
PhoneInternational respjson.Field
Price respjson.Field
Reason respjson.Field
ReasonCode respjson.Field
RegionCode respjson.Field
Status respjson.Field
TemplateCategory respjson.Field
TemplateID respjson.Field
TemplateName respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Message response for v3 API — same shape as v2 with snake_case JSON conventions.
The shape of a message that was sent immediately: it never has a scheduled_at key. A message that is or was held for a later instant is a ScheduledMessageResponse, and the endpoint decides which of the two to answer with. From always returns this type.
func (MessageGetStatusResponseData) RawJSON ¶ added in v0.7.0
func (r MessageGetStatusResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageGetStatusResponseData) UnmarshalJSON ¶ added in v0.7.0
func (r *MessageGetStatusResponseData) UnmarshalJSON(data []byte) error
type MessageGetStatusResponseDataEvent ¶ added in v0.7.0
type MessageGetStatusResponseDataEvent struct {
Status string `json:"status" api:"required"`
Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"`
Description string `json:"description" api:"nullable"`
// A human-readable sentence for reason_code. Omitted whenever reason_code is.
Reason string `json:"reason" api:"nullable"`
// Why the message reached this status, as a stable platform code such as
// DELIVERY_007. Present on FAILED, FILTERED and BLOCKED events; omitted on every
// status that needs no explanation. Same wire name and vocabulary as on the
// activities list and the webhook.
ReasonCode string `json:"reason_code" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Status respjson.Field
Timestamp respjson.Field
Description respjson.Field
Reason respjson.Field
ReasonCode respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Represents a status change event in a message's lifecycle (v3)
func (MessageGetStatusResponseDataEvent) RawJSON ¶ added in v0.7.0
func (r MessageGetStatusResponseDataEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageGetStatusResponseDataEvent) UnmarshalJSON ¶ added in v0.7.0
func (r *MessageGetStatusResponseDataEvent) UnmarshalJSON(data []byte) error
type MessageGetStatusResponseDataMessageBody ¶ added in v0.7.0
type MessageGetStatusResponseDataMessageBody struct {
Buttons []MessageGetStatusResponseDataMessageBodyButton `json:"buttons" api:"nullable"`
Content string `json:"content"`
Header string `json:"header" api:"nullable"`
// The media asset that rode a message's header, recorded as sent.
HeaderMedia MessageGetStatusResponseDataMessageBodyHeaderMedia `json:"headerMedia" api:"nullable"`
// MMS attachments, as the publicly fetchable URLs handed to the carrier. Null on
// every other channel.
//
// Persisted rather than derived because a resend and a curfew release rebuild the
// send from the stored row — MessageReplayCommandBuilder reads templateId and
// templateVariables and nothing else — so media that lives only on the original
// request would silently turn a replayed MMS into a text message.
Media []MessageGetStatusResponseDataMessageBodyMedia `json:"media" api:"nullable"`
// MMS subject line. Null on every other channel.
Subject string `json:"subject" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Buttons respjson.Field
Content respjson.Field
Footer respjson.Field
Header respjson.Field
HeaderMedia respjson.Field
Media respjson.Field
Subject respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Structured message body format for database storage. Preserves channel-specific components (header, header media, body, footer, buttons, MMS subject and media).
Persisted as the messageBody jsonb column on Messages. Every write path goes through MessageUtils.MessageBodyJsonOptions, which writes nulls, so the envelope shape is stable regardless of channel or status. Anything that rebuilds this object field by field — the four IMessageBodyStrategy implementations and MessageUtils.BuildSegmentBody — has to carry every member, or that member is silently dropped on whichever path forgot it.
func (MessageGetStatusResponseDataMessageBody) RawJSON ¶ added in v0.7.0
func (r MessageGetStatusResponseDataMessageBody) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageGetStatusResponseDataMessageBody) UnmarshalJSON ¶ added in v0.7.0
func (r *MessageGetStatusResponseDataMessageBody) UnmarshalJSON(data []byte) error
type MessageGetStatusResponseDataMessageBodyButton ¶ added in v0.7.0
type MessageGetStatusResponseDataMessageBodyButton struct {
PostbackData string `json:"postbackData" api:"nullable"`
Text string `json:"text" api:"nullable"`
Type string `json:"type"`
Value string `json:"value"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
PostbackData respjson.Field
Text respjson.Field
Type respjson.Field
Value respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageGetStatusResponseDataMessageBodyButton) RawJSON ¶ added in v0.7.0
func (r MessageGetStatusResponseDataMessageBodyButton) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageGetStatusResponseDataMessageBodyButton) UnmarshalJSON ¶ added in v0.7.0
func (r *MessageGetStatusResponseDataMessageBodyButton) UnmarshalJSON(data []byte) error
type MessageGetStatusResponseDataMessageBodyHeaderMedia ¶ added in v0.37.0
type MessageGetStatusResponseDataMessageBodyHeaderMedia struct {
// "image", "video" or "document" — taken from the header's media variable.
Type string `json:"type"`
// The https URL the caller supplied for this send. Never the template's stored
// props.sample, which is Meta's expiring header_handle rather than what was
// delivered.
URL string `json:"url"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The media asset that rode a message's header, recorded as sent.
func (MessageGetStatusResponseDataMessageBodyHeaderMedia) RawJSON ¶ added in v0.37.0
func (r MessageGetStatusResponseDataMessageBodyHeaderMedia) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageGetStatusResponseDataMessageBodyHeaderMedia) UnmarshalJSON ¶ added in v0.37.0
func (r *MessageGetStatusResponseDataMessageBodyHeaderMedia) UnmarshalJSON(data []byte) error
type MessageGetStatusResponseDataMessageBodyMedia ¶ added in v0.37.0
type MessageGetStatusResponseDataMessageBodyMedia struct {
// One of MmsMediaTypes when the content type is known. Advisory — a reader should
// trust the fetched object's own Content-Type.
MediaType string `json:"mediaType" api:"nullable"`
// Content type as the provider declared it. Null when it declared none.
MimeType string `json:"mimeType" api:"nullable"`
// Size as the provider declared it. Never measured here — nothing downloads the
// file.
SizeBytes int64 `json:"sizeBytes" api:"nullable"`
// Inbound only: the SHA-256 the provider declared alongside the attachment, when
// it declared one. Relayed to the customer so they can verify what they fetch
// matches what the carrier said it sent. It is the only integrity signal available
// on an attachment nobody here has read.
SourceHashSha256 string `json:"sourceHashSha256" api:"nullable"`
// Where the file lives. Outbound: the URL the customer gave us and the carrier
// fetched. Inbound: the URL the carrier hosts it at, relayed unchanged.
URL string `json:"url" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MediaType respjson.Field
MimeType respjson.Field
SizeBytes respjson.Field
SourceHashSha256 respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
One attachment on a message, in either direction — and in both, a URL somebody else hosts.
Outbound: the customer supplied a public URL and we handed it to the carrier. Inbound: the carrier hosts the file and we record where. sent.dm never holds the bytes, so there is no key, no expiry bookkeeping and nothing minted per read — what is stored is what is served.
An inbound link expires on the carrier's own schedule and is unauthenticated. That is the customer's to manage, and it is documented where they will see it rather than only here — a recipient who needs an attachment to outlive that window copies it on receipt.
Storing a presigned URL is the specific mistake this shape still avoids: M260826130000 and M260826140000 exist because RCS assets were stored as signed URLs and went stale. Nothing here is signed.
func (MessageGetStatusResponseDataMessageBodyMedia) RawJSON ¶ added in v0.37.0
func (r MessageGetStatusResponseDataMessageBodyMedia) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageGetStatusResponseDataMessageBodyMedia) UnmarshalJSON ¶ added in v0.37.0
func (r *MessageGetStatusResponseDataMessageBodyMedia) UnmarshalJSON(data []byte) error
type MessageSendParams ¶ added in v0.7.0
type MessageSendParams struct {
// Optional future send time as an ISO-8601 timestamp with an explicit UTC offset,
// e.g. 2026-10-01T09:00:00+02:00 or 2026-10-01T07:00:00Z. A value without an
// offset is rejected (400) rather than read in the server's zone. The offset only
// fixes the instant: it is stored and echoed in UTC as scheduled_at. Omit to send
// now. Must be at least one minute ahead and at most 30 days ahead. Accepted
// messages report SCHEDULED and are released for delivery at this time. Quiet
// hours, balance and template approval are evaluated at release, not at
// acceptance: a message whose time falls inside a recipient's protected
// quiet-hours window is moved to the next allowed time and a second
// message.scheduled webhook reports the new scheduled_at.
ScheduledAt param.Opt[time.Time] `json:"scheduled_at,omitzero" format:"date-time"`
// Subject line for this send, overriding the template's. MMS only; ignored on
// every other channel. Most handsets render it above the body, some ignore it
// entirely.
Subject param.Opt[string] `json:"subject,omitzero"`
// Plain-text (free-form) message body. Provide either Template or this.
Text param.Opt[string] `json:"text,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// Channels to broadcast on, e.g. ["whatsapp", "sms"]. Each channel produces a
// separate message per recipient. "sent" = auto-detect. Defaults to ["sent"]
// (auto-detect) if omitted.
Channel []string `json:"channel,omitzero"`
// Attachments for this send, as publicly fetchable https URLs. Used by the MMS
// channel and ignored by every other one.
//
// Supplying these replaces the media on the template's mms body rather than adding
// to it, so a template can hold a default creative while a caller still sends
// something recipient-specific.
//
// Their presence is also what makes a message eligible for MMS on an auto-detect
// send: a message with nothing attached is delivered as SMS, because an MMS with
// no media is a more expensive text message.
//
// The recipient's carrier fetches each URL after the send is accepted, so it must
// stay publicly reachable — a link that expires, or one behind auth, arrives as a
// failed message.
MediaURLs []string `json:"media_urls,omitzero"`
// SDK-style template reference: resolve by ID or by name, with optional
// parameters.
Template MessageSendParamsTemplate `json:"template,omitzero"`
// List of recipient phone numbers in E.164 format (multi-recipient fan-out)
To []string `json:"to,omitzero"`
// contains filtered or unexported fields
}
func (MessageSendParams) MarshalJSON ¶ added in v0.7.0
func (r MessageSendParams) MarshalJSON() (data []byte, err error)
func (*MessageSendParams) UnmarshalJSON ¶ added in v0.7.0
func (r *MessageSendParams) UnmarshalJSON(data []byte) error
type MessageSendParamsTemplate ¶ added in v0.7.0
type MessageSendParamsTemplate struct {
// Template ID (mutually exclusive with name)
ID param.Opt[string] `json:"id,omitzero" format:"uuid"`
// Template name (mutually exclusive with id)
Name param.Opt[string] `json:"name,omitzero"`
// Template variable parameters for personalization, keyed by variable name.
//
// Every variable the template declares is required; GET /v3/templates/{id} lists
// them. Supplying a key the template does not declare is ignored.
//
// Media headers. A template whose header is an image (designed in WhatsApp Manager
// and imported into Sent) declares a reserved header_image key. Its value is a
// publicly reachable https URL that Meta fetches at send time — Sent does not host
// the asset, and the sample approved with the template is not reused. The key is
// derived from the header's media type, so header_video and header_document follow
// the same shape when those formats ship.
//
// "parameters": { "header_image": "https://cdn.example.com/banner.jpg", "name":
// "John Doe" }
Parameters map[string]string `json:"parameters,omitzero"`
// contains filtered or unexported fields
}
SDK-style template reference: resolve by ID or by name, with optional parameters.
func (MessageSendParamsTemplate) MarshalJSON ¶ added in v0.7.0
func (r MessageSendParamsTemplate) MarshalJSON() (data []byte, err error)
func (*MessageSendParamsTemplate) UnmarshalJSON ¶ added in v0.7.0
func (r *MessageSendParamsTemplate) UnmarshalJSON(data []byte) error
type MessageSendResponse ¶ added in v0.7.0
type MessageSendResponse struct {
// The result of a multi-recipient send.
//
// Declared here rather than in the service layer. POST /v3/messages used to
// publish MessageSendResult — a type in Common.Services.Messaging.Contracts — so
// the public contract was whatever the send service happened to return, and
// changing that service for an internal reason changed the API. The service keeps
// its result; this is what a caller sees, and the mapping between them is a
// decision the endpoint makes.
//
// The shape of an immediate send: it never has a scheduled_at key. A send that
// carried scheduled_at is a ScheduledSendMessageResponse, and the endpoint decides
// which of the two to answer with. From always returns this type.
Data MessageSendResponseData `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (MessageSendResponse) RawJSON ¶ added in v0.7.0
func (r MessageSendResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageSendResponse) UnmarshalJSON ¶ added in v0.7.0
func (r *MessageSendResponse) UnmarshalJSON(data []byte) error
type MessageSendResponseData ¶ added in v0.7.0
type MessageSendResponseData struct {
Recipients []MessageSendResponseDataRecipient `json:"recipients"`
// QUEUED: the batch is accepted. A request that carried scheduled_at is QUEUED
// here too; each message moves to SCHEDULED once it is held, as GET
// /v3/messages/{id} and the message.scheduled webhook report.
Status string `json:"status"`
TemplateID string `json:"template_id" format:"uuid"`
TemplateName string `json:"template_name"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Recipients respjson.Field
Status respjson.Field
TemplateID respjson.Field
TemplateName respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The result of a multi-recipient send.
Declared here rather than in the service layer. POST /v3/messages used to publish MessageSendResult — a type in Common.Services.Messaging.Contracts — so the public contract was whatever the send service happened to return, and changing that service for an internal reason changed the API. The service keeps its result; this is what a caller sees, and the mapping between them is a decision the endpoint makes.
The shape of an immediate send: it never has a scheduled_at key. A send that carried scheduled_at is a ScheduledSendMessageResponse, and the endpoint decides which of the two to answer with. From always returns this type.
func (MessageSendResponseData) RawJSON ¶ added in v0.7.0
func (r MessageSendResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageSendResponseData) UnmarshalJSON ¶ added in v0.7.0
func (r *MessageSendResponseData) UnmarshalJSON(data []byte) error
type MessageSendResponseDataRecipient ¶ added in v0.7.0
type MessageSendResponseDataRecipient struct {
// Resolved template body for this recipient's channel, or null when the channel is
// auto-detected.
Body string `json:"body" api:"nullable"`
// Channel this message will be sent on — sms, whatsapp — or null to auto-detect.
Channel string `json:"channel" api:"nullable"`
// Identifier for tracking this recipient's message.
MessageID string `json:"message_id" format:"uuid"`
// Phone number in E.164 format.
To string `json:"to"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Body respjson.Field
Channel respjson.Field
MessageID respjson.Field
To respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
What one recipient of a send got, as the API reports it.
func (MessageSendResponseDataRecipient) RawJSON ¶ added in v0.7.0
func (r MessageSendResponseDataRecipient) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageSendResponseDataRecipient) UnmarshalJSON ¶ added in v0.7.0
func (r *MessageSendResponseDataRecipient) UnmarshalJSON(data []byte) error
type MessageService ¶
type MessageService struct {
Options []option.RequestOption
}
Send a message and follow what happened to it.
One endpoint sends on any channel: pass `channel: "sent"` and we pick between SMS, WhatsApp and RCS per recipient using your routing rules, or name a channel to pin it. A send is accepted asynchronously — `POST /v3/messages` returns an id, and delivery is reported through `GET /v3/messages/{id}`, its activities, or a webhook.
**A message needs a sender.** What you can send, where, and at what cost is decided by the markets under **Channels** — so a recipient in a country you hold no sender for is refused here rather than queued.
**A message can be resent on its id.** `POST /v3/messages/{id}/resend` puts a finished message — typically one BLOCKED for insufficient balance — back through the send pipeline. It is a new attempt, not a free retry: every policy runs again, the message is billed again, and its status webhooks fire again. A FILTERED message is never resendable.
MessageService contains methods and other services that help with interacting with the Sent 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) GetActivities ¶ added in v0.7.0
func (r *MessageService) GetActivities(ctx context.Context, id string, query MessageGetActivitiesParams, opts ...option.RequestOption) (res *MessageGetActivitiesResponse, err error)
Retrieves the activity log for a specific message. Activities track the message lifecycle including acceptance, processing, sending, delivery, and any errors. A SCHEDULED entry carries scheduled_at, the release instant in UTC as it stood at that moment. Other entries have no scheduled_at key.
func (*MessageService) GetStatus ¶ added in v0.7.0
func (r *MessageService) GetStatus(ctx context.Context, id string, query MessageGetStatusParams, opts ...option.RequestOption) (res *MessageGetStatusResponse, err error)
Retrieves the current status and details of a message by ID. Includes delivery status, timestamps, and error information if applicable. A message that is or was held for a later time (a send you scheduled with scheduled_at, or a quiet-hours hold) is returned as a ScheduledMessageResponse: the same fields plus scheduled_at, the release instant in UTC. A message sent immediately has no scheduled_at key.
func (*MessageService) Send ¶ added in v0.7.0
func (r *MessageService) Send(ctx context.Context, params MessageSendParams, opts ...option.RequestOption) (res *MessageSendResponse, err error)
Sends a message to one or more recipients using a template. Supports multi-channel broadcast — when multiple channels are specified (e.g. ["sms", "whatsapp"]), a separate message is created for each (recipient, channel) pair. Returns immediately with per-recipient message IDs for async tracking via webhooks or the GET /messages/{id} endpoint. Sends gated before any delivery attempt do not reject the request — an account-level precondition such as insufficient balance, a template not approved for sending, or free-form content with no open conversation with the contact. The send is accepted with 202 and the affected messages are reported as BLOCKED on GET /messages/{id} and the message.blocked webhook. To send later, set scheduled_at (ISO-8601 with an explicit UTC offset; a value without one is rejected) between 1 minute and 30 days ahead: the response is a ScheduledSendMessageResponse (the same fields plus scheduled_at; status is still QUEUED), each message then moves to SCHEDULED, is held and released at that time (within a few minutes), and a message.scheduled webhook fires once it is held. Balance and template approval are evaluated at release, not at acceptance. Quiet hours are not checked when the request is accepted: if the time falls inside a legally protected quiet-hours window for a recipient, that message is moved to the next allowed time at release and a second message.scheduled webhook reports the new scheduled_at. An account may hold at most 1,000,000 scheduled messages at once (429 LIMIT_001).
type MessagingUseCaseUs ¶ added in v0.7.0
type MessagingUseCaseUs string
const ( MessagingUseCaseUsMarketing MessagingUseCaseUs = "MARKETING" MessagingUseCaseUsAccountNotification MessagingUseCaseUs = "ACCOUNT_NOTIFICATION" MessagingUseCaseUsCustomerCare MessagingUseCaseUs = "CUSTOMER_CARE" MessagingUseCaseUsFraudAlert MessagingUseCaseUs = "FRAUD_ALERT" MessagingUseCaseUsTwoFa MessagingUseCaseUs = "TWO_FA" MessagingUseCaseUsDeliveryNotification MessagingUseCaseUs = "DELIVERY_NOTIFICATION" MessagingUseCaseUsSecurityAlert MessagingUseCaseUs = "SECURITY_ALERT" MessagingUseCaseUsM2M MessagingUseCaseUs = "M2M" MessagingUseCaseUsMixed MessagingUseCaseUs = "MIXED" MessagingUseCaseUsHigherEducation MessagingUseCaseUs = "HIGHER_EDUCATION" MessagingUseCaseUsPollingVoting MessagingUseCaseUs = "POLLING_VOTING" MessagingUseCaseUsPublicServiceAnnouncement MessagingUseCaseUs = "PUBLIC_SERVICE_ANNOUNCEMENT" MessagingUseCaseUsLowVolume MessagingUseCaseUs = "LOW_VOLUME" )
type MutationRequestParam ¶ added in v0.7.0
type MutationRequestParam struct {
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
// contains filtered or unexported fields
}
func (MutationRequestParam) MarshalJSON ¶ added in v0.7.0
func (r MutationRequestParam) MarshalJSON() (data []byte, err error)
func (*MutationRequestParam) UnmarshalJSON ¶ added in v0.7.0
func (r *MutationRequestParam) UnmarshalJSON(data []byte) error
type NumberLookupParams ¶ added in v0.9.0
type NumberLookupResponse ¶ added in v0.9.0
type NumberLookupResponse struct {
// The response data (null if error)
Data NumberLookupResponseData `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (NumberLookupResponse) RawJSON ¶ added in v0.9.0
func (r NumberLookupResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*NumberLookupResponse) UnmarshalJSON ¶ added in v0.9.0
func (r *NumberLookupResponse) UnmarshalJSON(data []byte) error
type NumberLookupResponseData ¶ added in v0.9.0
type NumberLookupResponseData struct {
CarrierName string `json:"carrier_name" api:"nullable"`
CountryCode string `json:"country_code" api:"nullable"`
IsPorted bool `json:"is_ported" api:"nullable"`
IsValid bool `json:"is_valid"`
IsVoip bool `json:"is_voip" api:"nullable"`
LineType string `json:"line_type" api:"nullable"`
MobileCountryCode string `json:"mobile_country_code" api:"nullable"`
MobileNetworkCode string `json:"mobile_network_code" api:"nullable"`
PhoneNumber string `json:"phone_number"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CarrierName respjson.Field
CountryCode respjson.Field
IsPorted respjson.Field
IsValid respjson.Field
IsVoip respjson.Field
LineType respjson.Field
MobileCountryCode respjson.Field
MobileNetworkCode respjson.Field
PhoneNumber respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The response data (null if error)
func (NumberLookupResponseData) RawJSON ¶ added in v0.9.0
func (r NumberLookupResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*NumberLookupResponseData) UnmarshalJSON ¶ added in v0.9.0
func (r *NumberLookupResponseData) UnmarshalJSON(data []byte) error
type NumberService ¶ added in v0.9.0
type NumberService struct {
Options []option.RequestOption
}
What a phone number actually is, before you send to it.
A lookup returns the number's country, line type and carrier, which is what decides whether it is reachable on a channel and what it costs. Worth doing on import rather than on send: a landline in a contact list is a message that can never be delivered.
NumberService contains methods and other services that help with interacting with the Sent 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 NewNumberService method instead.
func NewNumberService ¶ added in v0.9.0
func NewNumberService(opts ...option.RequestOption) (r NumberService)
NewNumberService 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 (*NumberService) Lookup ¶ added in v0.9.0
func (r *NumberService) Lookup(ctx context.Context, phoneNumber string, query NumberLookupParams, opts ...option.RequestOption) (res *NumberLookupResponse, err error)
Retrieves detailed information about a phone number including carrier, line type, porting status, and VoIP detection. Uses the customer's messaging provider for rich data, with fallback to the internal index.
type PaginationMeta ¶ added in v0.7.0
type PaginationMeta struct {
// Cursor-based pagination. Never populated — see Cursors.
//
// Deprecated: deprecated
Cursors PaginationMetaCursors `json:"cursors" api:"nullable"`
// Whether there are more pages after this one
HasMore bool `json:"has_more"`
// Current page number (1-indexed)
Page int64 `json:"page"`
// Number of items per page
PageSize int64 `json:"page_size"`
// Total number of items across all pages
TotalCount int64 `json:"total_count"`
// Total number of pages
TotalPages int64 `json:"total_pages"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Cursors respjson.Field
HasMore respjson.Field
Page respjson.Field
PageSize respjson.Field
TotalCount respjson.Field
TotalPages respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Pagination metadata for list responses
func (PaginationMeta) RawJSON ¶ added in v0.7.0
func (r PaginationMeta) RawJSON() string
Returns the unmodified JSON received from the API
func (*PaginationMeta) UnmarshalJSON ¶ added in v0.7.0
func (r *PaginationMeta) UnmarshalJSON(data []byte) error
type PaginationMetaCursors
deprecated
added in
v0.7.0
type PaginationMetaCursors struct {
// Cursor to fetch the next page.
After string `json:"after" api:"nullable"`
// Cursor to fetch the previous page.
Before string `json:"before" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
After respjson.Field
Before respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Cursor-based pagination. Never populated — see Cursors.
Deprecated: deprecated
func (PaginationMetaCursors) RawJSON ¶ added in v0.7.0
func (r PaginationMetaCursors) RawJSON() string
Returns the unmodified JSON received from the API
func (*PaginationMetaCursors) UnmarshalJSON ¶ added in v0.7.0
func (r *PaginationMetaCursors) UnmarshalJSON(data []byte) error
type PaymentDetailsParam ¶ added in v0.9.0
type PaymentDetailsParam struct {
// Card number (digits only, 13–19 characters)
CardNumber string `json:"card_number" api:"required"`
// Card security code (3–4 digits)
Cvc string `json:"cvc" api:"required"`
// Card expiry date in MM/YY format (e.g. "09/27")
Expiry string `json:"expiry" api:"required"`
// Billing ZIP / postal code associated with the card
ZipCode string `json:"zip_code" api:"required"`
// contains filtered or unexported fields
}
The properties CardNumber, Cvc, Expiry, ZipCode are required.
func (PaymentDetailsParam) MarshalJSON ¶ added in v0.9.0
func (r PaymentDetailsParam) MarshalJSON() (data []byte, err error)
func (*PaymentDetailsParam) UnmarshalJSON ¶ added in v0.9.0
func (r *PaymentDetailsParam) UnmarshalJSON(data []byte) error
type ProfileCampaignDeleteParams ¶ added in v0.9.0
type ProfileCampaignDeleteParams struct {
ProfileID string `path:"profileId" api:"required" format:"uuid" json:"-"`
MutationRequest MutationRequestParam
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (ProfileCampaignDeleteParams) MarshalJSON ¶ added in v0.9.0
func (r ProfileCampaignDeleteParams) MarshalJSON() (data []byte, err error)
func (*ProfileCampaignDeleteParams) UnmarshalJSON ¶ added in v0.9.0
func (r *ProfileCampaignDeleteParams) UnmarshalJSON(data []byte) error
type ProfileCampaignListParams ¶ added in v0.9.0
type ProfileCampaignNewParams ¶ added in v0.9.0
type ProfileCampaignNewParams struct {
// Campaign data for create or update operation
Campaign CampaignDataParam `json:"campaign,omitzero" api:"required"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (ProfileCampaignNewParams) MarshalJSON ¶ added in v0.9.0
func (r ProfileCampaignNewParams) MarshalJSON() (data []byte, err error)
func (*ProfileCampaignNewParams) UnmarshalJSON ¶ added in v0.9.0
func (r *ProfileCampaignNewParams) UnmarshalJSON(data []byte) error
type ProfileCampaignService ¶ added in v0.9.0
type ProfileCampaignService struct {
Options []option.RequestOption
}
**Deprecated — use Sender Profiles.**
The original profile resource, kept because it has live callers. It still works, and its replacement is `/v3/sender-profiles`, which takes the identity and the campaign in one call instead of across three.
New integrations should not start here.
ProfileCampaignService contains methods and other services that help with interacting with the Sent 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 NewProfileCampaignService method instead.
func NewProfileCampaignService ¶ added in v0.9.0
func NewProfileCampaignService(opts ...option.RequestOption) (r ProfileCampaignService)
NewProfileCampaignService 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 (*ProfileCampaignService) Delete
deprecated
added in
v0.9.0
func (r *ProfileCampaignService) Delete(ctx context.Context, campaignID string, params ProfileCampaignDeleteParams, opts ...option.RequestOption) (err error)
**Deprecated.** This endpoint is replaced by `/v3/sender-profiles` and will be removed in a future release. It still behaves exactly as before, so nothing needs to change today — but new integrations should use `/v3/sender-profiles`, which models a profile's markets, compliance, brand, campaigns and billing explicitly.
Deletes a campaign by ID from the brand of the specified profile. The profile must belong to the authenticated organization.
Deprecated: deprecated
func (*ProfileCampaignService) List
deprecated
added in
v0.9.0
func (r *ProfileCampaignService) List(ctx context.Context, profileID string, query ProfileCampaignListParams, opts ...option.RequestOption) (res *APIResponseOfListOfBrandCampaign, err error)
**Deprecated.** This endpoint is replaced by `/v3/sender-profiles` and will be removed in a future release. It still behaves exactly as before, so nothing needs to change today — but new integrations should use `/v3/sender-profiles`, which models a profile's markets, compliance, brand, campaigns and billing explicitly.
Retrieves all campaigns linked to the profile's brand, including use cases and sample messages. Returns inherited campaigns if inherit_tcr_campaign=true.
Deprecated: deprecated
func (*ProfileCampaignService) New
deprecated
added in
v0.9.0
func (r *ProfileCampaignService) New(ctx context.Context, profileID string, params ProfileCampaignNewParams, opts ...option.RequestOption) (res *APIResponseOfBrandCampaign, err error)
**Deprecated.** This endpoint is replaced by `/v3/sender-profiles` and will be removed in a future release. It still behaves exactly as before, so nothing needs to change today — but new integrations should use `/v3/sender-profiles`, which models a profile's markets, compliance, brand, campaigns and billing explicitly.
Creates a new campaign scoped under the brand of the specified profile. Each campaign must include at least one use case with sample messages.
Deprecated: deprecated
func (*ProfileCampaignService) Update
deprecated
added in
v0.9.0
func (r *ProfileCampaignService) Update(ctx context.Context, campaignID string, params ProfileCampaignUpdateParams, opts ...option.RequestOption) (res *APIResponseOfBrandCampaign, err error)
**Deprecated.** This endpoint is replaced by `/v3/sender-profiles` and will be removed in a future release. It still behaves exactly as before, so nothing needs to change today — but new integrations should use `/v3/sender-profiles`, which models a profile's markets, compliance, brand, campaigns and billing explicitly.
Updates an existing campaign under the brand of the specified profile. Cannot update campaigns that have already been submitted to TCR.
Deprecated: deprecated
type ProfileCampaignUpdateParams ¶ added in v0.9.0
type ProfileCampaignUpdateParams struct {
ProfileID string `path:"profileId" api:"required" format:"uuid" json:"-"`
// Campaign data for create or update operation
Campaign CampaignDataParam `json:"campaign,omitzero" api:"required"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (ProfileCampaignUpdateParams) MarshalJSON ¶ added in v0.9.0
func (r ProfileCampaignUpdateParams) MarshalJSON() (data []byte, err error)
func (*ProfileCampaignUpdateParams) UnmarshalJSON ¶ added in v0.9.0
func (r *ProfileCampaignUpdateParams) UnmarshalJSON(data []byte) error
type ProfileCompleteParams ¶ added in v0.7.0
type ProfileCompleteParams struct {
// Webhook URL to call when profile completion finishes (success or failure)
WebHookURL string `json:"webHookUrl" api:"required" format:"uri"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (ProfileCompleteParams) MarshalJSON ¶ added in v0.7.0
func (r ProfileCompleteParams) MarshalJSON() (data []byte, err error)
func (*ProfileCompleteParams) UnmarshalJSON ¶ added in v0.7.0
func (r *ProfileCompleteParams) UnmarshalJSON(data []byte) error
type ProfileCompleteResponse ¶ added in v0.7.0
type ProfileCompleteResponse struct {
// Response when a profile is already in the completed state and no further action
// is taken.
Data ProfileCompleteResponseData `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (ProfileCompleteResponse) RawJSON ¶ added in v0.22.0
func (r ProfileCompleteResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ProfileCompleteResponse) UnmarshalJSON ¶ added in v0.22.0
func (r *ProfileCompleteResponse) UnmarshalJSON(data []byte) error
type ProfileCompleteResponseData ¶ added in v0.22.0
type ProfileCompleteResponseData struct {
// Human-readable message describing the result.
Message string `json:"message"`
// Current process status of the profile (e.g., "completed", "submitted",
// "in_progress").
Status string `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Response when a profile is already in the completed state and no further action is taken.
func (ProfileCompleteResponseData) RawJSON ¶ added in v0.22.0
func (r ProfileCompleteResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*ProfileCompleteResponseData) UnmarshalJSON ¶ added in v0.22.0
func (r *ProfileCompleteResponseData) UnmarshalJSON(data []byte) error
type ProfileDeleteParams ¶ added in v0.7.0
type ProfileDeleteParams struct {
MutationRequest MutationRequestParam
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (ProfileDeleteParams) MarshalJSON ¶ added in v0.7.0
func (r ProfileDeleteParams) MarshalJSON() (data []byte, err error)
func (*ProfileDeleteParams) UnmarshalJSON ¶ added in v0.7.0
func (r *ProfileDeleteParams) UnmarshalJSON(data []byte) error
type ProfileDetail ¶ added in v0.7.0
type ProfileDetail struct {
// Profile unique identifier
ID string `json:"id" format:"uuid"`
// Always false. A profile no longer shares contacts with sibling profiles — it
// sees only what it owns. Retained so existing v3 clients reading
// allow_contact_sharing keep deserializing; it carries no information.
//
// Deprecated: deprecated
AllowContactSharing bool `json:"allow_contact_sharing" api:"nullable"`
// Whether number changes are allowed during onboarding
AllowNumberChangeDuringOnboarding bool `json:"allow_number_change_during_onboarding" api:"nullable"`
// Always false. A profile no longer shares templates with sibling profiles.
// Retained so existing v3 clients reading allow_template_sharing keep
// deserializing; it carries no information.
//
// Deprecated: deprecated
AllowTemplateSharing bool `json:"allow_template_sharing" api:"nullable"`
// Billing contact info returned in profile responses
BillingContact ProfileDetailBillingContact `json:"billing_contact" api:"nullable"`
// Billing model: profile, organization, or profile_and_organization
BillingModel string `json:"billing_model"`
// Brand response with nested contact, business, and compliance sections — mirrors
// the request structure.
Brand ProfileDetailBrand `json:"brand" api:"nullable"`
// When the profile was created
CreatedAt time.Time `json:"created_at" format:"date-time"`
// Profile description
Description string `json:"description" api:"nullable"`
// Profile email (inherited from organization)
Email string `json:"email" api:"nullable"`
// Profile icon URL
Icon string `json:"icon" api:"nullable"`
// Always false. A profile no longer inherits its organization's contacts. Retained
// so existing v3 clients reading inherit_contacts keep deserializing; it carries
// no information.
//
// Deprecated: deprecated
InheritContacts bool `json:"inherit_contacts" api:"nullable"`
// Whether this profile inherits TCR brand from the organization
InheritTcrBrand bool `json:"inherit_tcr_brand"`
// Whether this profile inherits TCR campaign from the organization
InheritTcrCampaign bool `json:"inherit_tcr_campaign"`
// Always false. A profile no longer inherits its organization's templates.
// Retained so existing v3 clients reading inherit_templates keep deserializing; it
// carries no information.
//
// Deprecated: deprecated
InheritTemplates bool `json:"inherit_templates" api:"nullable"`
// Profile name
Name string `json:"name"`
// Parent organization ID
OrganizationID string `json:"organization_id" api:"nullable" format:"uuid"`
// Direct SMS phone number
SendingPhoneNumber string `json:"sending_phone_number" api:"nullable"`
// Deprecated. Always null. Sender borrowing is gone: a profile no longer points at
// another profile for its SMS sender, and every profile owns the sender it sends
// from.
//
// Kept on the wire, and never populated, because those are two different promises.
// Removing the key changes the response's shape — a generated client loses the
// property and stops compiling on the next regenerate, for a value that is now
// null for every profile in existence. Keeping it null costs a key and breaks
// nobody, and null is the honest answer rather than a placeholder: there is no
// borrowing left to report.
//
// Nothing could populate it. Migration 260813161500 dropped the column and copied
// each borrower its own channel-provider row; its Down() says outright that the
// borrower-to-lender pairing is not recoverable. The only surviving trace is a
// notes string on the copied row.
//
// Deprecated: deprecated
SendingPhoneNumberProfileID string `json:"sending_phone_number_profile_id" api:"nullable" format:"uuid"`
// Deprecated: deprecated
SendingWhatsappNumberProfileID string `json:"sending_whatsapp_number_profile_id" api:"nullable" format:"uuid"`
// Profile short name/abbreviation. 3–11 characters: letters, numbers, and spaces
// only, with at least one letter.
ShortName string `json:"short_name" api:"nullable"`
// Profile setup status: incomplete, pending_review, approved, rejected
Status string `json:"status"`
// When the profile was last updated
UpdatedAt time.Time `json:"updated_at" api:"nullable" format:"date-time"`
// WhatsApp Business Account ID associated with this profile. Present whether the
// WABA is inherited from the organization or configured directly.
WabaID string `json:"waba_id" api:"nullable"`
// Direct WhatsApp phone number
WhatsappPhoneNumber string `json:"whatsapp_phone_number" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
AllowContactSharing respjson.Field
AllowNumberChangeDuringOnboarding respjson.Field
AllowTemplateSharing respjson.Field
BillingContact respjson.Field
BillingModel respjson.Field
Brand respjson.Field
CreatedAt respjson.Field
Description respjson.Field
Email respjson.Field
Icon respjson.Field
InheritContacts respjson.Field
InheritTcrBrand respjson.Field
InheritTcrCampaign respjson.Field
InheritTemplates respjson.Field
Name respjson.Field
OrganizationID respjson.Field
SendingPhoneNumber respjson.Field
SendingPhoneNumberProfileID respjson.Field
SendingWhatsappNumberProfileID respjson.Field
ShortName respjson.Field
Status respjson.Field
UpdatedAt respjson.Field
WabaID respjson.Field
WhatsappPhoneNumber respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Detailed profile response for v3 API
func (ProfileDetail) RawJSON ¶ added in v0.7.0
func (r ProfileDetail) RawJSON() string
Returns the unmodified JSON received from the API
func (*ProfileDetail) UnmarshalJSON ¶ added in v0.7.0
func (r *ProfileDetail) UnmarshalJSON(data []byte) error
type ProfileDetailBillingContact ¶ added in v0.8.0
type ProfileDetailBillingContact struct {
Address string `json:"address" api:"nullable"`
Email string `json:"email" api:"nullable"`
Name string `json:"name" api:"nullable"`
Phone string `json:"phone" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Address respjson.Field
Email respjson.Field
Name respjson.Field
Phone respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Billing contact info returned in profile responses
func (ProfileDetailBillingContact) RawJSON ¶ added in v0.8.0
func (r ProfileDetailBillingContact) RawJSON() string
Returns the unmodified JSON received from the API
func (*ProfileDetailBillingContact) UnmarshalJSON ¶ added in v0.8.0
func (r *ProfileDetailBillingContact) UnmarshalJSON(data []byte) error
type ProfileDetailBrand ¶ added in v0.9.0
type ProfileDetailBrand struct {
// Unique identifier for the brand
ID string `json:"id" format:"uuid"`
// Business details and address information
Business ProfileDetailBrandBusiness `json:"business" api:"nullable"`
// Compliance and TCR-related information
Compliance ProfileDetailBrandCompliance `json:"compliance" api:"nullable"`
// Contact information for the brand
Contact ProfileDetailBrandContact `json:"contact" api:"nullable"`
// When the brand was created
CreatedAt time.Time `json:"created_at" format:"date-time"`
// Deprecated and scheduled for removal. Identifies the Campaign Service Provider
// that registered the brand, which is Sent, so the value is the same for every
// brand and every account. Nothing on your side can act on it and there is no
// replacement. Stop reading it.
//
// Deprecated: deprecated
CspID string `json:"csp_id" api:"nullable"`
// Any of "SELF_DECLARED", "UNVERIFIED", "VERIFIED", "VETTED_VERIFIED".
IdentityStatus string `json:"identity_status" api:"nullable"`
// Whether this brand is inherited from the parent organization
IsInherited bool `json:"is_inherited"`
// Any of "ACTIVE", "INACTIVE", "SUSPENDED".
Status string `json:"status" api:"nullable"`
// When the brand was submitted to TCR
SubmittedAt time.Time `json:"submitted_at" api:"nullable" format:"date-time"`
// Whether this brand has been submitted to TCR
SubmittedToTcr bool `json:"submitted_to_tcr"`
// TCR brand ID (populated after TCR submission)
TcrBrandID string `json:"tcr_brand_id" api:"nullable"`
// Universal EIN from TCR
UniversalEin string `json:"universal_ein" api:"nullable"`
// When the brand was last updated
UpdatedAt time.Time `json:"updated_at" api:"nullable" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Business respjson.Field
Compliance respjson.Field
Contact respjson.Field
CreatedAt respjson.Field
CspID respjson.Field
IdentityStatus respjson.Field
IsInherited respjson.Field
Status respjson.Field
SubmittedAt respjson.Field
SubmittedToTcr respjson.Field
TcrBrandID respjson.Field
UniversalEin respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Brand response with nested contact, business, and compliance sections — mirrors the request structure.
func (ProfileDetailBrand) RawJSON ¶ added in v0.9.0
func (r ProfileDetailBrand) RawJSON() string
Returns the unmodified JSON received from the API
func (*ProfileDetailBrand) UnmarshalJSON ¶ added in v0.9.0
func (r *ProfileDetailBrand) UnmarshalJSON(data []byte) error
type ProfileDetailBrandBusiness ¶ added in v0.9.0
type ProfileDetailBrandBusiness struct {
// City
City string `json:"city" api:"nullable"`
// Country code (e.g., US, CA)
Country string `json:"country" api:"nullable"`
// Country where the business is registered
CountryOfRegistration string `json:"country_of_registration" api:"nullable"`
// Business entity type
EntityType string `json:"entity_type" api:"nullable"`
// Legal business name
LegalName string `json:"legal_name" api:"nullable"`
// Postal/ZIP code
PostalCode string `json:"postal_code" api:"nullable"`
// State/province code
State string `json:"state" api:"nullable"`
// Street address
Street string `json:"street" api:"nullable"`
// Tax ID/EIN number
TaxID string `json:"tax_id" api:"nullable"`
// Type of tax ID (e.g., us_ein, ca_bn)
TaxIDType string `json:"tax_id_type" api:"nullable"`
// Business website URL
URL string `json:"url" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
City respjson.Field
Country respjson.Field
CountryOfRegistration respjson.Field
EntityType respjson.Field
LegalName respjson.Field
PostalCode respjson.Field
State respjson.Field
Street respjson.Field
TaxID respjson.Field
TaxIDType respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Business details and address information
func (ProfileDetailBrandBusiness) RawJSON ¶ added in v0.9.0
func (r ProfileDetailBrandBusiness) RawJSON() string
Returns the unmodified JSON received from the API
func (*ProfileDetailBrandBusiness) UnmarshalJSON ¶ added in v0.9.0
func (r *ProfileDetailBrandBusiness) UnmarshalJSON(data []byte) error
type ProfileDetailBrandCompliance ¶ added in v0.9.0
type ProfileDetailBrandCompliance struct {
// Any of "BASIC_ACCOUNT", "MEDIUM_ACCOUNT", "LARGE_ACCOUNT", "SMALL_ACCOUNT",
// "KEY_ACCOUNT".
BrandRelationship TcrBrandRelationship `json:"brand_relationship" api:"nullable"`
// List of destination countries for messaging
DestinationCountries []DestinationCountry `json:"destination_countries"`
// Whether this is a TCR (Campaign Registry) application
IsTcrApplication bool `json:"is_tcr_application"`
// Additional notes about the business or use case
Notes string `json:"notes" api:"nullable"`
// Phone number prefix for messaging (e.g., "+1")
PhoneNumberPrefix string `json:"phone_number_prefix" api:"nullable"`
// Always null. The brand's free-text primary use case is no longer stored: it
// reached neither TCR nor any decision, and its column is dropped with no
// backfill, because the values were prose and the typed equivalent is the
// campaign's MessagingUseCaseUS.
//
// Retained so existing v3 clients reading primary_use_case keep deserializing.
// Unlike the profile sharing flags, which can answer false truthfully, there is no
// value to report here — the field is present and empty rather than present and
// wrong.
//
// Deprecated: deprecated
PrimaryUseCase string `json:"primary_use_case" api:"nullable"`
// Any of "PROFESSIONAL", "REAL_ESTATE", "HEALTHCARE", "HUMAN_RESOURCES", "ENERGY",
// "ENTERTAINMENT", "RETAIL", "TRANSPORTATION", "AGRICULTURE", "INSURANCE",
// "POSTAL", "EDUCATION", "HOSPITALITY", "FINANCIAL", "POLITICAL", "GAMBLING",
// "LEGAL", "CONSTRUCTION", "NGO", "MANUFACTURING", "GOVERNMENT", "TECHNOLOGY",
// "COMMUNICATION".
Vertical TcrVertical `json:"vertical" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
BrandRelationship respjson.Field
DestinationCountries respjson.Field
IsTcrApplication respjson.Field
Notes respjson.Field
PhoneNumberPrefix respjson.Field
PrimaryUseCase respjson.Field
Vertical respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Compliance and TCR-related information
func (ProfileDetailBrandCompliance) RawJSON ¶ added in v0.9.0
func (r ProfileDetailBrandCompliance) RawJSON() string
Returns the unmodified JSON received from the API
func (*ProfileDetailBrandCompliance) UnmarshalJSON ¶ added in v0.9.0
func (r *ProfileDetailBrandCompliance) UnmarshalJSON(data []byte) error
type ProfileDetailBrandContact ¶ added in v0.9.0
type ProfileDetailBrandContact struct {
// Business/brand name
BusinessName string `json:"business_name" api:"nullable"`
// Contact email address
Email string `json:"email" api:"nullable"`
// Primary contact name
Name string `json:"name"`
// Contact phone number in E.164 format
Phone string `json:"phone" api:"nullable"`
// Contact phone country code (e.g., "1" for US)
PhoneCountryCode string `json:"phone_country_code" api:"nullable"`
// Contact's role in the business
Role string `json:"role" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
BusinessName respjson.Field
Email respjson.Field
Name respjson.Field
Phone respjson.Field
PhoneCountryCode respjson.Field
Role respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Contact information for the brand
func (ProfileDetailBrandContact) RawJSON ¶ added in v0.9.0
func (r ProfileDetailBrandContact) RawJSON() string
Returns the unmodified JSON received from the API
func (*ProfileDetailBrandContact) UnmarshalJSON ¶ added in v0.9.0
func (r *ProfileDetailBrandContact) UnmarshalJSON(data []byte) error
type ProfileGetParams ¶ added in v0.8.0
type ProfileListParams ¶ added in v0.8.0
type ProfileListResponse ¶ added in v0.7.0
type ProfileListResponse struct {
// The profiles in the organization.
Data ProfileListResponseData `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (ProfileListResponse) RawJSON ¶ added in v0.7.0
func (r ProfileListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ProfileListResponse) UnmarshalJSON ¶ added in v0.7.0
func (r *ProfileListResponse) UnmarshalJSON(data []byte) error
type ProfileListResponseData ¶ added in v0.7.0
type ProfileListResponseData struct {
// Pagination metadata for list responses
Pagination PaginationMeta `json:"pagination"`
// The profiles on this page.
Profiles []ProfileDetail `json:"profiles"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Pagination respjson.Field
Profiles respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The profiles in the organization.
func (ProfileListResponseData) RawJSON ¶ added in v0.7.0
func (r ProfileListResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*ProfileListResponseData) UnmarshalJSON ¶ added in v0.7.0
func (r *ProfileListResponseData) UnmarshalJSON(data []byte) error
type ProfileNewParams ¶ added in v0.7.0
type ProfileNewParams struct {
// Deprecated. Accepted and ignored. Contact and template sharing between sender
// profiles is gone — a profile sees only what it owns, and the organization still
// sees all of its profiles' contacts and templates through read-time widening. The
// four columns behind these flags were dropped by M260720120000.
//
// Bound rather than dropped so the properties survive on the wire and in a
// generated client: an SDK that assigns them keeps compiling, which is the
// compatibility this exists for. Deliberately not refused either — a 400 would
// break an integration that is otherwise working, and the capability they ask for
// is gone either way. Same rule as SendingPhoneNumberProfileId.
//
// The read is what makes this survivable: every profile reports all four as false,
// so a caller that checks its own write can see it did not take. Requests carrying
// one are logged, so we can tell when nobody sends them any more and the fields
// can go for real.
AllowContactSharing param.Opt[bool] `json:"allow_contact_sharing,omitzero"`
AllowTemplateSharing param.Opt[bool] `json:"allow_template_sharing,omitzero"`
// Billing model: profile, organization, or profile_and_organization (default:
// profile).
//
// - "organization": the organization's billing details are used; no profile-level
// billing info needed.
// - "profile": the profile is billed independently; billing_contact is required.
// - "profile_and_organization": the profile is billed first with the organization
// as fallback; billing_contact is required.
BillingModel param.Opt[string] `json:"billing_model,omitzero"`
// Profile description (optional)
Description param.Opt[string] `json:"description,omitzero"`
// Profile icon URL (optional)
Icon param.Opt[string] `json:"icon,omitzero"`
InheritContacts param.Opt[bool] `json:"inherit_contacts,omitzero"`
// Whether this profile inherits TCR brand from organization (default: false)
InheritTcrBrand param.Opt[bool] `json:"inherit_tcr_brand,omitzero"`
// Whether this profile inherits TCR campaign from organization (default: false)
InheritTcrCampaign param.Opt[bool] `json:"inherit_tcr_campaign,omitzero"`
InheritTemplates param.Opt[bool] `json:"inherit_templates,omitzero"`
// Profile short name/abbreviation (optional). Must be 3–11 characters, contain
// only letters, numbers, and spaces, and include at least one letter. Example:
// "SALES", "Mkt 2", "Support1".
ShortName param.Opt[string] `json:"short_name,omitzero"`
// Profile name (required)
Name param.Opt[string] `json:"name,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// Direct WhatsApp Business Account credentials for a profile. Use this when the
// profile should have its own WhatsApp Business Account instead of inheriting from
// the organization. Credentials must be obtained from Meta Business Manager by
// creating a System User with whatsapp_business_messaging and
// whatsapp_business_management scopes.
WhatsappBusinessAccount ProfileNewParamsWhatsappBusinessAccount `json:"whatsapp_business_account,omitzero"`
// Billing contact information for a profile. Required when billing_model is
// "profile" or "profile_and_organization".
BillingContact BillingContactInfoParam `json:"billing_contact,omitzero"`
// Brand and KYC data grouped into contact, business, and compliance sections
Brand BrandsBrandDataParam `json:"brand,omitzero"`
// Payment card details for this profile (optional). Accepted when billing_model is
// "profile" or "profile_and_organization". Not persisted on our servers —
// forwarded to the payment processor.
PaymentDetails PaymentDetailsParam `json:"payment_details,omitzero"`
// contains filtered or unexported fields
}
func (ProfileNewParams) MarshalJSON ¶ added in v0.7.0
func (r ProfileNewParams) MarshalJSON() (data []byte, err error)
func (*ProfileNewParams) UnmarshalJSON ¶ added in v0.7.0
func (r *ProfileNewParams) UnmarshalJSON(data []byte) error
type ProfileNewParamsWhatsappBusinessAccount ¶ added in v0.8.0
type ProfileNewParamsWhatsappBusinessAccount struct {
// System User access token with whatsapp_business_messaging and
// whatsapp_business_management permissions. This value is stored securely and
// never returned in API responses.
AccessToken string `json:"access_token" api:"required"`
// WhatsApp Business Account ID from Meta Business Manager
WabaID string `json:"waba_id" api:"required"`
// Phone Number ID of an existing number already registered under this WABA in Meta
// Business Manager. Optional — when omitted, a number will be provisioned from our
// pool and registered in the WABA during the onboarding flow. When provided, the
// number must already exist in the WABA.
PhoneNumberID param.Opt[string] `json:"phone_number_id,omitzero"`
// contains filtered or unexported fields
}
Direct WhatsApp Business Account credentials for a profile. Use this when the profile should have its own WhatsApp Business Account instead of inheriting from the organization. Credentials must be obtained from Meta Business Manager by creating a System User with whatsapp_business_messaging and whatsapp_business_management scopes.
The properties AccessToken, WabaID are required.
func (ProfileNewParamsWhatsappBusinessAccount) MarshalJSON ¶ added in v0.8.0
func (r ProfileNewParamsWhatsappBusinessAccount) MarshalJSON() (data []byte, err error)
func (*ProfileNewParamsWhatsappBusinessAccount) UnmarshalJSON ¶ added in v0.8.0
func (r *ProfileNewParamsWhatsappBusinessAccount) UnmarshalJSON(data []byte) error
type ProfileService ¶ added in v0.7.0
type ProfileService struct {
Options []option.RequestOption
// **Deprecated — use Sender Profiles.**
//
// The original profile resource, kept because it has live callers. It still works,
// and its replacement is `/v3/sender-profiles`, which takes the identity and the
// campaign in one call instead of across three.
//
// New integrations should not start here.
Campaigns ProfileCampaignService
}
**Deprecated — use Sender Profiles.**
The original profile resource, kept because it has live callers. It still works, and its replacement is `/v3/sender-profiles`, which takes the identity and the campaign in one call instead of across three.
New integrations should not start here.
ProfileService contains methods and other services that help with interacting with the Sent 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 NewProfileService method instead.
func NewProfileService ¶ added in v0.7.0
func NewProfileService(opts ...option.RequestOption) (r ProfileService)
NewProfileService 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 (*ProfileService) Complete
deprecated
added in
v0.7.0
func (r *ProfileService) Complete(ctx context.Context, profileID string, params ProfileCompleteParams, opts ...option.RequestOption) (res *ProfileCompleteResponse, err error)
**Deprecated.** This endpoint is replaced by `/v3/sender-profiles` and will be removed in a future release. It still behaves exactly as before, so nothing needs to change today — but new integrations should use `/v3/sender-profiles`, which models a profile's markets, compliance, brand, campaigns and billing explicitly.
Final step in the profile compliance workflow. Validates all prerequisites (KYC, brand, campaigns, required documents), connects the profile to the SMS and WhatsApp channels, and marks it onboarded. Prerequisites are always validated first: if any fail the call returns 400 naming every unmet one, and nothing is started. If they pass and the profile is already onboarded, the call returns 200 and does nothing. Otherwise it returns 202 and calls the provided webhook URL when background processing finishes.
Callable with the organization's API key or the profile's own key. The key's user must be an admin or owner of the profile, or of the organization it belongs to.
Prerequisites (all but the last are checked before the already-onboarded short-circuit, matching the previous contract; the last is checked after it, so a profile that is already onboarded is never rejected by it):
- Profile must have a name, short name, and description (short name max 50 characters, description max 5000)
- webHookUrl must be supplied on the request
- A KYC form submission is required
- A brand is required, either on the profile or inherited from the parent organization
- TCR applications must have at least one campaign, own or inherited
- Destination countries marked as main must have their required compliance documents uploaded
- TCR applications must state whether they inherit the organization's TCR brand and campaign
Outcome:
- Once the prerequisites pass and background processing succeeds, the profile's conversionFlowStatus becomes ONBOARDED and its public status reads `approved`
- A profile with no WhatsApp channel, or one still awaiting TCR registration or country documents, is onboarded like any other. Those are answered by the brand and campaign records, not by a status on the profile
- If background processing fails, the profile keeps the status it already had and the webhook reports the reason
Deprecated: deprecated
func (*ProfileService) Delete
deprecated
added in
v0.7.0
func (r *ProfileService) Delete(ctx context.Context, profileID string, params ProfileDeleteParams, opts ...option.RequestOption) (err error)
**Deprecated.** This endpoint is replaced by `/v3/sender-profiles` and will be removed in a future release. It still behaves exactly as before, so nothing needs to change today — but new integrations should use `/v3/sender-profiles`, which models a profile's markets, compliance, brand, campaigns and billing explicitly.
Soft deletes a sender profile. The profile will be marked as deleted but data is retained. Anything it still held is released first: phone numbers return to our inventory and can go to whoever asks next, its own WhatsApp account is deregistered, and its routing rules stop being used. Requires admin role in the organization.
Deprecated: deprecated
func (*ProfileService) Get
deprecated
added in
v0.7.0
func (r *ProfileService) Get(ctx context.Context, profileID string, query ProfileGetParams, opts ...option.RequestOption) (res *APIResponseOfProfileDetail, err error)
**Deprecated.** This endpoint is replaced by `/v3/sender-profiles` and will be removed in a future release. It still behaves exactly as before, so nothing needs to change today — but new integrations should use `/v3/sender-profiles`, which models a profile's markets, compliance, brand, campaigns and billing explicitly.
Retrieves detailed information about a specific sender profile within an organization, including brand and KYC information if a brand has been configured.
Deprecated: deprecated
func (*ProfileService) List
deprecated
added in
v0.7.0
func (r *ProfileService) List(ctx context.Context, query ProfileListParams, opts ...option.RequestOption) (res *ProfileListResponse, err error)
**Deprecated.** This endpoint is replaced by `/v3/sender-profiles` and will be removed in a future release. It still behaves exactly as before, so nothing needs to change today — but new integrations should use `/v3/sender-profiles`, which models a profile's markets, compliance, brand, campaigns and billing explicitly.
Retrieves all sender profiles within an organization, including brand information for each profile. Profiles represent different brands, departments, or use cases within an organization, each with their own messaging configuration.
Deprecated: deprecated
func (*ProfileService) New
deprecated
added in
v0.7.0
func (r *ProfileService) New(ctx context.Context, params ProfileNewParams, opts ...option.RequestOption) (res *APIResponseOfProfileDetail, err error)
**Deprecated.** This endpoint is replaced by `/v3/sender-profiles` and will be removed in a future release. It still behaves exactly as before, so nothing needs to change today — but new integrations should use `/v3/sender-profiles`, which models a profile's markets, compliance, brand, campaigns and billing explicitly.
Creates a new sender profile within an organization. Profiles represent different brands, departments, or use cases, each with their own messaging configuration and settings. Requires admin role in the organization.
## WhatsApp Business Account
Every profile owns its own WhatsApp Business Account — accounts are never shared between profiles or inherited from the organization. Provide a `whatsapp_business_account` object with `waba_id`, `phone_number_id`, and `access_token`. Obtain these from Meta Business Manager by creating a System User with `whatsapp_business_messaging` and `whatsapp_business_management` permissions.
Omit the field and the profile is created without WhatsApp, staying incomplete until it has an account of its own.
## Brand
Include the optional `brand` field to create the brand for this profile at the same time. Cannot be used when `inherit_tcr_brand` is `true`.
## Payment Details
When `billing_model` is `"profile"` or `"profile_and_organization"` you may include a `payment_details` object containing the card number, expiry (MM/YY), CVC, and billing ZIP code. Payment details are **never stored** on our servers and are forwarded directly to the payment processor. Providing `payment_details` when `billing_model` is `"organization"` is not allowed.
Deprecated: deprecated
func (*ProfileService) Update
deprecated
added in
v0.7.0
func (r *ProfileService) Update(ctx context.Context, profileID string, params ProfileUpdateParams, opts ...option.RequestOption) (res *APIResponseOfProfileDetail, err error)
**Deprecated.** This endpoint is replaced by `/v3/sender-profiles` and will be removed in a future release. It still behaves exactly as before, so nothing needs to change today — but new integrations should use `/v3/sender-profiles`, which models a profile's markets, compliance, brand, campaigns and billing explicitly.
Updates a profile's configuration and settings. Requires admin role in the organization. Only provided fields will be updated (partial update).
## Brand Management
Include the optional `brand` field to create or update the brand associated with this profile. The brand holds KYC and TCR compliance data (legal business info, contact details, messaging vertical). Once a brand has been submitted to TCR it cannot be modified. Setting `inherit_tcr_brand: true` and providing `brand` in the same request is not allowed.
## Payment Details
When `billing_model` is `"profile"` or `"profile_and_organization"` you may include a `payment_details` object containing the card number, expiry (MM/YY), CVC, and billing ZIP code. Payment details are **never stored** on our servers and are forwarded directly to the payment processor. Providing `payment_details` when `billing_model` is `"organization"` is not allowed.
## Deprecated fields
`sending_phone_number_profile_id` and `sending_whatsapp_number_profile_id` are **accepted and ignored**. Sender borrowing is gone: a profile cannot send from another profile's number, because two profiles behind one sender makes an inbound reply and a delivery receipt ambiguous about whose they are.
Sending either **changes nothing and still returns `200`** — they are kept on the contract so an existing integration keeps working. Reads carry both keys too and always answer `null`, which is how you can confirm the value did not take.
Give the profile a sender of its own instead — `POST /v3/channels/sms` or `POST /v3/channels/whatsapp`, sent with the `x-profile-id` header naming it.
Deprecated: deprecated
type ProfileSettings ¶ added in v0.7.0
type ProfileSettings struct {
// Always false. A profile no longer shares contacts with sibling profiles — it
// sees only what it owns. Retained so existing v3 clients reading
// allow_contact_sharing keep deserializing; it carries no information.
//
// Deprecated: deprecated
AllowContactSharing bool `json:"allow_contact_sharing" api:"nullable"`
// Always false. A profile no longer shares templates with sibling profiles.
// Retained so existing v3 clients reading allow_template_sharing keep
// deserializing; it carries no information.
//
// Deprecated: deprecated
AllowTemplateSharing bool `json:"allow_template_sharing" api:"nullable"`
// Billing model: profile, organization, or profile_and_organization
BillingModel string `json:"billing_model" api:"nullable"`
// Always false. A profile no longer inherits its organization's contacts. Retained
// so existing v3 clients reading inherit_contacts keep deserializing; it carries
// no information.
//
// Deprecated: deprecated
InheritContacts bool `json:"inherit_contacts" api:"nullable"`
// Whether this profile inherits TCR brand from the organization
InheritTcrBrand bool `json:"inherit_tcr_brand" api:"nullable"`
// Whether this profile inherits TCR campaign from the organization
InheritTcrCampaign bool `json:"inherit_tcr_campaign" api:"nullable"`
// Always false. A profile no longer inherits its organization's templates.
// Retained so existing v3 clients reading inherit_templates keep deserializing; it
// carries no information.
//
// Deprecated: deprecated
InheritTemplates bool `json:"inherit_templates" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
AllowContactSharing respjson.Field
AllowTemplateSharing respjson.Field
BillingModel respjson.Field
InheritContacts respjson.Field
InheritTcrBrand respjson.Field
InheritTcrCampaign respjson.Field
InheritTemplates respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Profile configuration settings
func (ProfileSettings) RawJSON ¶ added in v0.7.0
func (r ProfileSettings) RawJSON() string
Returns the unmodified JSON received from the API
func (*ProfileSettings) UnmarshalJSON ¶ added in v0.7.0
func (r *ProfileSettings) UnmarshalJSON(data []byte) error
type ProfileUpdateParams ¶ added in v0.7.0
type ProfileUpdateParams struct {
// Deprecated. Accepted and ignored. Contact and template sharing between sender
// profiles is gone — a profile sees only what it owns, and the organization still
// sees all of its profiles' contacts and templates through read-time widening. The
// four columns behind these flags were dropped by M260720120000.
//
// Retired the same way as SendingPhoneNumberProfileId, and for the same reason:
// the properties stay bound so an SDK that assigns them keeps compiling, and a 400
// would break a working integration over a capability that is gone regardless.
// Every profile reports all four as false, so a caller that checks its own write
// can see it did not take.
AllowContactSharing param.Opt[bool] `json:"allow_contact_sharing,omitzero"`
// Whether number changes are allowed during onboarding (optional)
AllowNumberChangeDuringOnboarding param.Opt[bool] `json:"allow_number_change_during_onboarding,omitzero"`
AllowTemplateSharing param.Opt[bool] `json:"allow_template_sharing,omitzero"`
// Billing model: profile, organization, or profile_and_organization (optional).
//
// - "organization": the organization's billing details are used; no profile-level
// billing info needed.
// - "profile": the profile is billed independently; billing_contact is required.
// - "profile_and_organization": the profile is billed first with the organization
// as fallback; billing_contact is required.
BillingModel param.Opt[string] `json:"billing_model,omitzero"`
// Profile description (optional)
Description param.Opt[string] `json:"description,omitzero"`
// Profile icon URL (optional)
Icon param.Opt[string] `json:"icon,omitzero"`
InheritContacts param.Opt[bool] `json:"inherit_contacts,omitzero"`
// Whether this profile inherits TCR brand from organization (optional)
InheritTcrBrand param.Opt[bool] `json:"inherit_tcr_brand,omitzero"`
// Whether this profile inherits TCR campaign from organization (optional)
InheritTcrCampaign param.Opt[bool] `json:"inherit_tcr_campaign,omitzero"`
InheritTemplates param.Opt[bool] `json:"inherit_templates,omitzero"`
// Profile name (optional)
Name param.Opt[string] `json:"name,omitzero"`
// Direct phone number for SMS sending (optional)
SendingPhoneNumber param.Opt[string] `json:"sending_phone_number,omitzero"`
// Deprecated. Accepted and ignored. Sender borrowing is gone: a profile cannot
// send from another profile's SMS number. Supplying this changes nothing and the
// request still succeeds.
//
// Bound rather than dropped so the property survives on the wire and in a
// generated client — an SDK that assigns it keeps compiling, which is the
// compatibility this exists for. It is deliberately not refused: a 400 here would
// break an integration that is otherwise working, and the capability it asks for
// is gone either way.
//
// The trade-off, stated plainly. A caller asking for borrowing is told it
// succeeded when nothing happened. What makes that survivable is the read:
// sending_phone_number_profile_id comes back null on every profile, so a caller
// that checks its own write can see it did not take. Every request that carries
// one is logged, so we can tell when nobody is sending it any more and the field
// can go for real.
//
// Give the profile a sender of its own instead: POST /v3/channels/sms with the
// x-profile-id header naming it.
SendingPhoneNumberProfileID param.Opt[string] `json:"sending_phone_number_profile_id,omitzero" format:"uuid"`
SendingWhatsappNumberProfileID param.Opt[string] `json:"sending_whatsapp_number_profile_id,omitzero" format:"uuid"`
// Profile short name/abbreviation (optional). Must be 3–11 characters, contain
// only letters, numbers, and spaces, and include at least one letter. Example:
// "SALES", "Mkt 2", "Support1".
ShortName param.Opt[string] `json:"short_name,omitzero"`
// Direct phone number for WhatsApp sending (optional)
WhatsappPhoneNumber param.Opt[string] `json:"whatsapp_phone_number,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// Billing contact information for a profile. Required when billing_model is
// "profile" or "profile_and_organization".
BillingContact BillingContactInfoParam `json:"billing_contact,omitzero"`
// Brand and KYC data grouped into contact, business, and compliance sections
Brand BrandsBrandDataParam `json:"brand,omitzero"`
// Payment card details for this profile (optional). Accepted when billing_model is
// "profile" or "profile_and_organization". Not persisted on our servers —
// forwarded to the payment processor.
PaymentDetails PaymentDetailsParam `json:"payment_details,omitzero"`
// contains filtered or unexported fields
}
func (ProfileUpdateParams) MarshalJSON ¶ added in v0.7.0
func (r ProfileUpdateParams) MarshalJSON() (data []byte, err error)
func (*ProfileUpdateParams) UnmarshalJSON ¶ added in v0.7.0
func (r *ProfileUpdateParams) UnmarshalJSON(data []byte) error
type TcrBrandRelationship ¶ added in v0.7.0
type TcrBrandRelationship string
const ( TcrBrandRelationshipBasicAccount TcrBrandRelationship = "BASIC_ACCOUNT" TcrBrandRelationshipMediumAccount TcrBrandRelationship = "MEDIUM_ACCOUNT" TcrBrandRelationshipLargeAccount TcrBrandRelationship = "LARGE_ACCOUNT" TcrBrandRelationshipSmallAccount TcrBrandRelationship = "SMALL_ACCOUNT" TcrBrandRelationshipKeyAccount TcrBrandRelationship = "KEY_ACCOUNT" )
type TcrVertical ¶ added in v0.7.0
type TcrVertical string
const ( TcrVerticalProfessional TcrVertical = "PROFESSIONAL" TcrVerticalRealEstate TcrVertical = "REAL_ESTATE" TcrVerticalHealthcare TcrVertical = "HEALTHCARE" TcrVerticalHumanResources TcrVertical = "HUMAN_RESOURCES" TcrVerticalEnergy TcrVertical = "ENERGY" TcrVerticalEntertainment TcrVertical = "ENTERTAINMENT" TcrVerticalRetail TcrVertical = "RETAIL" TcrVerticalTransportation TcrVertical = "TRANSPORTATION" TcrVerticalAgriculture TcrVertical = "AGRICULTURE" TcrVerticalInsurance TcrVertical = "INSURANCE" TcrVerticalPostal TcrVertical = "POSTAL" TcrVerticalEducation TcrVertical = "EDUCATION" TcrVerticalHospitality TcrVertical = "HOSPITALITY" TcrVerticalFinancial TcrVertical = "FINANCIAL" TcrVerticalPolitical TcrVertical = "POLITICAL" TcrVerticalGambling TcrVertical = "GAMBLING" TcrVerticalLegal TcrVertical = "LEGAL" TcrVerticalConstruction TcrVertical = "CONSTRUCTION" TcrVerticalNgo TcrVertical = "NGO" TcrVerticalManufacturing TcrVertical = "MANUFACTURING" TcrVerticalGovernment TcrVertical = "GOVERNMENT" TcrVerticalTechnology TcrVertical = "TECHNOLOGY" TcrVerticalCommunication TcrVertical = "COMMUNICATION" )
type Template ¶ added in v0.7.0
type Template struct {
// Which customer owns this — the key's own, or the profile named in x-profile-id.
// Says whose resource this is, which the resource's own id does not.
CustomerID string `json:"customer_id" api:"required" format:"uuid"`
// Unique template identifier
ID string `json:"id" format:"uuid"`
// Which consent keyword this template answers, when it is one of Sent's
// auto-replies: OPT_IN, OPT_OUT, HELP, or OTHER for a customer-defined keyword.
// Null for an ordinary template, and omitted from the response, so its presence is
// the answer to "is this an auto-reply".
//
// Deliberately not required, unlike CustomerId, even though the same "no single
// mapper" argument applies: NJsonSchema publishes a C# required member in the
// schema's required array, so the contract would have advertised a field this
// response omits for every ordinary template, and a generated client could refuse
// the common case. A compile-time guard is not worth a wrong published contract.
// Every mapping site sets it explicitly, and TemplateResponseSchemaTests pins the
// field as optional so it cannot be reintroduced.
AutoReplyAction string `json:"auto_reply_action" api:"nullable"`
// Template category: MARKETING, UTILITY, AUTHENTICATION
Category string `json:"category"`
// The channels this template's definition can render on, in canonical order: sms,
// whatsapp, rcs.
//
// Derived from the definition's body, mirroring each channel's send-time fallback
// chain, so a channel is listed only when a real body would be produced for it:
// SMS reads sms ?? multiChannel, WhatsApp reads whatsapp ?? multiChannel, and RCS
// reads rcs ?? multiChannel ?? sms. A multiChannel body therefore reports all
// three, and the extra SMS fallback on RCS is why an sms/whatsapp pair reports RCS
// too.
//
// This says what the content can render on, not what may be sent: sending also
// needs the template approved for that channel.
Channels []string `json:"channels" api:"nullable"`
// When the template was created
CreatedAt time.Time `json:"created_at" format:"date-time"`
// Whether the template is published and active
IsPublished bool `json:"is_published"`
// Template language code (e.g., en_US)
Language string `json:"language"`
// Template display name
Name string `json:"name"`
// Template status: DRAFT, PENDING, APPROVED, REJECTED. A template created with
// submit_for_review: false starts as DRAFT and stays there until it is submitted.
Status string `json:"status"`
// When the template was last updated
UpdatedAt time.Time `json:"updated_at" api:"nullable" format:"date-time"`
// Template variables for personalization
Variables []string `json:"variables" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CustomerID respjson.Field
ID respjson.Field
AutoReplyAction respjson.Field
Category respjson.Field
Channels respjson.Field
CreatedAt respjson.Field
IsPublished respjson.Field
Language respjson.Field
Name respjson.Field
Status respjson.Field
UpdatedAt respjson.Field
Variables respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Template response for v3 API
func (*Template) UnmarshalJSON ¶ added in v0.7.0
type TemplateBodyContentParam ¶
type TemplateBodyContentParam struct {
// The body copy, with variables written as {{index:variable}}.
//
// Length cap depends on which channel this body belongs to:
// TemplateContentLimits.MaxBodyLength (1024) for multiChannel, sms and whatsapp —
// Meta's BODY limit, which a multiChannel body may be delivered under — and
// TemplateContentLimits.MaxRcsBodyLength (3072) for an rcs body, which never
// reaches Meta. The maxLength advertised on this schema is the 1024 one, because
// all four channel bodies share this single schema — an rcs body between the two
// is accepted.
//
// Meta requires every variable to carry surrounding context, so a body is refused
// unless it also satisfies all of the following (enforced by
// TemplateDefinitionValidator): At least one letter before the first variable and
// after the last — trailing punctuation such as "... {{1:variable}}." does not
// count. At least (2 × variable count) + 1 words once the placeholders are
// removed. No two variables adjacent with only whitespace between them. No leading
// or trailing newline, no more than two consecutive line breaks, and no more than
// four consecutive spaces.
//
// Example: "Hello {{0:variable}}! Welcome to {{1:variable}}. We are glad to have
// you on board." — two variables, so at least five words are required, and the
// copy after the final variable contains letters.
Template string `json:"template" api:"required"`
// The type of body content — send "text". It is dropped from the stored definition
// when null, so a body posted without it is saved with no type key at all and the
// template editor has nothing to render the block from.
Type param.Opt[string] `json:"type,omitzero"`
// The variables referenced by the body copy, one entry per {{index:variable}}
// placeholder.
Variables []TemplateVariableParam `json:"variables,omitzero"`
// contains filtered or unexported fields
}
The property Template is required.
func (TemplateBodyContentParam) MarshalJSON ¶
func (r TemplateBodyContentParam) MarshalJSON() (data []byte, err error)
func (*TemplateBodyContentParam) UnmarshalJSON ¶
func (r *TemplateBodyContentParam) UnmarshalJSON(data []byte) error
type TemplateBodyMmsMediaParam ¶ added in v0.37.0
type TemplateBodyMmsMediaParam struct {
// One of MmsMediaTypes. Advisory: the carrier reads the Content-Type off the
// fetched object, not this field. It exists so an authoring UI can render the
// right preview and so a reviewer can see what was intended.
MediaType param.Opt[string] `json:"mediaType,omitzero"`
// Publicly fetchable https URL. The carrier's MMSC fetches this at send time, so
// it has to stay reachable and unauthenticated for the life of the send —
// including retries and a DLQ replay — which is why a presigned URL is not a valid
// value here.
URL param.Opt[string] `json:"url,omitzero"`
// contains filtered or unexported fields
}
One attachment on an MMS template body.
func (TemplateBodyMmsMediaParam) MarshalJSON ¶ added in v0.37.0
func (r TemplateBodyMmsMediaParam) MarshalJSON() (data []byte, err error)
func (*TemplateBodyMmsMediaParam) UnmarshalJSON ¶ added in v0.37.0
func (r *TemplateBodyMmsMediaParam) UnmarshalJSON(data []byte) error
type TemplateBodyMmsParam ¶ added in v0.37.0
type TemplateBodyMmsParam struct {
// Attachments carried by every send on this template, in order. A per-send
// media_urls on the request replaces this list rather than adding to it, so a
// template can hold a default creative and a caller can still send something
// recipient-specific.
Media []TemplateBodyMmsMediaParam `json:"media,omitzero"`
// MMS subject line. Optional — most handsets render it above the body, some ignore
// it entirely. Deliberately its own field rather than riding TemplateHeader: the
// header is authored once and shared across every channel, and carries Meta's
// 60-character cap plus its no-newline, no-emoji text rules, none of which
// describe an MMS subject.
Subject param.Opt[string] `json:"subject,omitzero"`
TemplateBodyContentParam
}
MMS-specific content — subject, text and attachments.
Like Rcs, an override that cannot stand on its own: a template still needs a MultiChannel body or the Sms + Whatsapp pair to be deliverable at all. Unlike Rcs, it has no fallback at send time — MMS with no media is a more expensive SMS, so a template without this slot is deliberately not MMS-capable and never produces an MMS route candidate.
func (TemplateBodyMmsParam) MarshalJSON ¶ added in v0.37.0
func (r TemplateBodyMmsParam) MarshalJSON() (data []byte, err error)
type TemplateBodyParam ¶ added in v0.30.0
type TemplateBodyParam struct {
// MMS-specific content — subject, text and attachments.
//
// Like Rcs, an override that cannot stand on its own: a template still needs a
// MultiChannel body or the Sms + Whatsapp pair to be deliverable at all. Unlike
// Rcs, it has no fallback at send time — MMS with no media is a more expensive
// SMS, so a template without this slot is deliberately not MMS-capable and never
// produces an MMS route candidate.
Mms TemplateBodyMmsParam `json:"mms,omitzero"`
// The shared body, used for every channel. One half of the choice described above.
MultiChannel TemplateBodyContentParam `json:"multiChannel,omitzero"`
// RCS-specific copy that overrides the chosen strategy for RCS only. The one true
// override: optional on top of either strategy, but it cannot be the only body
// present. Its length cap is the higher one described on Template.
Rcs TemplateBodyContentParam `json:"rcs,omitzero"`
// The SMS body. It does not override multiChannel, it replaces it.
SMS TemplateBodyContentParam `json:"sms,omitzero"`
// The WhatsApp body. It does not override multiChannel, it replaces it.
Whatsapp TemplateBodyContentParam `json:"whatsapp,omitzero"`
// contains filtered or unexported fields
}
Body section of a message template.
A body picks one of two authoring strategies, and mixing them is refused (TemplateDefinitionValidator.HaveValidChannelConfiguration): a shared multiChannel body on its own, or an explicit sms + whatsapp pair, both present.
multiChannel together with sms or whatsapp is rejected, and so is sms or whatsapp on its own — every template is expected to be deliverable on every channel. rcs is the one true override: it may accompany either strategy to vary the copy, but cannot stand alone.
func (TemplateBodyParam) MarshalJSON ¶ added in v0.30.0
func (r TemplateBodyParam) MarshalJSON() (data []byte, err error)
func (*TemplateBodyParam) UnmarshalJSON ¶ added in v0.30.0
func (r *TemplateBodyParam) UnmarshalJSON(data []byte) error
type TemplateButtonParam ¶ added in v0.30.0
type TemplateButtonParam struct {
// Properties specific to the button type
Props TemplateButtonPropsParam `json:"props,omitzero" api:"required"`
// The type of button (e.g., QUICK_REPLY, URL, PHONE_NUMBER, VOICE_CALL, COPY_CODE)
Type string `json:"type" api:"required"`
// The button's identifier (1-based index), unique within the template.
//
// Omitting it is only safe for a template holding a single button. The field is a
// non-nullable int, so every button that leaves it out defaults to 0, and two such
// buttons are refused by the unique-id rule ("Button IDs must be unique"). Number
// them from 1 in the order they should appear — order matters on RCS, where only
// the first four buttons render.
ID param.Opt[int64] `json:"id,omitzero"`
// contains filtered or unexported fields
}
Interactive button in a message template
The properties Props, Type are required.
func (TemplateButtonParam) MarshalJSON ¶ added in v0.30.0
func (r TemplateButtonParam) MarshalJSON() (data []byte, err error)
func (*TemplateButtonParam) UnmarshalJSON ¶ added in v0.30.0
func (r *TemplateButtonParam) UnmarshalJSON(data []byte) error
type TemplateButtonPropsParam ¶ added in v0.30.0
type TemplateButtonPropsParam struct {
ActiveFor int64 `json:"activeFor" api:"required"`
CountryCode string `json:"countryCode" api:"required"`
OfferCode string `json:"offerCode" api:"required"`
PhoneNumber string `json:"phoneNumber" api:"required"`
QuickReplyType string `json:"quickReplyType" api:"required"`
// The button's label. Required for every button type, and capped at
// TemplateContentLimits.MaxButtonTextLength (25) characters.
//
// Meta accepts only static text here, so a label is refused when it contains a
// {{...}} variable placeholder, a newline, an emoji, or WhatsApp formatting markup
// (\*, \_, ~) — enforced by ApplyButtonLabelContentRules in
// TemplateButtonValidator. Meta reports all four as one error: "Buttons can't have
// any variables, newlines, emojis, or formatting characters."
//
// AUTHENTICATION OTP buttons are the exception: Meta auto-localizes their label
// from the template language, and the converter drops whatever text was sent.
Text string `json:"text" api:"required"`
URL string `json:"url" api:"required"`
URLType string `json:"urlType" api:"required"`
// Variables embedded in a dynamic URL button (only when UrlType = dynamic). Count
// is capped by TemplateContentLimits.MaxUrlButtonVariables; the placeholder must
// appear at the end of Url (validated in TemplateDefinitionValidator).
Variables []TemplateVariableParam `json:"variables,omitzero" api:"required"`
AutofillText param.Opt[string] `json:"autofillText,omitzero"`
OtpType param.Opt[string] `json:"otpType,omitzero"`
PackageName param.Opt[string] `json:"packageName,omitzero"`
SignatureHash param.Opt[string] `json:"signatureHash,omitzero"`
// contains filtered or unexported fields
}
The properties ActiveFor, CountryCode, OfferCode, PhoneNumber, QuickReplyType, Text, URL, URLType, Variables are required.
func (TemplateButtonPropsParam) MarshalJSON ¶ added in v0.30.0
func (r TemplateButtonPropsParam) MarshalJSON() (data []byte, err error)
func (*TemplateButtonPropsParam) UnmarshalJSON ¶ added in v0.30.0
func (r *TemplateButtonPropsParam) UnmarshalJSON(data []byte) error
type TemplateDefinitionParam ¶
type TemplateDefinitionParam struct {
// Body section of a message template.
//
// A body picks one of two authoring strategies, and mixing them is refused
// (TemplateDefinitionValidator.HaveValidChannelConfiguration): a shared
// multiChannel body on its own, or an explicit sms + whatsapp pair, both present.
//
// multiChannel together with sms or whatsapp is rejected, and so is sms or
// whatsapp on its own — every template is expected to be deliverable on every
// channel. rcs is the one true override: it may accompany either strategy to vary
// the copy, but cannot stand alone.
Body TemplateBodyParam `json:"body,omitzero" api:"required"`
// The version of the template definition format
DefinitionVersion param.Opt[string] `json:"definitionVersion,omitzero"`
// Optional list of interactive buttons (e.g., quick replies, URLs, phone numbers)
Buttons []TemplateButtonParam `json:"buttons,omitzero"`
// Configuration for AUTHENTICATION category templates
AuthenticationConfig AuthenticationConfigParam `json:"authenticationConfig,omitzero"`
Footer TemplateFooterParam `json:"footer,omitzero"`
// Header section of a message template
Header TemplateHeaderParam `json:"header,omitzero"`
// contains filtered or unexported fields
}
Complete definition of a message template including header, body, footer, and buttons
The property Body is required.
func (TemplateDefinitionParam) MarshalJSON ¶
func (r TemplateDefinitionParam) MarshalJSON() (data []byte, err error)
func (*TemplateDefinitionParam) UnmarshalJSON ¶
func (r *TemplateDefinitionParam) UnmarshalJSON(data []byte) error
type TemplateDeleteParams ¶ added in v0.7.0
type TemplateDeleteParams struct {
// Whether to also delete the template from WhatsApp/Meta (optional, defaults to
// false)
DeleteFromMeta param.Opt[bool] `json:"delete_from_meta,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (TemplateDeleteParams) MarshalJSON ¶ added in v0.7.0
func (r TemplateDeleteParams) MarshalJSON() (data []byte, err error)
func (*TemplateDeleteParams) UnmarshalJSON ¶ added in v0.7.0
func (r *TemplateDeleteParams) UnmarshalJSON(data []byte) error
type TemplateEvent ¶ added in v0.31.0
type TemplateEvent struct {
// The specific event within the family, for example message.delivered,
// message.received or contact.opt_out. Absent on events that have no subtype, so
// treat it as optional.
Event string `json:"event" api:"nullable"`
// The event family, for example message, templates or contact. Route on this
// first, then on event for the specific change.
Field string `json:"field"`
// Body of a template status event. Delivered when a template's review outcome
// changes, so you can react without polling.
Payload TemplateEventPayload `json:"payload" api:"nullable"`
// The event-specific body.
RequestID string `json:"request_id" api:"nullable"`
// When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
// time, not the time the underlying change happened. Use the timestamp inside the
// payload for the latter.
Timestamp string `json:"timestamp"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Event respjson.Field
Field respjson.Field
Payload respjson.Field
RequestID respjson.Field
Timestamp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares this shape and varies only in Payload.
func (TemplateEvent) RawJSON ¶ added in v0.31.0
func (r TemplateEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*TemplateEvent) UnmarshalJSON ¶ added in v0.31.0
func (r *TemplateEvent) UnmarshalJSON(data []byte) error
type TemplateEventPayload ¶ added in v0.31.0
type TemplateEventPayload struct {
// The review status the template just reached, for example APPROVED or REJECTED.
Status string `json:"status" api:"required"`
// The template's identifier with Meta, assigned when the template is submitted for
// review.
WhatsappTemplateID string `json:"whatsapp_template_id" api:"required"`
// The account the template belongs to.
AccountID string `json:"account_id" format:"uuid"`
// Which consent keyword this template answers, when it is one of Sent's
// auto-replies: OPT_IN, OPT_OUT, HELP, or OTHER for a customer-defined keyword.
//
// Omitted for an ordinary template, so its presence is the answer to "is this an
// auto-reply". Sent creates the three compliance auto-replies at signup and they
// go through review like any other template, so their events arrive mixed in with
// the customer's own with nothing else to tell them apart.
//
// Named for the reader rather than after Template.OptAction, which it is mapped
// from. The MCP tool result deliberately keeps OptAction, OptKeywords and IsOpt:
// it mirrors the internal shape on purpose and publishes the keywords too, so
// renaming one of the three there would leave a surface half in each vocabulary.
// Two names for one concept, each consistent within its own surface, chosen over a
// rename that breaks MCP clients silently.
AutoReplyAction string `json:"auto_reply_action" api:"nullable"`
// The template's category, for example UTILITY, MARKETING, or AUTHENTICATION.
Category string `json:"category"`
// The channel leg this decision is about, for example whatsapp, sms, or rcs. A
// template is reviewed per channel and the legs come back independently, so each
// one reports separately.
//
// Omitted when the decision applies to the template as a whole rather than to one
// leg. That event is the broader news: a template-wide rejection blocks every
// channel, whatever the individual legs say.
Channel string `json:"channel" api:"nullable"`
// The template's language code, for example en_US.
Language string `json:"language"`
// Why the template reached Status, when a reason was given. Populated on a
// rejection.
Reason string `json:"reason" api:"nullable"`
// The template in Sent.
TemplateID string `json:"template_id" format:"uuid"`
// The template's display name.
TemplateName string `json:"template_name"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Status respjson.Field
WhatsappTemplateID respjson.Field
AccountID respjson.Field
AutoReplyAction respjson.Field
Category respjson.Field
Channel respjson.Field
Language respjson.Field
Reason respjson.Field
TemplateID respjson.Field
TemplateName respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Body of a template status event. Delivered when a template's review outcome changes, so you can react without polling.
func (TemplateEventPayload) RawJSON ¶ added in v0.31.0
func (r TemplateEventPayload) RawJSON() string
Returns the unmodified JSON received from the API
func (*TemplateEventPayload) UnmarshalJSON ¶ added in v0.31.0
func (r *TemplateEventPayload) UnmarshalJSON(data []byte) error
type TemplateFooterParam ¶ added in v0.30.0
type TemplateFooterParam struct {
Template string `json:"template" api:"required"`
Type param.Opt[string] `json:"type,omitzero"`
Variables []TemplateVariableParam `json:"variables,omitzero"`
// contains filtered or unexported fields
}
Footer section of a message template
The property Template is required.
func (TemplateFooterParam) MarshalJSON ¶ added in v0.30.0
func (r TemplateFooterParam) MarshalJSON() (data []byte, err error)
func (*TemplateFooterParam) UnmarshalJSON ¶ added in v0.30.0
func (r *TemplateFooterParam) UnmarshalJSON(data []byte) error
type TemplateGetParams ¶ added in v0.8.0
type TemplateHeaderLocationParam ¶ added in v0.37.0
type TemplateHeaderLocationParam struct {
Address string `json:"address" api:"required"`
Latitude string `json:"latitude" api:"required"`
Longitude string `json:"longitude" api:"required"`
Name string `json:"name" api:"required"`
// contains filtered or unexported fields
}
The map pin a location header drops. Meta wants none of this at creation — the component is just {"type":"header","format":"location"} — so these values exist for Sent: a preview, and the default a StaticResource header falls back to at send.
The properties Address, Latitude, Longitude, Name are required.
func (TemplateHeaderLocationParam) MarshalJSON ¶ added in v0.37.0
func (r TemplateHeaderLocationParam) MarshalJSON() (data []byte, err error)
func (*TemplateHeaderLocationParam) UnmarshalJSON ¶ added in v0.37.0
func (r *TemplateHeaderLocationParam) UnmarshalJSON(data []byte) error
type TemplateHeaderParam ¶ added in v0.30.0
type TemplateHeaderParam struct {
// The header template text with optional variable placeholders (e.g., "Welcome to
// {{0:variable}}")
Template string `json:"template" api:"required"`
// Request-only. The s.dm URL of the asset Meta's reviewers see —
// https://s.dm/s/{ID}, eight uppercase characters, uploaded to s.dm out of band.
// NormalizeRichHeader folds it into the synthesized media variable's Props.Sample
// and clears it, so it never persists and a stored definition is indistinguishable
// from an imported one.
//
// Stricter than the send path on purpose:
// TemplateUtils.ValidateMediaVariableValues accepts any absolute https URL for the
// per-send asset, because that one is the customer's and may live behind a signed
// CDN link. This one is the review sample, has to outlive every resubmission, and
// so must be ours. Do not "fix" one to match the other.
ExampleURL param.Opt[string] `json:"example_url,omitzero"`
// The kind of header. One of:
//
// text — up to 60 characters, at most one variable. image — png, jpg or jpeg.
// Needs ExampleUrl. video — mp4. Needs ExampleUrl. gif — mp4, max 3.5MB. WhatsApp
// renders larger files as an ordinary video. Needs ExampleUrl. document — pdf or
// docx; only the first page is shown as a thumbnail, so pdf is the practical
// choice. Needs ExampleUrl. location — a map pin, supplied through Location.
//
// Kept lowercase because MetaToTemplateConverter writes Meta's format through
// ToLowerInvariant() into this field on import, and the two are compared directly.
Type param.Opt[string] `json:"type,omitzero"`
// Whether the asset registered at creation is reused when a caller omits the
// header's variable at send time. Default false — the caller must supply it per
// message, which is the behaviour every existing template has. Written only when
// true, so a default-valued header serializes byte-identically to one imported
// from Meta.
//
// Stored and validated but not yet honoured at send: that lands with the Resumable
// Upload work, alongside the code that lets such a template be approved in the
// first place.
StaticResource param.Opt[bool] `json:"static_resource,omitzero"`
// The map pin a location header drops. Meta wants none of this at creation — the
// component is just {"type":"header","format":"location"} — so these values exist
// for Sent: a preview, and the default a StaticResource header falls back to at
// send.
Location TemplateHeaderLocationParam `json:"location,omitzero"`
// List of variables used in the header template
Variables []TemplateVariableParam `json:"variables,omitzero"`
// contains filtered or unexported fields
}
Header section of a message template
The property Template is required.
func (TemplateHeaderParam) MarshalJSON ¶ added in v0.30.0
func (r TemplateHeaderParam) MarshalJSON() (data []byte, err error)
func (*TemplateHeaderParam) UnmarshalJSON ¶ added in v0.30.0
func (r *TemplateHeaderParam) UnmarshalJSON(data []byte) error
type TemplateListParams ¶
type TemplateListParams struct {
// Optional category filter: MARKETING, UTILITY, AUTHENTICATION
Category param.Opt[string] `query:"category,omitzero" json:"-"`
// Accepted and ignored. It used to filter on the welcome-playground marker inside
// a template's LOB details; that filter is gone and nothing reads this value, so
// sending it neither narrows nor widens the result. Retained only so a client
// still passing is_welcome_playground keeps binding instead of the request shape
// changing under it.
IsWelcomePlayground param.Opt[bool] `query:"is_welcome_playground,omitzero" json:"-"`
// Optional search term for filtering templates
Search param.Opt[string] `query:"search,omitzero" json:"-"`
// Optional status filter: APPROVED, PENDING, REJECTED
Status param.Opt[string] `query:"status,omitzero" json:"-"`
// Page number (1-indexed)
Page param.Opt[int64] `query:"page,omitzero" json:"-"`
// Number of items per page
PageSize param.Opt[int64] `query:"page_size,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (TemplateListParams) URLQuery ¶
func (r TemplateListParams) URLQuery() (v url.Values, err error)
URLQuery serializes TemplateListParams's query parameters as `url.Values`.
type TemplateNewParams ¶
type TemplateNewParams struct {
// Template category: MARKETING, UTILITY, AUTHENTICATION (optional, auto-detected
// if not provided)
Category param.Opt[string] `json:"category,omitzero"`
// Source of template creation (default: from-api)
CreationSource param.Opt[string] `json:"creation_source,omitzero"`
// Template language code (e.g., en_US) (optional, auto-detected if not provided)
Language param.Opt[string] `json:"language,omitzero"`
// Create this template automatically on every sender profile of the organization,
// now and in future (default: false). Accepted only from an organization that has
// been enabled for it, and only at creation — it cannot be changed afterwards.
AutoCreateForSp param.Opt[bool] `json:"auto_create_for_sp,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
// Whether to submit the template for review after creation (default: false)
SubmitForReview param.Opt[bool] `json:"submit_for_review,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// Complete definition of a message template including header, body, footer, and
// buttons
Definition TemplateDefinitionParam `json:"definition,omitzero"`
// contains filtered or unexported fields
}
func (TemplateNewParams) MarshalJSON ¶
func (r TemplateNewParams) MarshalJSON() (data []byte, err error)
func (*TemplateNewParams) UnmarshalJSON ¶
func (r *TemplateNewParams) UnmarshalJSON(data []byte) error
type TemplateService ¶
type TemplateService struct {
Options []option.RequestOption
}
Reusable message bodies with named variables.
A template is substituted at send time from the values you pass, so the copy lives here rather than in your application. WhatsApp templates additionally need Meta's approval before they can be sent, and a template's channel status reports where that stands — an approved SMS template and an unapproved WhatsApp one are the same template in two states.
TemplateService contains methods and other services that help with interacting with the Sent 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 NewTemplateService method instead.
func NewTemplateService ¶
func NewTemplateService(opts ...option.RequestOption) (r TemplateService)
NewTemplateService 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 (*TemplateService) Delete ¶
func (r *TemplateService) Delete(ctx context.Context, id string, params TemplateDeleteParams, opts ...option.RequestOption) (err error)
Deletes a template by ID. Optionally, you can also delete the template from WhatsApp/Meta by setting delete_from_meta=true.
func (*TemplateService) Get ¶
func (r *TemplateService) Get(ctx context.Context, id string, query TemplateGetParams, opts ...option.RequestOption) (res *APIResponseTemplate, err error)
Retrieves a specific template by its ID. Returns template details including name, category, language, status, and definition.
func (*TemplateService) List ¶
func (r *TemplateService) List(ctx context.Context, params TemplateListParams, opts ...option.RequestOption) (res *pagination.TemplatesPage[Template], err error)
Retrieves a paginated list of message templates for the authenticated customer. Supports filtering by status, category, and search term.
func (*TemplateService) ListAutoPaging ¶ added in v0.35.0
func (r *TemplateService) ListAutoPaging(ctx context.Context, params TemplateListParams, opts ...option.RequestOption) *pagination.TemplatesPageAutoPager[Template]
Retrieves a paginated list of message templates for the authenticated customer. Supports filtering by status, category, and search term.
func (*TemplateService) New ¶
func (r *TemplateService) New(ctx context.Context, params TemplateNewParams, opts ...option.RequestOption) (res *APIResponseTemplate, err error)
Creates a new message template with header, body, footer, and buttons. The template can be submitted for review immediately or saved as draft for later submission. There is no `name` field on create — the display name is derived from the template's content and can be changed afterwards with `PUT /v3/templates/{id}`.
func (*TemplateService) Update ¶ added in v0.7.0
func (r *TemplateService) Update(ctx context.Context, id string, params TemplateUpdateParams, opts ...option.RequestOption) (res *APIResponseTemplate, err error)
Updates an existing template's name, category, language, definition, or submits it for review. While the template is in review (status PENDING, or any channel awaiting a verdict) its definition, category and language are frozen and a resubmission is refused — those requests answer 409 CONFLICT_006. The display name stays editable throughout.
`definition`, `category` and `language` are editable only from status DRAFT, REJECTED or APPROVED. An edit to any of them on a template in another state (PAUSED, DISABLED or REVOKED) is refused with 400 VALIDATION_001 and the detail "Template (except display name) cannot be updated unless it is in draft or rejected status"; `name` stays editable in every state. `submit_for_review` on a PAUSED, DISABLED or REVOKED template is accepted and answers 200, but opens no review and does not move the status — only the reviewer can reinstate it.
Editing an APPROVED template is a live edit: the new content is stored immediately, and sending `submit_for_review: true` re-opens review, which returns the affected channels to PENDING so they stop sending until they are approved again. The previously approved content is never sent during re-review. Watch the per-channel `templates` webhook events rather than assuming the template-level status.
Templates provisioned by Sent (light-onboarding templates, whose names carry the reserved `sent_` prefix) are read-only: every field is refused with 400 VALIDATION*001 and the detail "This template is read-only. Only 'submit for review' is allowed.", and only `submit_for_review` is accepted. A `name` starting with `sent*` is refused for the same reason — the prefix is reserved.
type TemplateUpdateParams ¶ added in v0.7.0
type TemplateUpdateParams struct {
// Template category: MARKETING, UTILITY, AUTHENTICATION
Category param.Opt[string] `json:"category,omitzero"`
// Template language code (e.g., en_US)
Language param.Opt[string] `json:"language,omitzero"`
// Template display name
Name param.Opt[string] `json:"name,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
// Whether to submit the template for review after updating (default: false)
SubmitForReview param.Opt[bool] `json:"submit_for_review,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// Complete definition of a message template including header, body, footer, and
// buttons
Definition TemplateDefinitionParam `json:"definition,omitzero"`
// contains filtered or unexported fields
}
func (TemplateUpdateParams) MarshalJSON ¶ added in v0.7.0
func (r TemplateUpdateParams) MarshalJSON() (data []byte, err error)
func (*TemplateUpdateParams) UnmarshalJSON ¶ added in v0.7.0
func (r *TemplateUpdateParams) UnmarshalJSON(data []byte) error
type TemplateVariableParam ¶
type TemplateVariableParam struct {
// The variable's name, and the key callers use for it in a send request's
// parameters object. Must start with a letter and hold only letters, digits and
// underscores.
Name string `json:"name" api:"required"`
Props TemplateVariablePropsParam `json:"props,omitzero" api:"required"`
// One of variable, link or media. Decides which Props fields are required.
Type string `json:"type" api:"required"`
// The variable's index, and the number its {{index:variable}} placeholder refers
// to.
//
// Omitting it is only safe for a section holding a single variable. The field is a
// non-nullable int, so every variable that leaves it out defaults to 0, and a
// section with two such variables is refused by the unique-id rule ("variables
// must have unique IDs"). Number them from 0 in the order they appear.
ID param.Opt[int64] `json:"id,omitzero"`
// contains filtered or unexported fields
}
The properties Name, Props, Type are required.
func (TemplateVariableParam) MarshalJSON ¶
func (r TemplateVariableParam) MarshalJSON() (data []byte, err error)
func (*TemplateVariableParam) UnmarshalJSON ¶
func (r *TemplateVariableParam) UnmarshalJSON(data []byte) error
type TemplateVariablePropsParam ¶
type TemplateVariablePropsParam struct {
MediaType string `json:"mediaType" api:"required"`
// Example value substituted into the template when previewing it and when
// submitting it to Meta for review. Free text by nature, so the converter accepts
// a JSON number or boolean here and normalizes it — see
// JsonScalarToStringConverter for why — and guarantees it is always serialized
// back out as a JSON string.
Sample string `json:"sample" api:"required"`
URL string `json:"url" api:"required"`
VariableType string `json:"variableType" api:"required"`
Alt param.Opt[string] `json:"alt,omitzero"`
Regex param.Opt[string] `json:"regex,omitzero"`
ShortURL param.Opt[string] `json:"shortUrl,omitzero"`
// contains filtered or unexported fields
}
The properties MediaType, Sample, URL, VariableType are required.
func (TemplateVariablePropsParam) MarshalJSON ¶
func (r TemplateVariablePropsParam) MarshalJSON() (data []byte, err error)
func (*TemplateVariablePropsParam) UnmarshalJSON ¶
func (r *TemplateVariablePropsParam) UnmarshalJSON(data []byte) error
type UserGetParams ¶ added in v0.8.0
type UserInviteParams ¶ added in v0.7.0
type UserInviteParams struct {
// User email address (required)
Email param.Opt[string] `json:"email,omitzero" format:"email"`
// User full name (required)
Name param.Opt[string] `json:"name,omitzero"`
// User role: admin, billing, or developer (required)
Role param.Opt[string] `json:"role,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (UserInviteParams) MarshalJSON ¶ added in v0.7.0
func (r UserInviteParams) MarshalJSON() (data []byte, err error)
func (*UserInviteParams) UnmarshalJSON ¶ added in v0.7.0
func (r *UserInviteParams) UnmarshalJSON(data []byte) error
type UserListParams ¶ added in v0.8.0
type UserListResponse ¶ added in v0.7.0
type UserListResponse struct {
// The users in the organization.
Data UserListResponseData `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (UserListResponse) RawJSON ¶ added in v0.7.0
func (r UserListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*UserListResponse) UnmarshalJSON ¶ added in v0.7.0
func (r *UserListResponse) UnmarshalJSON(data []byte) error
type UserListResponseData ¶ added in v0.7.0
type UserListResponseData struct {
// Pagination metadata for list responses
Pagination PaginationMeta `json:"pagination"`
// The users on this page.
Users []UserResponse `json:"users"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Pagination respjson.Field
Users respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The users in the organization.
func (UserListResponseData) RawJSON ¶ added in v0.7.0
func (r UserListResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*UserListResponseData) UnmarshalJSON ¶ added in v0.7.0
func (r *UserListResponseData) UnmarshalJSON(data []byte) error
type UserRemoveParams ¶ added in v0.7.0
type UserRemoveParams struct {
MutationRequest MutationRequestParam
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (UserRemoveParams) MarshalJSON ¶ added in v0.7.0
func (r UserRemoveParams) MarshalJSON() (data []byte, err error)
func (*UserRemoveParams) UnmarshalJSON ¶ added in v0.7.0
func (r *UserRemoveParams) UnmarshalJSON(data []byte) error
type UserResponse ¶ added in v0.7.0
type UserResponse struct {
// User unique identifier
ID string `json:"id" format:"uuid"`
// When the user was added to the organization
CreatedAt time.Time `json:"created_at" format:"date-time"`
// Which customer owns this — the key's own, or the profile named in x-profile-id.
// Says whose resource this is, which the resource's own id does not.
CustomerID string `json:"customer_id" format:"uuid"`
// User email address
Email string `json:"email"`
// When the user was invited
InvitedAt time.Time `json:"invited_at" api:"nullable" format:"date-time"`
// When the user last logged in
LastLoginAt time.Time `json:"last_login_at" api:"nullable" format:"date-time"`
// User full name
Name string `json:"name"`
// User role in the organization: admin, billing, developer
Role string `json:"role"`
// User status: active, invited, suspended, rejected
Status string `json:"status"`
// When the user record was last updated
UpdatedAt time.Time `json:"updated_at" api:"nullable" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
CustomerID respjson.Field
Email respjson.Field
InvitedAt respjson.Field
LastLoginAt respjson.Field
Name respjson.Field
Role respjson.Field
Status respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
User response for v3 API
func (UserResponse) RawJSON ¶ added in v0.7.0
func (r UserResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*UserResponse) UnmarshalJSON ¶ added in v0.7.0
func (r *UserResponse) UnmarshalJSON(data []byte) error
type UserService ¶ added in v0.7.0
type UserService struct {
Options []option.RequestOption
}
The people who can sign in to your organization, and what each may do.
Users are dashboard access and nothing else — they do not send, and removing one does not affect traffic. An API key is not a user: it belongs to the organization or to a sender profile, so revoking a person's access leaves your integration running.
UserService contains methods and other services that help with interacting with the Sent 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 NewUserService method instead.
func NewUserService ¶ added in v0.7.0
func NewUserService(opts ...option.RequestOption) (r UserService)
NewUserService 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 (*UserService) Get ¶ added in v0.7.0
func (r *UserService) Get(ctx context.Context, userID string, query UserGetParams, opts ...option.RequestOption) (res *APIResponseOfUser, err error)
Retrieves detailed information about a specific user in an organization or profile. Requires developer role or higher.
func (*UserService) Invite ¶ added in v0.7.0
func (r *UserService) Invite(ctx context.Context, params UserInviteParams, opts ...option.RequestOption) (res *APIResponseOfUser, err error)
Sends an invitation to a user to join the organization or profile with a specific role. Requires admin role. The user will receive an invitation email with a token to accept. Invitation tokens expire after 7 days.
func (*UserService) List ¶ added in v0.7.0
func (r *UserService) List(ctx context.Context, query UserListParams, opts ...option.RequestOption) (res *UserListResponse, err error)
Retrieves all users who have access to the organization or profile identified by the API key, including their roles and status. Shows invited users (pending acceptance) and active users. Requires developer role or higher.
func (*UserService) Remove ¶ added in v0.7.0
func (r *UserService) Remove(ctx context.Context, userID string, params UserRemoveParams, opts ...option.RequestOption) (err error)
Removes a user's access to an organization or profile. Requires admin role. You cannot remove yourself or remove the last admin.
func (*UserService) UpdateRole ¶ added in v0.7.0
func (r *UserService) UpdateRole(ctx context.Context, userID string, params UserUpdateRoleParams, opts ...option.RequestOption) (res *APIResponseOfUser, err error)
Updates a user's role in the organization or profile. Requires admin role. You cannot change your own role or demote the last admin.
type UserUpdateRoleParams ¶ added in v0.7.0
type UserUpdateRoleParams struct {
// User role: admin, billing, or developer (required)
Role param.Opt[string] `json:"role,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (UserUpdateRoleParams) MarshalJSON ¶ added in v0.7.0
func (r UserUpdateRoleParams) MarshalJSON() (data []byte, err error)
func (*UserUpdateRoleParams) UnmarshalJSON ¶ added in v0.7.0
func (r *UserUpdateRoleParams) UnmarshalJSON(data []byte) error
type VoiceCallbackTest ¶ added in v0.39.0
type VoiceCallbackTest struct {
// Your answer as Sent read it, with numbers in E.164 and a missing caller id
// filled in. Set only when the outcome is ok.
Answer any `json:"answer" api:"nullable"`
// The call id the test question carried. It does not exist anywhere else and
// cannot be looked up.
CallID string `json:"call_id"`
// Why the test did not end with ok
Error VoiceCallbackTestErrorInfo `json:"error" api:"nullable"`
// What happened: ok, timeout, connection_failed, http_error or invalid_answer
Outcome string `json:"outcome"`
// The test question exactly as it was sent
Request VoiceCallbackTestRequestInfo `json:"request" api:"nullable"`
// What your endpoint answered
Response VoiceCallbackTestResponseInfo `json:"response" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Answer respjson.Field
CallID respjson.Field
Error respjson.Field
Outcome respjson.Field
Request respjson.Field
Response respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The verdict of a test question sent to your callback URL
func (VoiceCallbackTest) RawJSON ¶ added in v0.39.0
func (r VoiceCallbackTest) RawJSON() string
Returns the unmodified JSON received from the API
func (*VoiceCallbackTest) UnmarshalJSON ¶ added in v0.39.0
func (r *VoiceCallbackTest) UnmarshalJSON(data []byte) error
type VoiceCallbackTestErrorInfo ¶ added in v0.39.0
type VoiceCallbackTestErrorInfo struct {
// What to fix
Message string `json:"message"`
// Dotted path of the answer field at fault, such as action.action, when one field
// is to blame
Path string `json:"path" api:"nullable"`
// Machine-readable reason, such as timeout, http_error, malformed_json,
// missing_action or unknown_action
Reason string `json:"reason"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Path respjson.Field
Reason respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Why the test did not end with ok
func (VoiceCallbackTestErrorInfo) RawJSON ¶ added in v0.39.0
func (r VoiceCallbackTestErrorInfo) RawJSON() string
Returns the unmodified JSON received from the API
func (*VoiceCallbackTestErrorInfo) UnmarshalJSON ¶ added in v0.39.0
func (r *VoiceCallbackTestErrorInfo) UnmarshalJSON(data []byte) error
type VoiceCallbackTestRequestInfo ¶ added in v0.39.0
type VoiceCallbackTestRequestInfo struct {
// The request body byte for byte. This is what the signature covers.
Body string `json:"body"`
// Every header Sent added, the signature included, so you can compare against what
// your endpoint verified. The signing secret itself is never included.
Headers map[string]string `json:"headers"`
// The callback URL that was called
URL string `json:"url"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Body respjson.Field
Headers respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The test question exactly as it was sent
func (VoiceCallbackTestRequestInfo) RawJSON ¶ added in v0.39.0
func (r VoiceCallbackTestRequestInfo) RawJSON() string
Returns the unmodified JSON received from the API
func (*VoiceCallbackTestRequestInfo) UnmarshalJSON ¶ added in v0.39.0
func (r *VoiceCallbackTestRequestInfo) UnmarshalJSON(data []byte) error
type VoiceCallbackTestResponseInfo ¶ added in v0.39.0
type VoiceCallbackTestResponseInfo struct {
// The start of the raw response body, capped at 2048 characters
Body string `json:"body" api:"nullable"`
// The HTTP status your endpoint returned
StatusCode int64 `json:"status_code"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Body respjson.Field
StatusCode respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
What your endpoint answered
func (VoiceCallbackTestResponseInfo) RawJSON ¶ added in v0.39.0
func (r VoiceCallbackTestResponseInfo) RawJSON() string
Returns the unmodified JSON received from the API
func (*VoiceCallbackTestResponseInfo) UnmarshalJSON ¶ added in v0.39.0
func (r *VoiceCallbackTestResponseInfo) UnmarshalJSON(data []byte) error
type VoiceNumber ¶ added in v0.39.0
type VoiceNumber struct {
// Where Sent asks what to do with each call on this number: a signed question is
// POSTed here when a call arrives or a caller presses a key, and the answer
// decides the call. The signing secret is not on this read; it is shown when voice
// is turned on and by the rotate endpoint.
CallbackURL string `json:"callback_url" api:"nullable"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
// Whether this is the line app-originated calls are placed from when a voice token
// names no number. Exactly one active voice number carries it while the profile
// has any.
DefaultForAppCalls bool `json:"default_for_app_calls"`
// The number, in E.164.
Number string `json:"number"`
// ACTIVE while the number carries calls, INACTIVE once it was turned off. Nothing
// provisions: a number the customer holds can carry calls the moment voice is
// turned on for it.
Status string `json:"status"`
UpdatedAt time.Time `json:"updated_at" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CallbackURL respjson.Field
CreatedAt respjson.Field
DefaultForAppCalls respjson.Field
Number respjson.Field
Status respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
One number the profile carries phone calls on.
func (VoiceNumber) RawJSON ¶ added in v0.39.0
func (r VoiceNumber) RawJSON() string
Returns the unmodified JSON received from the API
func (*VoiceNumber) UnmarshalJSON ¶ added in v0.39.0
func (r *VoiceNumber) UnmarshalJSON(data []byte) error
type VoiceNumberCreated ¶ added in v0.39.0
type VoiceNumberCreated struct {
// The whsec\_ secret every question to callback_url is signed with. Shown here and
// by POST /v3/channels/voice/{number}/rotate-secret, nowhere else: store it now.
// Verify a question exactly as you verify a webhook, with X-Webhook-ID,
// X-Webhook-Timestamp and the body.
CallbackSecret string `json:"callback_secret"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CallbackSecret respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
VoiceNumber
}
One number the profile carries phone calls on.
func (VoiceNumberCreated) RawJSON ¶ added in v0.39.0
func (r VoiceNumberCreated) RawJSON() string
Returns the unmodified JSON received from the API
func (*VoiceNumberCreated) UnmarshalJSON ¶ added in v0.39.0
func (r *VoiceNumberCreated) UnmarshalJSON(data []byte) error
type VoiceSecret ¶ added in v0.39.0
type VoiceSecret struct {
// The new whsec\_ secret. The previous one stopped signing the moment this was
// returned, so update your backend before the next call reaches it. Shown once.
CallbackSecret string `json:"callback_secret"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CallbackSecret respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A freshly rotated callback signing secret
func (VoiceSecret) RawJSON ¶ added in v0.39.0
func (r VoiceSecret) RawJSON() string
Returns the unmodified JSON received from the API
func (*VoiceSecret) UnmarshalJSON ¶ added in v0.39.0
func (r *VoiceSecret) UnmarshalJSON(data []byte) error
type VoiceToken ¶ added in v0.39.0
type VoiceToken struct {
// The signed token. Hand it to the client SDK unchanged.
Token string `json:"token"`
// When the token expires (UTC)
ExpiresAt time.Time `json:"expires_at" format:"date-time"`
// The identity the token was minted for
Identity string `json:"identity"`
// The phone number this identity is now bound to, in E.164 format
Number string `json:"number"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Token respjson.Field
ExpiresAt respjson.Field
Identity respjson.Field
Number respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A short-lived token your app passes to the voice client SDK to register
func (VoiceToken) RawJSON ¶ added in v0.39.0
func (r VoiceToken) RawJSON() string
Returns the unmodified JSON received from the API
func (*VoiceToken) UnmarshalJSON ¶ added in v0.39.0
func (r *VoiceToken) UnmarshalJSON(data []byte) error
type WebhookDeleteParams ¶ added in v0.8.0
type WebhookEventType ¶ added in v0.21.0
type WebhookEventType struct {
Description string `json:"description" api:"nullable"`
DisplayName string `json:"display_name"`
EventType string `json:"event_type" api:"nullable"`
IsActive bool `json:"is_active"`
Name string `json:"name"`
SubTypes []WebhookEventType `json:"sub_types" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Description respjson.Field
DisplayName respjson.Field
EventType respjson.Field
IsActive respjson.Field
Name respjson.Field
SubTypes respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebhookEventType) RawJSON ¶ added in v0.21.0
func (r WebhookEventType) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookEventType) UnmarshalJSON ¶ added in v0.21.0
func (r *WebhookEventType) UnmarshalJSON(data []byte) error
type WebhookGetParams ¶ added in v0.8.0
type WebhookListEventTypesParams ¶ added in v0.8.0
type WebhookListEventTypesResponse ¶ added in v0.7.0
type WebhookListEventTypesResponse struct {
// The webhook event types a customer can subscribe to.
Data WebhookListEventTypesResponseData `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (WebhookListEventTypesResponse) RawJSON ¶ added in v0.7.0
func (r WebhookListEventTypesResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookListEventTypesResponse) UnmarshalJSON ¶ added in v0.7.0
func (r *WebhookListEventTypesResponse) UnmarshalJSON(data []byte) error
type WebhookListEventTypesResponseData ¶ added in v0.7.0
type WebhookListEventTypesResponseData struct {
// The event_types on this page.
EventTypes []WebhookEventType `json:"event_types"`
// Pagination metadata for list responses
Pagination PaginationMeta `json:"pagination"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
EventTypes respjson.Field
Pagination respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The webhook event types a customer can subscribe to.
func (WebhookListEventTypesResponseData) RawJSON ¶ added in v0.7.0
func (r WebhookListEventTypesResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookListEventTypesResponseData) UnmarshalJSON ¶ added in v0.7.0
func (r *WebhookListEventTypesResponseData) UnmarshalJSON(data []byte) error
type WebhookListEventsParams ¶ added in v0.7.0
type WebhookListEventsParams struct {
Search param.Opt[string] `query:"search,omitzero" json:"-"`
Page param.Opt[int64] `query:"page,omitzero" json:"-"`
PageSize param.Opt[int64] `query:"page_size,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (WebhookListEventsParams) URLQuery ¶ added in v0.7.0
func (r WebhookListEventsParams) URLQuery() (v url.Values, err error)
URLQuery serializes WebhookListEventsParams's query parameters as `url.Values`.
type WebhookListEventsResponse ¶ added in v0.7.0
type WebhookListEventsResponse struct {
ID string `json:"id" format:"uuid"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
DeliveryAttempts int64 `json:"delivery_attempts"`
DeliveryStatus string `json:"delivery_status"`
ErrorMessage string `json:"error_message" api:"nullable"`
// The exact event body that was delivered, or attempted, for this record. One of
// the six webhook envelopes:
//
// message — an outbound message changed status. message with event:
// message.received — someone replied to you. templates — a template was approved,
// rejected, paused or similar. channel — one of your markets moved in provisioning
// or compliance. contact — a consent signal: opt-in, opt-out or help. link — a
// tracked short link was clicked or a hosted file downloaded, or one expired or
// was revoked.
//
// Read field and event to tell which, the same way your endpoint does. The two
// message envelopes are the reason that is two fields and not one: they share a
// field and differ by event.
//
// Treat the list as open. It has grown twice — channel and then link — and a
// handler that rejects an envelope it does not recognise will break on the next
// addition rather than ignore it.
EventData WebhookListEventsResponseEventDataUnion `json:"event_data"`
EventType string `json:"event_type"`
HTTPStatusCode int64 `json:"http_status_code" api:"nullable"`
ProcessingCompletedAt time.Time `json:"processing_completed_at" api:"nullable" format:"date-time"`
ProcessingStartedAt time.Time `json:"processing_started_at" api:"nullable" format:"date-time"`
ResponseBody string `json:"response_body" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
DeliveryAttempts respjson.Field
DeliveryStatus respjson.Field
ErrorMessage respjson.Field
EventData respjson.Field
EventType respjson.Field
HTTPStatusCode respjson.Field
ProcessingCompletedAt respjson.Field
ProcessingStartedAt respjson.Field
ResponseBody respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebhookListEventsResponse) RawJSON ¶ added in v0.7.0
func (r WebhookListEventsResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookListEventsResponse) UnmarshalJSON ¶ added in v0.7.0
func (r *WebhookListEventsResponse) UnmarshalJSON(data []byte) error
type WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload ¶ added in v0.37.0
type WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload struct {
// The specific event within the family, for example message.delivered,
// message.received or contact.opt_out. Absent on events that have no subtype, so
// treat it as optional.
Event string `json:"event" api:"nullable"`
// The event family, for example message, templates or contact. Route on this
// first, then on event for the specific change.
Field string `json:"field"`
// Body of a link event: something happened to a tracked link Sent published on the
// customer's behalf. A link points either at a URL the customer supplied or at a
// file Sent hosts for them; LinkKind says which. Delivered when an eligible
// request is served, or when a published link reaches the end of its life.
//
// A click is a request, not a read receipt. link.clicked means the redirect was
// served; link.downloaded means bytes went out. Neither proves a person saw
// anything — messaging providers and link scanners fetch URLs on their own, which
// is what TrafficClass exists to tell apart. Filter on it before reporting a
// click-through rate; treat likely_human as a hint, never as delivery
// confirmation.
//
// RecordId identifies the link; the X-Webhook-Event-ID header identifies the
// delivery. One link is hit many times, so those are the two keys a subscriber
// needs: group by the first, deduplicate on the second — exactly as on every other
// family. The payload carries no event identifier of its own, for the same reason
// none of the others do.
//
// Nothing here identifies the visitor. No IP address and no visitor token crosses
// this boundary. Country, Device and Browser are coarse buckets derived at the
// edge and are absent whenever the request did not supply enough to derive them.
Payload WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload `json:"payload" api:"nullable"`
// The event-specific body.
RequestID string `json:"request_id" api:"nullable"`
// When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
// time, not the time the underlying change happened. Use the timestamp inside the
// payload for the latter.
Timestamp string `json:"timestamp"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Event respjson.Field
Field respjson.Field
Payload respjson.Field
RequestID respjson.Field
Timestamp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares this shape and varies only in Payload.
func (WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload) RawJSON ¶ added in v0.37.0
func (r WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload) UnmarshalJSON ¶ added in v0.37.0
func (r *WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload) UnmarshalJSON(data []byte) error
type WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload ¶ added in v0.37.0
type WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload struct {
// The link's public identifier — the eight-character code in the short URL, for
// example A78B2BU0. Unique across both kinds, and never reused, so it is the
// stable key to group one link's events by.
RecordID string `json:"record_id" api:"required"`
// Where the request appeared to come from, as an ISO 3166-1 alpha-2 code. Named
// separately from the country on a channel event, which is a destination market
// the customer registered for — this one is a property of a single visitor and is
// absent when the edge could not resolve it.
AccessCountry string `json:"access_country" api:"nullable"`
// How the request was served, when the edge recorded it. Free text describing the
// outcome — show it to a human rather than branching on it.
AccessOutcome string `json:"access_outcome" api:"nullable"`
// The requesting browser family, for example chrome or safari, or unknown. Derived
// from the user agent.
Browser string `json:"browser" api:"nullable"`
// How many bytes were served, for a file access. A ranged request reports the
// bytes in that range, not the size of the file, so several accesses of one file
// can each report a part.
BytesServed int64 `json:"bytes_served" api:"nullable"`
// The channel the message carrying this link went out on: sms, whatsapp, or rcs.
Channel string `json:"channel" api:"nullable"`
// The organization the link belongs to. Always the parent account, never a sender
// profile — read SenderProfileId for that.
//
// This family publishes the owner as an explicit pair rather than the single
// account_id the other families use. The pair says which organization and which
// profile without the subscriber deriving either, which is the trade: one more key
// against not having to know that account_id silently becomes the profile when one
// exists.
CustomerID string `json:"customer_id" format:"uuid"`
// The requesting device class: mobile, tablet, desktop or unknown. Derived from
// the user agent.
Device string `json:"device" api:"nullable"`
// What the link points at: url for a destination the customer supplied, file for
// media Sent hosts. Always present, and implied by the event — link.clicked is
// always url and link.downloaded always file — but published as its own field so a
// subscriber can branch on the kind without parsing the event name, the same
// separation the channel family keeps between its event and its status.
LinkKind string `json:"link_kind"`
// The message the link was published in.
//
// The event can arrive before the message is readable through GET /v3/messages: a
// provider may fetch a link within milliseconds of the send, and nothing here
// waits for the message row. Retry the read rather than treating an unknown id as
// an error.
MessageID string `json:"message_id" api:"nullable" format:"uuid"`
// When the access or lifecycle change actually happened, in UTC
// (yyyy-MM-ddTHH:mm:ssZ). The envelope's timestamp is when Sent emitted the event;
// this is when the thing occurred, and the two differ by the ingest delay.
OccurredAt string `json:"occurred_at"`
// The caller-supplied label tying this link back to a position in the message, for
// example body:0 for the first link in the body. Present when the link was created
// with one.
ReferenceKey string `json:"reference_key" api:"nullable"`
// The host of the page that linked here, when the request supplied one. The host
// only — never a full referring URL.
ReferrerHost string `json:"referrer_host" api:"nullable"`
// The HTTP method of the request that was served, for an access event. Omitted on
// link.expired and link.revoked, which describe no request.
RequestMethod string `json:"request_method" api:"nullable"`
// The sender profile that owns the link, or null when the organization owns it
// directly. Always on the wire so a handler reads one shape rather than branching
// on whether the key arrived.
//
// sender_profile_id, not profile_id: the API already publishes
// messaging_profile_id and sending_phone_number_profile_id for provider-side
// profiles, which are a different thing entirely. The unqualified name would read
// as one of those.
SenderProfileID string `json:"sender_profile_id" api:"nullable" format:"uuid"`
// The HTTP status Sent answered the request with: 302 for a link, 200 or 206 for a
// file. Omitted on lifecycle events.
StatusCode int64 `json:"status_code" api:"nullable"`
// A coarse guess at what made the request: likely_human, provider (a messaging
// platform prefetching the link), bot, or unknown. Derived from the user agent, so
// it is a hint for filtering noise rather than a fact to bill or report on.
TrafficClass string `json:"traffic_class" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
RecordID respjson.Field
AccessCountry respjson.Field
AccessOutcome respjson.Field
Browser respjson.Field
BytesServed respjson.Field
Channel respjson.Field
CustomerID respjson.Field
Device respjson.Field
LinkKind respjson.Field
MessageID respjson.Field
OccurredAt respjson.Field
ReferenceKey respjson.Field
ReferrerHost respjson.Field
RequestMethod respjson.Field
SenderProfileID respjson.Field
StatusCode respjson.Field
TrafficClass respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Body of a link event: something happened to a tracked link Sent published on the customer's behalf. A link points either at a URL the customer supplied or at a file Sent hosts for them; LinkKind says which. Delivered when an eligible request is served, or when a published link reaches the end of its life.
A click is a request, not a read receipt. link.clicked means the redirect was served; link.downloaded means bytes went out. Neither proves a person saw anything — messaging providers and link scanners fetch URLs on their own, which is what TrafficClass exists to tell apart. Filter on it before reporting a click-through rate; treat likely_human as a hint, never as delivery confirmation.
RecordId identifies the link; the X-Webhook-Event-ID header identifies the delivery. One link is hit many times, so those are the two keys a subscriber needs: group by the first, deduplicate on the second — exactly as on every other family. The payload carries no event identifier of its own, for the same reason none of the others do.
Nothing here identifies the visitor. No IP address and no visitor token crosses this boundary. Country, Device and Browser are coarse buckets derived at the edge and are absent whenever the request did not supply enough to derive them.
func (WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload) RawJSON ¶ added in v0.37.0
func (r WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload) UnmarshalJSON ¶ added in v0.37.0
func (r *WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload) UnmarshalJSON(data []byte) error
type WebhookListEventsResponseEventDataUnion ¶ added in v0.35.0
type WebhookListEventsResponseEventDataUnion struct {
Event string `json:"event"`
Field string `json:"field"`
// This field is a union of [MessageEventPayload], [InboundMessageEventPayload],
// [TemplateEventPayload], [ChannelEventPayload], [ContactEventPayload],
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload],
// [CallEventPayload]
Payload WebhookListEventsResponseEventDataUnionPayload `json:"payload"`
RequestID string `json:"request_id"`
Timestamp string `json:"timestamp"`
JSON struct {
Event respjson.Field
Field respjson.Field
Payload respjson.Field
RequestID respjson.Field
Timestamp respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WebhookListEventsResponseEventDataUnion contains all possible properties and values from MessageEvent, InboundMessageEvent, TemplateEvent, ChannelEvent, ContactEvent, WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload, CallEvent.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (WebhookListEventsResponseEventDataUnion) AsCallEvent ¶ added in v0.39.0
func (u WebhookListEventsResponseEventDataUnion) AsCallEvent() (v CallEvent)
func (WebhookListEventsResponseEventDataUnion) AsChannelEvent ¶ added in v0.36.0
func (u WebhookListEventsResponseEventDataUnion) AsChannelEvent() (v ChannelEvent)
func (WebhookListEventsResponseEventDataUnion) AsContactEvent ¶ added in v0.36.0
func (u WebhookListEventsResponseEventDataUnion) AsContactEvent() (v ContactEvent)
func (WebhookListEventsResponseEventDataUnion) AsInboundMessageEvent ¶ added in v0.35.0
func (u WebhookListEventsResponseEventDataUnion) AsInboundMessageEvent() (v InboundMessageEvent)
func (WebhookListEventsResponseEventDataUnion) AsMessageEvent ¶ added in v0.35.0
func (u WebhookListEventsResponseEventDataUnion) AsMessageEvent() (v MessageEvent)
func (WebhookListEventsResponseEventDataUnion) AsTemplateEvent ¶ added in v0.35.0
func (u WebhookListEventsResponseEventDataUnion) AsTemplateEvent() (v TemplateEvent)
func (WebhookListEventsResponseEventDataUnion) AsWebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload ¶ added in v0.37.0
func (u WebhookListEventsResponseEventDataUnion) AsWebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload() (v WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload)
func (WebhookListEventsResponseEventDataUnion) RawJSON ¶ added in v0.35.0
func (u WebhookListEventsResponseEventDataUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookListEventsResponseEventDataUnion) UnmarshalJSON ¶ added in v0.35.0
func (r *WebhookListEventsResponseEventDataUnion) UnmarshalJSON(data []byte) error
type WebhookListEventsResponseEventDataUnionPayload ¶ added in v0.35.0
type WebhookListEventsResponseEventDataUnionPayload struct {
// This field is from variant [MessageEventPayload].
MessageStatus string `json:"message_status"`
AccountID string `json:"account_id"`
AgentID string `json:"agent_id"`
// This field is from variant [MessageEventPayload].
Body string `json:"body"`
Channel string `json:"channel"`
MessageID string `json:"message_id"`
OutboundNumber string `json:"outbound_number"`
Reason string `json:"reason"`
ReasonCode string `json:"reason_code"`
// This field is from variant [MessageEventPayload].
ScheduleReason string `json:"schedule_reason"`
// This field is from variant [MessageEventPayload].
ScheduledAt string `json:"scheduled_at"`
TemplateID string `json:"template_id"`
TemplateName string `json:"template_name"`
UpdatedAt string `json:"updated_at"`
// This field is from variant [InboundMessageEventPayload].
InboundNumber string `json:"inbound_number"`
// This field is from variant [InboundMessageEventPayload].
ReceivedAt string `json:"received_at"`
// This field is from variant [InboundMessageEventPayload].
Media []InboundMessageEventPayloadMedia `json:"media"`
Text string `json:"text"`
Status string `json:"status"`
// This field is from variant [TemplateEventPayload].
WhatsappTemplateID string `json:"whatsapp_template_id"`
// This field is from variant [TemplateEventPayload].
AutoReplyAction string `json:"auto_reply_action"`
// This field is from variant [TemplateEventPayload].
Category string `json:"category"`
// This field is from variant [TemplateEventPayload].
Language string `json:"language"`
// This field is from variant [ChannelEventPayload].
Country string `json:"country"`
// This field is from variant [ChannelEventPayload].
Compliance ChannelEventPayloadCompliance `json:"compliance"`
// This field is from variant [ChannelEventPayload].
NumberType string `json:"number_type"`
// This field is from variant [ChannelEventPayload].
SenderValue string `json:"sender_value"`
// This field is from variant [ContactEventPayload].
OptOut bool `json:"opt_out"`
// This field is from variant [ContactEventPayload].
Source string `json:"source"`
// This field is from variant [ContactEventPayload].
ContactID string `json:"contact_id"`
// This field is from variant [ContactEventPayload].
From string `json:"from"`
// This field is from variant [ContactEventPayload].
To string `json:"to"`
// This field is from variant
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload].
RecordID string `json:"record_id"`
// This field is from variant
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload].
AccessCountry string `json:"access_country"`
// This field is from variant
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload].
AccessOutcome string `json:"access_outcome"`
// This field is from variant
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload].
Browser string `json:"browser"`
// This field is from variant
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload].
BytesServed int64 `json:"bytes_served"`
// This field is from variant
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload].
CustomerID string `json:"customer_id"`
// This field is from variant
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload].
Device string `json:"device"`
// This field is from variant
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload].
LinkKind string `json:"link_kind"`
// This field is from variant
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload].
OccurredAt string `json:"occurred_at"`
// This field is from variant
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload].
ReferenceKey string `json:"reference_key"`
// This field is from variant
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload].
ReferrerHost string `json:"referrer_host"`
// This field is from variant
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload].
RequestMethod string `json:"request_method"`
// This field is from variant
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload].
SenderProfileID string `json:"sender_profile_id"`
// This field is from variant
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload].
StatusCode int64 `json:"status_code"`
// This field is from variant
// [WebhookListEventsResponseEventDataSentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayloadPayload].
TrafficClass string `json:"traffic_class"`
// This field is from variant [CallEventPayload].
CallID string `json:"call_id"`
// This field is from variant [CallEventPayload].
DurationSeconds int64 `json:"duration_seconds"`
// This field is from variant [CallEventPayload].
Number string `json:"number"`
// This field is from variant [CallEventPayload].
Price float64 `json:"price"`
// This field is from variant [CallEventPayload].
RecordingID string `json:"recording_id"`
JSON struct {
MessageStatus respjson.Field
AccountID respjson.Field
AgentID respjson.Field
Body respjson.Field
Channel respjson.Field
MessageID respjson.Field
OutboundNumber respjson.Field
Reason respjson.Field
ReasonCode respjson.Field
ScheduleReason respjson.Field
ScheduledAt respjson.Field
TemplateID respjson.Field
TemplateName respjson.Field
UpdatedAt respjson.Field
InboundNumber respjson.Field
ReceivedAt respjson.Field
Media respjson.Field
Text respjson.Field
Status respjson.Field
WhatsappTemplateID respjson.Field
AutoReplyAction respjson.Field
Category respjson.Field
Language respjson.Field
Country respjson.Field
Compliance respjson.Field
NumberType respjson.Field
SenderValue respjson.Field
OptOut respjson.Field
Source respjson.Field
ContactID respjson.Field
From respjson.Field
To respjson.Field
RecordID respjson.Field
AccessCountry respjson.Field
AccessOutcome respjson.Field
Browser respjson.Field
BytesServed respjson.Field
CustomerID respjson.Field
Device respjson.Field
LinkKind respjson.Field
OccurredAt respjson.Field
ReferenceKey respjson.Field
ReferrerHost respjson.Field
RequestMethod respjson.Field
SenderProfileID respjson.Field
StatusCode respjson.Field
TrafficClass respjson.Field
CallID respjson.Field
DurationSeconds respjson.Field
Number respjson.Field
Price respjson.Field
RecordingID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WebhookListEventsResponseEventDataUnionPayload is an implicit subunion of WebhookListEventsResponseEventDataUnion. WebhookListEventsResponseEventDataUnionPayload provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the WebhookListEventsResponseEventDataUnion.
func (*WebhookListEventsResponseEventDataUnionPayload) UnmarshalJSON ¶ added in v0.35.0
func (r *WebhookListEventsResponseEventDataUnionPayload) UnmarshalJSON(data []byte) error
type WebhookListParams ¶ added in v0.7.0
type WebhookListParams struct {
IsActive param.Opt[bool] `query:"is_active,omitzero" json:"-"`
Search param.Opt[string] `query:"search,omitzero" json:"-"`
Page param.Opt[int64] `query:"page,omitzero" json:"-"`
PageSize param.Opt[int64] `query:"page_size,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (WebhookListParams) URLQuery ¶ added in v0.7.0
func (r WebhookListParams) URLQuery() (v url.Values, err error)
URLQuery serializes WebhookListParams's query parameters as `url.Values`.
type WebhookNewParams ¶ added in v0.7.0
type WebhookNewParams struct {
DisplayName param.Opt[string] `json:"display_name,omitzero"`
EndpointURL param.Opt[string] `json:"endpoint_url,omitzero"`
RetryCount param.Opt[int64] `json:"retry_count,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
TimeoutSeconds param.Opt[int64] `json:"timeout_seconds,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
EventFilters map[string][]string `json:"event_filters,omitzero"`
// Request-only: the events an organization webhook's sender profile clones
// receive, one clone per existing and future profile. Responses never return it.
SenderProfile WebhookNewParamsSenderProfile `json:"sender_profile,omitzero"`
EventTypes []string `json:"event_types,omitzero"`
// contains filtered or unexported fields
}
func (WebhookNewParams) MarshalJSON ¶ added in v0.7.0
func (r WebhookNewParams) MarshalJSON() (data []byte, err error)
func (*WebhookNewParams) UnmarshalJSON ¶ added in v0.7.0
func (r *WebhookNewParams) UnmarshalJSON(data []byte) error
type WebhookNewParamsSenderProfile ¶ added in v0.38.0
type WebhookNewParamsSenderProfile struct {
EventFilters map[string][]string `json:"event_filters,omitzero"`
EventTypes []string `json:"event_types,omitzero"`
// contains filtered or unexported fields
}
Request-only: the events an organization webhook's sender profile clones receive, one clone per existing and future profile. Responses never return it.
func (WebhookNewParamsSenderProfile) MarshalJSON ¶ added in v0.38.0
func (r WebhookNewParamsSenderProfile) MarshalJSON() (data []byte, err error)
func (*WebhookNewParamsSenderProfile) UnmarshalJSON ¶ added in v0.38.0
func (r *WebhookNewParamsSenderProfile) UnmarshalJSON(data []byte) error
type WebhookResponse ¶ added in v0.7.0
type WebhookResponse struct {
ID string `json:"id" format:"uuid"`
ConsecutiveFailures int64 `json:"consecutive_failures"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
// Which customer owns this — the key's own, or the profile named in x-profile-id.
// Says whose resource this is, which the resource's own id does not.
CustomerID string `json:"customer_id" format:"uuid"`
DisplayName string `json:"display_name"`
EndpointURL string `json:"endpoint_url"`
EventFilters map[string][]string `json:"event_filters" api:"nullable"`
EventTypes []string `json:"event_types"`
IsActive bool `json:"is_active"`
LastDeliveryAttemptAt time.Time `json:"last_delivery_attempt_at" api:"nullable" format:"date-time"`
LastSuccessfulDeliveryAt time.Time `json:"last_successful_delivery_at" api:"nullable" format:"date-time"`
RetryCount int64 `json:"retry_count"`
SigningSecret string `json:"signing_secret" api:"nullable"`
TimeoutSeconds int64 `json:"timeout_seconds"`
UpdatedAt time.Time `json:"updated_at" api:"nullable" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ConsecutiveFailures respjson.Field
CreatedAt respjson.Field
CustomerID respjson.Field
DisplayName respjson.Field
EndpointURL respjson.Field
EventFilters respjson.Field
EventTypes respjson.Field
IsActive respjson.Field
LastDeliveryAttemptAt respjson.Field
LastSuccessfulDeliveryAt respjson.Field
RetryCount respjson.Field
SigningSecret respjson.Field
TimeoutSeconds respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebhookResponse) RawJSON ¶ added in v0.7.0
func (r WebhookResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookResponse) UnmarshalJSON ¶ added in v0.7.0
func (r *WebhookResponse) UnmarshalJSON(data []byte) error
type WebhookRotateSecretParams ¶ added in v0.7.0
type WebhookRotateSecretParams struct {
MutationRequest MutationRequestParam
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (WebhookRotateSecretParams) MarshalJSON ¶ added in v0.7.0
func (r WebhookRotateSecretParams) MarshalJSON() (data []byte, err error)
func (*WebhookRotateSecretParams) UnmarshalJSON ¶ added in v0.7.0
func (r *WebhookRotateSecretParams) UnmarshalJSON(data []byte) error
type WebhookRotateSecretResponse ¶ added in v0.7.0
type WebhookRotateSecretResponse struct {
// The response data (null if error)
Data WebhookRotateSecretResponseData `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (WebhookRotateSecretResponse) RawJSON ¶ added in v0.7.0
func (r WebhookRotateSecretResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookRotateSecretResponse) UnmarshalJSON ¶ added in v0.7.0
func (r *WebhookRotateSecretResponse) UnmarshalJSON(data []byte) error
type WebhookRotateSecretResponseData ¶ added in v0.7.0
type WebhookRotateSecretResponseData struct {
SigningSecret string `json:"signing_secret"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
SigningSecret respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The response data (null if error)
func (WebhookRotateSecretResponseData) RawJSON ¶ added in v0.7.0
func (r WebhookRotateSecretResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookRotateSecretResponseData) UnmarshalJSON ¶ added in v0.7.0
func (r *WebhookRotateSecretResponseData) UnmarshalJSON(data []byte) error
type WebhookService ¶ added in v0.7.0
type WebhookService struct {
Options []option.RequestOption
}
Delivery reports and inbound messages, pushed to you.
Subscribe an endpoint to the event types you care about — `GET /v3/webhooks/event-types` lists them — and we POST each one as it happens, retrying on failure. Polling `GET /v3/messages/{id}` works and does not scale.
**Verify the signature.** Every delivery is signed with your endpoint's secret; an unverified endpoint is one anybody can post to. `rotate-secret` replaces it, `test` sends a specimen event, and `GET /v3/webhooks/{id}/events` shows what we tried to deliver and what your endpoint answered — which is the first place to look when something appears to be missing.
WebhookService contains methods and other services that help with interacting with the Sent 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.7.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) Delete ¶ added in v0.7.0
func (r *WebhookService) Delete(ctx context.Context, id string, body WebhookDeleteParams, opts ...option.RequestOption) (err error)
Deletes a webhook for the authenticated customer.
func (*WebhookService) Get ¶ added in v0.7.0
func (r *WebhookService) Get(ctx context.Context, id string, query WebhookGetParams, opts ...option.RequestOption) (res *APIResponseWebhook, err error)
Retrieves a single webhook by ID for the authenticated customer.
func (*WebhookService) List ¶ added in v0.7.0
func (r *WebhookService) List(ctx context.Context, params WebhookListParams, opts ...option.RequestOption) (res *pagination.WebhooksPage[WebhookResponse], err error)
Retrieves a paginated list of webhooks for the authenticated customer.
func (*WebhookService) ListAutoPaging ¶ added in v0.35.0
func (r *WebhookService) ListAutoPaging(ctx context.Context, params WebhookListParams, opts ...option.RequestOption) *pagination.WebhooksPageAutoPager[WebhookResponse]
Retrieves a paginated list of webhooks for the authenticated customer.
func (*WebhookService) ListEventTypes ¶ added in v0.7.0
func (r *WebhookService) ListEventTypes(ctx context.Context, query WebhookListEventTypesParams, opts ...option.RequestOption) (res *WebhookListEventTypesResponse, err error)
Retrieves all available webhook event types that can be subscribed to.
func (*WebhookService) ListEvents ¶ added in v0.7.0
func (r *WebhookService) ListEvents(ctx context.Context, id string, params WebhookListEventsParams, opts ...option.RequestOption) (res *pagination.WebhookEventsPage[WebhookListEventsResponse], err error)
Retrieves a paginated list of delivery events for the specified webhook. If the webhook is cloned onto your sender profiles, the list includes what those clones received; read payload.account_id to tell whose event it is.
func (*WebhookService) ListEventsAutoPaging ¶ added in v0.35.0
func (r *WebhookService) ListEventsAutoPaging(ctx context.Context, id string, params WebhookListEventsParams, opts ...option.RequestOption) *pagination.WebhookEventsPageAutoPager[WebhookListEventsResponse]
Retrieves a paginated list of delivery events for the specified webhook. If the webhook is cloned onto your sender profiles, the list includes what those clones received; read payload.account_id to tell whose event it is.
func (*WebhookService) New ¶ added in v0.7.0
func (r *WebhookService) New(ctx context.Context, params WebhookNewParams, opts ...option.RequestOption) (res *APIResponseWebhook, err error)
Creates a new webhook endpoint for the authenticated customer.
func (*WebhookService) RotateSecret ¶ added in v0.7.0
func (r *WebhookService) RotateSecret(ctx context.Context, id string, params WebhookRotateSecretParams, opts ...option.RequestOption) (res *WebhookRotateSecretResponse, err error)
Generates a new signing secret for the specified webhook. The old secret is immediately invalidated.
func (*WebhookService) Test ¶ added in v0.7.0
func (r *WebhookService) Test(ctx context.Context, id string, params WebhookTestParams, opts ...option.RequestOption) (res *WebhookTestResponse, err error)
Sends a test event to the specified webhook endpoint to verify connectivity.
func (*WebhookService) ToggleStatus ¶ added in v0.7.0
func (r *WebhookService) ToggleStatus(ctx context.Context, id string, params WebhookToggleStatusParams, opts ...option.RequestOption) (res *APIResponseWebhook, err error)
Activates or deactivates a webhook for the authenticated customer.
func (*WebhookService) Update ¶ added in v0.7.0
func (r *WebhookService) Update(ctx context.Context, id string, params WebhookUpdateParams, opts ...option.RequestOption) (res *APIResponseWebhook, err error)
Updates an existing webhook for the authenticated customer.
type WebhookTestParams ¶ added in v0.7.0
type WebhookTestParams struct {
EventType param.Opt[string] `json:"event_type,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (WebhookTestParams) MarshalJSON ¶ added in v0.7.0
func (r WebhookTestParams) MarshalJSON() (data []byte, err error)
func (*WebhookTestParams) UnmarshalJSON ¶ added in v0.7.0
func (r *WebhookTestParams) UnmarshalJSON(data []byte) error
type WebhookTestResponse ¶ added in v0.7.0
type WebhookTestResponse struct {
// The response data (null if error)
Data WebhookTestResponseData `json:"data" api:"nullable"`
// Error information
Error ErrorDetail `json:"error" api:"nullable"`
// Request and response metadata
Meta APIMeta `json:"meta"`
// Indicates whether the request was successful
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Error respjson.Field
Meta respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Standard API response envelope for all v3 endpoints
func (WebhookTestResponse) RawJSON ¶ added in v0.7.0
func (r WebhookTestResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookTestResponse) UnmarshalJSON ¶ added in v0.7.0
func (r *WebhookTestResponse) UnmarshalJSON(data []byte) error
type WebhookTestResponseData ¶ added in v0.7.0
type WebhookTestResponseData struct {
Message string `json:"message"`
Success bool `json:"success"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The response data (null if error)
func (WebhookTestResponseData) RawJSON ¶ added in v0.7.0
func (r WebhookTestResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookTestResponseData) UnmarshalJSON ¶ added in v0.7.0
func (r *WebhookTestResponseData) UnmarshalJSON(data []byte) error
type WebhookToggleStatusParams ¶ added in v0.7.0
type WebhookToggleStatusParams struct {
IsActive param.Opt[bool] `json:"is_active,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
// contains filtered or unexported fields
}
func (WebhookToggleStatusParams) MarshalJSON ¶ added in v0.7.0
func (r WebhookToggleStatusParams) MarshalJSON() (data []byte, err error)
func (*WebhookToggleStatusParams) UnmarshalJSON ¶ added in v0.7.0
func (r *WebhookToggleStatusParams) UnmarshalJSON(data []byte) error
type WebhookUpdateParams ¶ added in v0.7.0
type WebhookUpdateParams struct {
DisplayName param.Opt[string] `json:"display_name,omitzero"`
EndpointURL param.Opt[string] `json:"endpoint_url,omitzero"`
RetryCount param.Opt[int64] `json:"retry_count,omitzero"`
// Sandbox flag - when true, the operation is simulated without side effects Useful
// for testing integrations without actual execution
Sandbox param.Opt[bool] `json:"sandbox,omitzero"`
TimeoutSeconds param.Opt[int64] `json:"timeout_seconds,omitzero"`
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
XProfileID param.Opt[string] `header:"x-profile-id,omitzero" format:"uuid" json:"-"`
EventFilters map[string][]string `json:"event_filters,omitzero"`
// Request-only: the events an organization webhook's sender profile clones
// receive, one clone per existing and future profile. Responses never return it.
SenderProfile WebhookUpdateParamsSenderProfile `json:"sender_profile,omitzero"`
EventTypes []string `json:"event_types,omitzero"`
// contains filtered or unexported fields
}
func (WebhookUpdateParams) MarshalJSON ¶ added in v0.7.0
func (r WebhookUpdateParams) MarshalJSON() (data []byte, err error)
func (*WebhookUpdateParams) UnmarshalJSON ¶ added in v0.7.0
func (r *WebhookUpdateParams) UnmarshalJSON(data []byte) error
type WebhookUpdateParamsSenderProfile ¶ added in v0.38.0
type WebhookUpdateParamsSenderProfile struct {
EventFilters map[string][]string `json:"event_filters,omitzero"`
EventTypes []string `json:"event_types,omitzero"`
// contains filtered or unexported fields
}
Request-only: the events an organization webhook's sender profile clones receive, one clone per existing and future profile. Responses never return it.
func (WebhookUpdateParamsSenderProfile) MarshalJSON ¶ added in v0.38.0
func (r WebhookUpdateParamsSenderProfile) MarshalJSON() (data []byte, err error)
func (*WebhookUpdateParamsSenderProfile) UnmarshalJSON ¶ added in v0.38.0
func (r *WebhookUpdateParamsSenderProfile) 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
|
|
|
shared
|
|