Documentation
¶
Index ¶
- Variables
- func VerifyWebhookSignature(appSecret string, body []byte, signatureHeader string) error
- type AccountAlertSeverityEnum
- type AccountAlertsValue
- type AccountReviewUpdateValue
- type AccountUpdateAuthInternationalRateEligibility
- type AccountUpdateBanInfo
- type AccountUpdateEventEnum
- type AccountUpdatePartnerClientCertificationInfo
- type AccountUpdateRestrictionInfo
- type AccountUpdateValue
- type AccountUpdateViolationInfo
- type AccountUpdateWabaInfo
- type AdInteractionSourceMediaTypeEnum
- type AdInteractionSourceTypeEnum
- type Applinks
- type BusinessCapabilityUpdateValue
- type BusinessUsernameResponse
- type BusinessUsernameUpdateValue
- type CapabilityReview
- type Catalog
- type CatalogFetchResponseEdge
- type CatalogManager
- func (cm *CatalogManager) GetAllCatalogProducts(catalogId string, limit ...int) ([]ProductItem, error)
- func (cm *CatalogManager) GetAllCatalogs() (*CatalogFetchResponseEdge, error)deprecated
- func (cm *CatalogManager) GetAllCatalogsWithPagination(paginationInput ...*PaginationInput) (*PaginatedResponse[Catalog], error)
- func (cm *CatalogManager) GetCatalogProducts(catalogId string, paginationInput ...*PaginationInput) ([]ProductItem, *PaginationDetails, error)deprecated
- func (cm *CatalogManager) GetCatalogProductsWithPagination(catalogId string, paginationInput ...*PaginationInput) (*PaginatedResponse[ProductItem], error)
- type CatalogManagerConfig
- type Change
- type ChannelEvent
- type Conversation
- type CreatePhoneNumberResponse
- type DeleteQrCodeResponse
- type DeleteSuccessResponse
- type Entry
- type Error
- type EventManager
- func (em *EventManager) On(eventName events.EventType, handler func(events.BaseEvent)) events.EventType
- func (em *EventManager) Publish(event events.EventType, data events.BaseEvent) error
- func (em *EventManager) Subscribe(eventName events.EventType) (chan ChannelEvent, error)
- func (em *EventManager) Unsubscribe(id events.EventType)
- type GenerateQrCodeResponse
- type GetAllQrCodesResponse
- type HandleMessageSubscriptionEventPayload
- type HistoryValue
- type ImageCdnUrl
- type InteractiveNotificationTypeEnum
- type KeyValue
- type MediaManager
- type MediaMetadata
- type Message
- type MessageManager
- func (mm *MessageManager) ReadMessageOnly(messageId string) error
- func (mm *MessageManager) ReadMessageWithTyping(messageId string) error
- func (mm *MessageManager) Reply(message components.BaseMessage, phoneNumber string, replyTo string) (*MessageSendResponse, error)
- func (mm *MessageManager) ReplyToTarget(message components.BaseMessage, target MessageTarget, replyTo string) (*MessageSendResponse, error)
- func (mm *MessageManager) Send(message components.BaseMessage, phoneNumber string) (*MessageSendResponse, error)
- func (mm *MessageManager) SendMarketingMessage(message components.BaseMessage, phoneNumber string) (*MessageSendResponse, error)
- func (mm *MessageManager) SendMarketingMessageToTarget(message components.BaseMessage, target MessageTarget) (*MessageSendResponse, error)
- func (mm *MessageManager) SendToTarget(message components.BaseMessage, target MessageTarget) (*MessageSendResponse, error)
- type MessageSendError
- type MessageSendResponse
- type MessageStatusCategoryEnum
- type MessageStatusEnum
- type MessageTarget
- type MessageTargetType
- type MessageTemplateCategory
- type MessageTemplateComponentFormat
- type MessageTemplateComponentType
- type MessageTemplateComponentsUpdateValue
- type MessageTemplateCreationResponse
- type MessageTemplateStatus
- type MessagesValue
- type Metadata
- type NamedParamExample
- type NotificationMessageTypeEnum
- type NotificationPayloadAudioMessageSchemaType
- type NotificationPayloadButtonInteractionMessageSchemaType
- type NotificationPayloadButtonMessageSchemaType
- type NotificationPayloadContactMessageSchemaType
- type NotificationPayloadDocumentMessageSchemaType
- type NotificationPayloadErrorSchemaType
- type NotificationPayloadImageMessageSchemaType
- type NotificationPayloadInteractionMessageSchemaType
- type NotificationPayloadListInteractionMessageSchemaType
- type NotificationPayloadLocationMessageSchemaType
- type NotificationPayloadMessageContextSchemaType
- type NotificationPayloadOrderMessageSchemaType
- type NotificationPayloadReactionMessageSchemaType
- type NotificationPayloadStickerMessageSchemaType
- type NotificationPayloadSystemMessageSchemaType
- type NotificationPayloadTextMessageSchemaType
- type NotificationPayloadUnsupportedMessageSchemaType
- type NotificationPayloadVideoMessageSchemaType
- type NotificationReasonEnum
- type Origin
- type PaginatedResponse
- type PaginationCursors
- type PaginationDetails
- type PaginationInput
- type PaymentConfigurationUpdateValue
- type PhoneNumberManager
- func (manager *PhoneNumberManager) Create(phoneNumber, verifiedName, countryCode string) (CreatePhoneNumberResponse, error)
- func (manager *PhoneNumberManager) DeleteQrCode(phoneNumber, id string) (*DeleteQrCodeResponse, error)
- func (manager *PhoneNumberManager) DeleteUsername(phoneNumberId string) (*UsernameMutationResponse, error)
- func (manager *PhoneNumberManager) Fetch(phoneNumberId string) (*WhatsappBusinessAccountPhoneNumber, error)
- func (manager *PhoneNumberManager) FetchAll(getSandBoxNumbers bool) (*WhatsappBusinessAccountPhoneNumberEdge, error)
- func (manager *PhoneNumberManager) GenerateQrCode(phoneNumber string, prefilledMessage string) (*GenerateQrCodeResponse, error)
- func (manager *PhoneNumberManager) GetAllQrCodes(phoneNumber string) (*GetAllQrCodesResponse, error)
- func (manager *PhoneNumberManager) GetQrCodeById(phoneNumber, id string) (*GetAllQrCodesResponse, error)
- func (manager *PhoneNumberManager) GetUsername(phoneNumberId string) (*BusinessUsernameResponse, error)
- func (manager *PhoneNumberManager) RequestVerificationCode(phoneNumberId string, codeMethod VerifyCodeMethod, languageCode string) (RequestVerificationCodeResponse, error)
- func (manager *PhoneNumberManager) SetUsername(phoneNumberId, username string) (*UsernameMutationResponse, error)
- func (manager *PhoneNumberManager) UpdateQrCode(phoneNumber, id, prefilledMessage string) (*GenerateQrCodeResponse, error)
- func (manager *PhoneNumberManager) VerifyCode(phoneNumberId, verificationCode string) (VerifyCodeResponse, error)
- type PhoneNumberManagerConfig
- type PhoneNumberNameUpdateValue
- type PhoneNumberQualityUpdateCurrentLimitEnum
- type PhoneNumberQualityUpdateValue
- type Pricing
- type ProductError
- type ProductFeed
- type ProductGroup
- type ProductItem
- type ProductSet
- type ProductSetMetadata
- type Profile
- type ReferralInfo
- type RequestVerificationCodeResponse
- type SecurityValue
- type SenderContact
- type SmbAppStateSyncValue
- type SmbMessageEcho
- type SmbMessageEchoesValue
- type Status
- type StatusResponse
- type SystemNotificationTypeEnum
- type TemplateCategoryUpdateValue
- type TemplateManager
- func (manager *TemplateManager) Create(body WhatsappMessageTemplateCreateRequestBody) (*MessageTemplateCreationResponse, error)
- func (manager *TemplateManager) Delete(id string) error
- func (manager *TemplateManager) DeleteByName(name string) error
- func (manager *TemplateManager) Fetch(Id string) (*WhatsAppBusinessMessageTemplateNode, error)
- func (manager *TemplateManager) FetchAll() (*WhatsAppBusinessTemplatesFetchResponseEdge, error)deprecated
- func (manager *TemplateManager) FetchAllWithPagination(paginationInput ...*PaginationInput) (*PaginatedResponse[WhatsAppBusinessMessageTemplateNode], error)
- func (manager *TemplateManager) GetAllTemplates(limit ...int) ([]WhatsAppBusinessMessageTemplateNode, error)
- func (manager *TemplateManager) MigrateFromOtherBusinessAccount(sourcePageNumber int, sourceWabaId int) (*TemplateMigrationResponse, error)
- func (manager *TemplateManager) Update(templateId string, ...) (*MessageTemplateCreationResponse, error)
- type TemplateManagerConfig
- type TemplateMessageButtonType
- type TemplateMessageComponentButton
- type TemplateMessageComponentCard
- type TemplateMessageComponentExample
- type TemplateMessageLimitedTimeOfferParameter
- type TemplateMessagePreviewEdge
- type TemplateMessagePreviewNode
- type TemplateMessageQualityScore
- type TemplateMessageRejectionReasonEnum
- type TemplateMessageStatusUpdateDisableInfo
- type TemplateMessageStatusUpdateEventEnum
- type TemplateMessageStatusUpdateOtherInfo
- type TemplateMessageStatusUpdateRejectionInfo
- type TemplateMigrationResponse
- type TemplateQualityUpdateValue
- type TemplateStatusUpdateValue
- type UserIdUpdateValue
- type UserPreferencesValue
- type UsernameMutationResponse
- type VerifyCodeMethod
- type VerifyCodeResponse
- type WabaHealthStatus
- type WabaOfficialBusinessAccount
- type WabaQualityScore
- type WabaThroughput
- type WebApplink
- type WebhookFieldEnum
- type WebhookManager
- type WebhookManagerConfig
- type WhatsAppBusinessAccountMessageTemplateDeleteRequestBody
- type WhatsAppBusinessAccountMessageTemplatePreviewButton
- type WhatsAppBusinessAccountMessageTemplateUpdateRequestBody
- type WhatsAppBusinessHSMWhatsAppHSMComponent
- type WhatsAppBusinessMessageTemplateNode
- type WhatsAppBusinessTemplatesFetchResponseEdge
- type WhatsappApiNotificationPayloadSchemaType
- type WhatsappBusinessAccountPhoneNumber
- type WhatsappBusinessAccountPhoneNumberCodeVerificationStatus
- type WhatsappBusinessAccountPhoneNumberEdge
- type WhatsappBusinessAccountPhoneNumberMessagingLimitTier
- type WhatsappBusinessAccountPhoneNumberNameStatus
- type WhatsappBusinessAccountPhoneNumberPlatformType
- type WhatsappBusinessAccountPhoneNumberStatus
- type WhatsappMessageTemplateButtonCreateRequestBody
- type WhatsappMessageTemplateButtonCreateRequestBodyAlias
- type WhatsappMessageTemplateComponentCreateOrUpdateRequestBody
- type WhatsappMessageTemplateCreateRequestBody
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidWebhookSignature = errors.New("invalid webhook signature")
ErrInvalidWebhookSignature is returned by VerifyWebhookSignature when the X-Hub-Signature-256 header is missing, malformed or does not match.
Functions ¶
Types ¶
type AccountAlertSeverityEnum ¶
type AccountAlertSeverityEnum string
const ( AccountAlertSeverityEnumCritical AccountAlertSeverityEnum = "CRITICAL" AccountAlertSeverityEnumWarning AccountAlertSeverityEnum = "WARNING" )
type AccountAlertsValue ¶
type AccountAlertsValue struct {
EntityType string `json:"entity_type"`
EntityId string `json:"entity_id"`
AlertInfo struct {
AlertSeverity AccountAlertSeverityEnum `json:"alert_severity"`
AlertStatus string `json:"alert_status"`
AlertType string `json:"alert_type"`
AlertDescription string `json:"alert_description"`
} `json:"alert_info"`
}
type AccountReviewUpdateValue ¶
type AccountReviewUpdateValue struct {
Decision string `json:"decision"`
}
type AccountUpdateAuthInternationalRateEligibility ¶ added in v0.7.2
type AccountUpdateBanInfo ¶
type AccountUpdateEventEnum ¶
type AccountUpdateEventEnum string
const ( AccountUpdateEventEnumVerifiedAccount AccountUpdateEventEnum = "VERIFIED_ACCOUNT" AccountUpdateEventEnumDisabledAccount AccountUpdateEventEnum = "DISABLED_UPDATE" AccountUpdateEventEnumAccountViolation AccountUpdateEventEnum = "ACCOUNT_VIOLATION" AccountUpdateEventEnumAccountRestriction AccountUpdateEventEnum = "ACCOUNT_RESTRICTION" AccountUpdateEventEnumAccountDeleted AccountUpdateEventEnum = "ACCOUNT_DELETED" AccountUpdateEventEnumPartnerRemoved AccountUpdateEventEnum = "PARTNER_REMOVED" )
type AccountUpdatePartnerClientCertificationInfo ¶ added in v0.7.2
type AccountUpdateRestrictionInfo ¶
type AccountUpdateRestrictionInfo struct {
RestrictionType string `json:"restriction_type"`
// Expiration is a Unix timestamp. Meta sends a number; it is kept as text
// so string-formatted values are accepted too.
Expiration string `json:"expiration"`
Remediation string `json:"remediation,omitempty"`
}
func (*AccountUpdateRestrictionInfo) UnmarshalJSON ¶ added in v0.8.2
func (info *AccountUpdateRestrictionInfo) UnmarshalJSON(data []byte) error
type AccountUpdateValue ¶
type AccountUpdateValue struct {
PhoneNumber string `json:"phone_number,omitempty"`
Event AccountUpdateEventEnum `json:"event"`
Country string `json:"country,omitempty"` // Only for BUSINESS_PRIMARY_LOCATION_COUNTRY_UPDATE
WabaInfo *AccountUpdateWabaInfo `json:"waba_info,omitempty"` // For various events
ViolationInfo *AccountUpdateViolationInfo `json:"violation_info,omitempty"` // Only for ACCOUNT_VIOLATION
AuthInternationalRateEligibility *AccountUpdateAuthInternationalRateEligibility `json:"auth_international_rate_eligibility,omitempty"` // Only for AUTH_INTL_PRICE_ELIGIBILITY_UPDATE
BanInfo *AccountUpdateBanInfo `json:"ban_info,omitempty"` // Only for DISABLED_UPDATE
RestrictionInfo *AccountUpdateRestrictionInfo `json:"restriction_info,omitempty"` // Only for ACCOUNT_RESTRICTION; the first entry of RestrictionInfoList
PartnerClientCertificationInfo *AccountUpdatePartnerClientCertificationInfo `json:"partner_client_certification_info,omitempty"` // Only for PARTNER_CLIENT_CERTIFICATION_STATUS_UPDATE
// RestrictionInfoList holds every restriction. Meta sends restriction_info
// as a list; a single object is accepted too.
RestrictionInfoList []AccountUpdateRestrictionInfo `json:"-"`
}
func (*AccountUpdateValue) UnmarshalJSON ¶ added in v0.8.2
func (value *AccountUpdateValue) UnmarshalJSON(data []byte) error
type AccountUpdateViolationInfo ¶
type AccountUpdateViolationInfo struct {
ViolationType string `json:"violation_type"`
}
type AccountUpdateWabaInfo ¶ added in v0.7.2
type AccountUpdateWabaInfo struct {
WabaId string `json:"waba_id"`
OwnerBusinessId string `json:"owner_business_id"`
AdAccountLinked string `json:"ad_account_linked,omitempty"` // Only for AD_ACCOUNT_LINKED event
PartnerAppId string `json:"partner_app_id,omitempty"` // Only for PARTNER_APP_INSTALLED, PARTNER_APP_UNINSTALLED
SolutionId string `json:"solution_id,omitempty"` // Only if customer onboarded via multi-partner solution
SolutionPartnerBusinessIds []string `json:"solution_partner_business_ids,omitempty"` // Only if customer onboarded via multi-partner solution
}
type AdInteractionSourceMediaTypeEnum ¶
type AdInteractionSourceMediaTypeEnum string
const ( AdInteractionSourceMediaTypeImage AdInteractionSourceMediaTypeEnum = "image" AdInteractionSourceMediaTypeVideo AdInteractionSourceMediaTypeEnum = "video" )
type AdInteractionSourceTypeEnum ¶
type AdInteractionSourceTypeEnum string
const (
AdInteractionSourceTypeUnknown AdInteractionSourceTypeEnum = "unknown"
)
type Applinks ¶ added in v0.2.0
type Applinks struct {
Web WebApplink `json:"web"`
}
type BusinessUsernameResponse ¶ added in v0.8.0
type BusinessUsernameResponse struct {
Id string `json:"id,omitempty"`
Username string `json:"username,omitempty"`
Error *MessageSendError `json:"error,omitempty"`
}
BusinessUsernameResponse is the GET /<phone_number_id>/username result.
type BusinessUsernameUpdateValue ¶ added in v0.8.0
type BusinessUsernameUpdateValue struct {
Metadata struct {
DisplayPhoneNumber string `json:"display_phone_number,omitempty"`
PhoneNumberId string `json:"phone_number_id,omitempty"`
} `json:"metadata,omitempty"`
Username string `json:"username,omitempty"`
PreviousUsername string `json:"previous_username,omitempty"`
Event string `json:"event,omitempty"`
}
BusinessUsernameUpdateValue is the webhook value for the `business_username_updates` field (the business's own username changing for a phone number). All optional; raw values preserved.
type CapabilityReview ¶ added in v0.2.0
type Catalog ¶ added in v0.2.0
type Catalog struct {
// Basic fields
Id string `json:"id"`
Name string `json:"name"`
ProductCount int `json:"product_count"`
Vertical string `json:"vertical,omitempty"`
// Edge relationships (represented as slices for brevity)
Agencies *[]interface{} `json:"agencies,omitempty"`
AssignedUsers *[]interface{} `json:"assigned_users,omitempty"`
AutomotiveModels *[]interface{} `json:"automotive_models,omitempty"`
Categories *[]interface{} `json:"categories,omitempty"`
CheckBatchRequestStatus *[]interface{} `json:"check_batch_request_status,omitempty"`
DataSources *interface{} `json:"data_sources,omitempty"`
Destinations *[]interface{} `json:"destinations,omitempty"`
Diagnostics *[]interface{} `json:"diagnostics,omitempty"`
EventStats *[]interface{} `json:"event_stats,omitempty"`
ExternalEventSources *[]interface{} `json:"external_event_sources,omitempty"`
Flights *[]interface{} `json:"flights,omitempty"`
HomeListings *[]interface{} `json:"home_listings,omitempty"`
HotelRoomsBatch *[]interface{} `json:"hotel_rooms_batch,omitempty"`
Hotels *[]interface{} `json:"hotels,omitempty"`
PricingVariablesBatch *[]interface{} `json:"pricing_variables_batch,omitempty"`
ProductGroups *interface{} `json:"product_groups,omitempty"`
ProductSets *interface{} `json:"product_sets,omitempty"`
ProductSetsBatch *[]interface{} `json:"product_sets_batch,omitempty"`
Products struct {
Data []ProductItem `json:"data"`
} `json:"products,omitempty"`
VehicleOffers *[]interface{} `json:"vehicle_offers,omitempty"`
Vehicles *[]interface{} `json:"vehicles,omitempty"`
}
Update Catalog to use []ProductItem for Products.
type CatalogFetchResponseEdge ¶ added in v0.2.0
type CatalogFetchResponseEdge struct {
Data []Catalog `json:"data"`
Paging PaginationDetails `json:"paging"`
}
type CatalogManager ¶ added in v0.2.0
type CatalogManager struct {
// contains filtered or unexported fields
}
func NewCatalogManager ¶ added in v0.2.0
func NewCatalogManager(config *CatalogManagerConfig) *CatalogManager
func (*CatalogManager) GetAllCatalogProducts ¶ added in v0.7.0
func (cm *CatalogManager) GetAllCatalogProducts(catalogId string, limit ...int) ([]ProductItem, error)
GetAllCatalogProducts fetches all products across all pages for a given catalog This is a helper method that handles pagination automatically
func (*CatalogManager) GetAllCatalogs
deprecated
added in
v0.2.0
func (cm *CatalogManager) GetAllCatalogs() (*CatalogFetchResponseEdge, error)
Deprecated: Use GetAllCatalogsWithPagination for better control
func (*CatalogManager) GetAllCatalogsWithPagination ¶ added in v0.7.0
func (cm *CatalogManager) GetAllCatalogsWithPagination(paginationInput ...*PaginationInput) (*PaginatedResponse[Catalog], error)
GetAllCatalogsWithPagination retrieves catalogs with pagination support
func (*CatalogManager) GetCatalogProducts
deprecated
added in
v0.2.0
func (cm *CatalogManager) GetCatalogProducts(catalogId string, paginationInput ...*PaginationInput) ([]ProductItem, *PaginationDetails, error)
Deprecated: Use GetCatalogProductsWithPagination for better control
func (*CatalogManager) GetCatalogProductsWithPagination ¶ added in v0.7.0
func (cm *CatalogManager) GetCatalogProductsWithPagination(catalogId string, paginationInput ...*PaginationInput) (*PaginatedResponse[ProductItem], error)
GetCatalogProductsWithPagination retrieves products for a catalog with pagination support
type CatalogManagerConfig ¶ added in v0.2.0
type CatalogManagerConfig struct {
BusinessAccountId string
Requester *request_client.RequestClient
}
type Change ¶
type Change struct {
Value interface{} `json:"value"`
Field WebhookFieldEnum `json:"field"`
}
type ChannelEvent ¶
type ChannelEvent struct {
Type events.EventType // Type is the type of the event.
Data events.BaseEvent // Data is the data associated with the event.
}
ChannelEvent represents an event that can be published and subscribed to.
type Conversation ¶
type CreatePhoneNumberResponse ¶
type CreatePhoneNumberResponse struct {
Id string `json:"id,omitempty"`
}
type DeleteQrCodeResponse ¶
type DeleteQrCodeResponse struct {
Success bool `json:"success,omitempty"`
}
DeleteQrCodeResponse represents the response of deleting a QR code.
type DeleteSuccessResponse ¶ added in v0.1.0
type DeleteSuccessResponse struct {
Success bool `json:"success"`
}
type EventManager ¶
type EventManager struct {
sync.RWMutex // RWMutex is used to synchronize access to the subscribers map.
// contains filtered or unexported fields
}
EventManager is responsible for managing events and their subscribers.
Every subscriber gets its own buffered channel, so each subscriber receives every event published for its type. An EventManager must not be copied after first use; pass it around as a pointer.
func NewEventManager ¶
func NewEventManager() *EventManager
NewEventManager creates a new instance of EventManger.
func (*EventManager) On ¶
func (em *EventManager) On(eventName events.EventType, handler func(events.BaseEvent)) events.EventType
On registers a handler function for the specified event type. The handler is called, one event at a time, for every event published for that type. Calling On several times for one type registers several handlers, and each of them receives every event. A panic inside the handler is recovered and logged so it cannot crash the process. It returns the event type that the handler is registered for.
func (*EventManager) Publish ¶
Publish delivers an event to every subscriber of its type without blocking. If a subscriber's queue is full the event is dropped for that subscriber and an error is returned.
func (*EventManager) Subscribe ¶
func (em *EventManager) Subscribe(eventName events.EventType) (chan ChannelEvent, error)
Subscribe adds a new subscriber to the specified event type and returns its channel. Each call creates a new channel that receives every event of that type. The channel is closed by Unsubscribe.
func (*EventManager) Unsubscribe ¶
func (em *EventManager) Unsubscribe(id events.EventType)
Unsubscribe removes every subscriber of the specified event type and closes their channels, which stops the goroutines started by On for that type.
type GenerateQrCodeResponse ¶
type GenerateQrCodeResponse struct {
Code string `json:"code,omitempty"`
PrefilledMessage string `json:"prefilled_message,omitempty"`
DeepLinkUrl string `json:"deep_link_url,omitempty"`
QrImageUrl string `json:"qr_image_url,omitempty"`
}
GenerateQrCodeResponse represents the response of generating a QR code.
type GetAllQrCodesResponse ¶
type GetAllQrCodesResponse struct {
Data []GenerateQrCodeResponse `json:"data,omitempty"`
}
GetAllQrCodesResponse represents the response of getting all QR codes for a phone number.
type HandleMessageSubscriptionEventPayload ¶
type HandleMessageSubscriptionEventPayload struct {
Messages []Message `json:"messages"`
Statuses []Status `json:"statuses"`
PhoneNumber events.BusinessPhoneNumber `json:"phone_number_id"` // * this is the phone number to which this event has bee sent to
BusinessAccountId string `json:"business_account_id"` // * business account id to which this event has been sent to
SenderName string `json:"sender_name"`
// Sender identity from contacts[0] (BSUID/username rollout). Additive; empty
// for phone-only contacts.
SenderWaId string `json:"sender_wa_id"`
SenderUserId string `json:"sender_user_id"`
SenderParentUserId string `json:"sender_parent_user_id"`
SenderUsername string `json:"sender_username"`
}
type HistoryValue ¶ added in v0.7.2
type HistoryValue struct {
MessagingProduct string `json:"messaging_product"`
Metadata struct {
DisplayPhoneNumber string `json:"display_phone_number"`
PhoneNumberId string `json:"phone_number_id"`
} `json:"metadata"`
History []struct {
Metadata struct {
Phase int `json:"phase"`
ChunkOrder int `json:"chunk_order"`
Progress int `json:"progress"`
} `json:"metadata"`
Threads []struct {
Id string `json:"id"` // WhatsApp user phone number
Messages []struct {
From string `json:"from"`
To string `json:"to,omitempty"` // Only included if SMB message echo
Id string `json:"id"`
Timestamp string `json:"timestamp"`
Type string `json:"type"`
HistoryContext struct {
Status string `json:"status"` // Message status
} `json:"history_context"`
} `json:"messages"`
} `json:"threads"`
} `json:"history"`
}
type ImageCdnUrl ¶ added in v0.2.0
type InteractiveNotificationTypeEnum ¶
type InteractiveNotificationTypeEnum string
const ( NotificationTypeButtonReply InteractiveNotificationTypeEnum = "button_reply" NotificationTypeListReply InteractiveNotificationTypeEnum = "list_reply" )
type MediaManager ¶
type MediaManager struct {
// contains filtered or unexported fields
}
MediaManager is responsible for managing media related operations.
func NewMediaManager ¶
func NewMediaManager(requester request_client.RequestClient) *MediaManager
NewMediaManager creates a new instance of MediaManager.
func (*MediaManager) DeleteMedia ¶
func (mm *MediaManager) DeleteMedia(id string) (string, error)
func (*MediaManager) GetMediaUrlById ¶
func (mm *MediaManager) GetMediaUrlById(id string) (string, error)
func (*MediaManager) UploadMedia ¶ added in v0.1.0
func (mm *MediaManager) UploadMedia(phoneNumberId string, file io.Reader, filename, mimeType string) (string, error)
UploadMedia uploads a media file to WhatsApp's Cloud API.
type MediaMetadata ¶ added in v0.1.0
type Message ¶
type Message struct {
Id string `json:"id"`
From string `json:"from"`
FromUserId string `json:"from_user_id,omitempty"` // BSUID of the sender (identity rollout); empty for phone-only
FromParentUserId string `json:"from_parent_user_id,omitempty"` // parent BSUID of the sender when Meta includes it
Timestamp string `json:"timestamp"`
Type NotificationMessageTypeEnum `json:"type"`
GroupId string `json:"group_id,omitempty"`
Context NotificationPayloadMessageContextSchemaType `json:"context,omitempty"`
Errors []Error `json:"errors,omitempty"`
Referral *ReferralInfo `json:"referral,omitempty"`
NotificationPayloadTextMessageSchemaType `json:",inline"`
NotificationPayloadAudioMessageSchemaType `json:",inline"`
NotificationPayloadImageMessageSchemaType `json:",inline"`
NotificationPayloadButtonMessageSchemaType `json:",inline"`
NotificationPayloadDocumentMessageSchemaType `json:",inline"`
NotificationPayloadOrderMessageSchemaType `json:",inline"`
NotificationPayloadStickerMessageSchemaType `json:",inline"`
NotificationPayloadSystemMessageSchemaType `json:",inline"`
NotificationPayloadVideoMessageSchemaType `json:",inline"`
NotificationPayloadReactionMessageSchemaType `json:",inline"`
NotificationPayloadLocationMessageSchemaType `json:",inline"`
NotificationPayloadContactMessageSchemaType `json:",inline"`
NotificationPayloadInteractionMessageSchemaType `json:",inline"`
NotificationPayloadUnsupportedMessageSchemaType `json:",inline"`
}
type MessageManager ¶
type MessageManager struct {
PhoneNumberId string
// contains filtered or unexported fields
}
MessageManager is responsible for managing messages.
func NewMessageManager ¶
func NewMessageManager(requester request_client.RequestClient, phoneNumberId string) *MessageManager
NewMessageManager creates a new instance of MessageManager.
func (*MessageManager) ReadMessageOnly ¶ added in v0.5.0
func (mm *MessageManager) ReadMessageOnly(messageId string) error
ReadMessageOnly marks a message as read without showing typing indicator. This is a convenience method for ReadMessage(messageId, false).
func (*MessageManager) ReadMessageWithTyping ¶ added in v0.5.0
func (mm *MessageManager) ReadMessageWithTyping(messageId string) error
ReadMessageWithTyping marks a message as read and shows typing indicator. This is a convenience method for ReadMessage(messageId, true).
func (*MessageManager) Reply ¶ added in v0.3.3
func (mm *MessageManager) Reply(message components.BaseMessage, phoneNumber string, replyTo string) (*MessageSendResponse, error)
Reply sends a reply message to a phone number. Backward-compatible wrapper over ReplyToTarget with a phone target.
func (*MessageManager) ReplyToTarget ¶ added in v0.8.0
func (mm *MessageManager) ReplyToTarget(message components.BaseMessage, target MessageTarget, replyTo string) (*MessageSendResponse, error)
ReplyToTarget sends a reply (in-reply-to replyTo) to any MessageTarget.
func (*MessageManager) Send ¶
func (mm *MessageManager) Send(message components.BaseMessage, phoneNumber string) (*MessageSendResponse, error)
Send sends a message to a phone number. Backward-compatible wrapper over SendToTarget with a phone target.
func (*MessageManager) SendMarketingMessage ¶ added in v0.7.4
func (mm *MessageManager) SendMarketingMessage(message components.BaseMessage, phoneNumber string) (*MessageSendResponse, error)
SendMarketingMessage sends via the MM Lite API to a phone number. Backward-compatible wrapper over SendMarketingMessageToTarget.
func (*MessageManager) SendMarketingMessageToTarget ¶ added in v0.8.0
func (mm *MessageManager) SendMarketingMessageToTarget(message components.BaseMessage, target MessageTarget) (*MessageSendResponse, error)
SendMarketingMessageToTarget sends via the MM Lite API to any MessageTarget. Only works if the WABA is eligible and onboarded on the MM Lite API.
func (*MessageManager) SendToTarget ¶ added in v0.8.0
func (mm *MessageManager) SendToTarget(message components.BaseMessage, target MessageTarget) (*MessageSendResponse, error)
SendToTarget sends a message to any MessageTarget (phone or BSUID/parent BSUID). Phone targets serialize as `to`, BSUID/parent as `recipient`.
type MessageSendError ¶
type MessageSendError struct {
Message string `json:"message"` // Error description.
Type string `json:"type"` // Error type (e.g., OAuthException).
Code int `json:"code"` // Error code.
ErrorData struct {
MessagingProduct string `json:"messaging_product"`
Details string `json:"details"`
} `json:"error_data"` // Additional error details.
ErrorSubcode int `json:"error_subcode"`
FbtraceID string `json:"fbtrace_id"`
}
MessageSendError represents the error object in an API response.
type MessageSendResponse ¶
type MessageSendResponse struct {
MessagingProduct string `json:"messaging_product"`
Contacts []struct {
Input string `json:"input"`
WaID string `json:"wa_id"`
// UserId is the recipient BSUID when the send targeted a BSUID
// (identity rollout). Empty for phone-targeted sends — do not treat
// its absence as a parse failure.
UserId string `json:"user_id,omitempty"`
} `json:"contacts"`
Messages []struct {
ID string `json:"id"`
} `json:"messages"`
Error *MessageSendError `json:"error,omitempty"`
}
MessageSendResponse represents the structured API response for sending a message.
type MessageStatusCategoryEnum ¶
type MessageStatusCategoryEnum string
const (
MessageStatusCategorySent MessageStatusCategoryEnum = "sent"
)
type MessageStatusEnum ¶
type MessageStatusEnum string
const ( MessageStatusDelivered MessageStatusEnum = "delivered" MessageStatusRead MessageStatusEnum = "read" MessageStatusUnDelivered MessageStatusEnum = "undelivered" MessageStatusFailed MessageStatusEnum = "failed" MessageStatusSent MessageStatusEnum = "sent" )
type MessageTarget ¶ added in v0.8.0
type MessageTarget struct {
Type MessageTargetType
Value string
}
MessageTarget identifies who a message is sent to, independent of message type. Use the constructors below; the zero value is not a valid target.
func NewBSUIDTarget ¶ added in v0.8.0
func NewBSUIDTarget(bsuid string) MessageTarget
NewBSUIDTarget targets a recipient by business-scoped user id (serialized as `recipient`).
func NewParentBSUIDTarget ¶ added in v0.8.0
func NewParentBSUIDTarget(parentBSUID string) MessageTarget
NewParentBSUIDTarget targets a recipient by parent business-scoped user id (serialized as `recipient`).
func NewPhoneTarget ¶ added in v0.8.0
func NewPhoneTarget(phoneNumber string) MessageTarget
NewPhoneTarget targets a recipient by phone number (serialized as `to`). This is the historical default and keeps existing behavior byte-for-byte.
type MessageTargetType ¶ added in v0.8.0
type MessageTargetType string
MessageTargetType is how a send is addressed. Phone targets serialize as Meta's `to`; BSUID and parent-BSUID targets serialize as `recipient` (Meta business-scoped user id send contract).
const ( MessageTargetTypePhone MessageTargetType = "phone" MessageTargetTypeBSUID MessageTargetType = "bsuid" MessageTargetTypeParentBSUID MessageTargetType = "parent_bsuid" )
type MessageTemplateCategory ¶
type MessageTemplateCategory string
MessageTemplateCategory represents the category of a WhatsApp Business message template.
const ( MessageTemplateCategoryUtility MessageTemplateCategory = "UTILITY" MessageTemplateCategoryMarketing MessageTemplateCategory = "MARKETING" MessageTemplateCategoryAuthentication MessageTemplateCategory = "AUTHENTICATION" )
type MessageTemplateComponentFormat ¶
type MessageTemplateComponentFormat string
MessageTemplateComponentFormat represents the format of a template component.
const ( MessageTemplateComponentFormatText MessageTemplateComponentFormat = "TEXT" MessageTemplateComponentFormatImage MessageTemplateComponentFormat = "IMAGE" MessageTemplateComponentFormatDocument MessageTemplateComponentFormat = "DOCUMENT" MessageTemplateComponentFormatProduct MessageTemplateComponentFormat = "PRODUCT" MessageTemplateComponentFormatVideo MessageTemplateComponentFormat = "VIDEO" MessageTemplateComponentFormatLocation MessageTemplateComponentFormat = "LOCATION" )
type MessageTemplateComponentType ¶
type MessageTemplateComponentType string
MessageTemplateComponentType represents the type of a template component.
const ( MessageTemplateComponentTypeGreeting MessageTemplateComponentType = "GREETING" MessageTemplateComponentTypeHeader MessageTemplateComponentType = "HEADER" MessageTemplateComponentTypeBody MessageTemplateComponentType = "BODY" MessageTemplateComponentTypeButtons MessageTemplateComponentType = "BUTTONS" MessageTemplateComponentTypeCarousel MessageTemplateComponentType = "CAROUSEL" // this appears in case of product caraousel MessageTemplateComponentTypeLimitedTimeOffer MessageTemplateComponentType = "LIMITED_TIME_OFFER" )
type MessageTemplateComponentsUpdateValue ¶ added in v0.7.2
type MessageTemplateComponentsUpdateValue struct {
MessageTemplateId int64 `json:"message_template_id"`
MessageTemplateName string `json:"message_template_name"`
MessageTemplateLanguage string `json:"message_template_language"`
MessageTemplateElement string `json:"message_template_element"` // Template body text
MessageTemplateTitle string `json:"message_template_title,omitempty"` // Only if template has text header
MessageTemplateButtons []struct {
MessageTemplateButtonType string `json:"message_template_button_type"`
MessageTemplateButtonText string `json:"message_template_button_text"`
MessageTemplateButtonUrl string `json:"message_template_button_url,omitempty"` // Only for url buttons
MessageTemplateButtonPhoneNumber string `json:"message_template_button_phone_number,omitempty"` // Only for phone number buttons
} `json:"message_template_buttons,omitempty"` // Only if template has url or phone number button
}
type MessageTemplateCreationResponse ¶
type MessageTemplateCreationResponse struct {
Id string `json:"id,omitempty"`
Status MessageTemplateStatus `json:"status,omitempty"`
Category MessageTemplateCategory `json:"category,omitempty"`
// Success is set by Update, whose response is {"success": true}.
Success bool `json:"success,omitempty"`
}
MessageTemplateCreationResponse represents the response after creating a template.
type MessageTemplateStatus ¶
type MessageTemplateStatus string
MessageTemplateStatus represents the status of a WhatsApp Business message template.
const ( MessageTemplateStatusApproved MessageTemplateStatus = "APPROVED" MessageTemplateStatusRejected MessageTemplateStatus = "REJECTED" MessageTemplateStatusPending MessageTemplateStatus = "PENDING" )
type MessagesValue ¶
type MessagesValue struct {
MessagingProduct string `json:"messaging_product"`
Metadata Metadata `json:"metadata"`
Contacts []SenderContact `json:"contacts,omitempty"`
Statuses []Status `json:"statuses,omitempty"`
Messages []Message `json:"messages,omitempty"`
Errors []Error `json:"errors,omitempty"`
}
type NamedParamExample ¶ added in v0.1.1
type NamedParamExample struct {
ParamName string `json:"param_name"`
Example string `json:"example"`
}
NamedParamExample represents a single named parameter and its example value.
type NotificationMessageTypeEnum ¶
type NotificationMessageTypeEnum string
const ( NotificationMessageTypeText NotificationMessageTypeEnum = "text" NotificationMessageTypeAudio NotificationMessageTypeEnum = "audio" NotificationMessageTypeImage NotificationMessageTypeEnum = "image" NotificationMessageTypeButton NotificationMessageTypeEnum = "button" NotificationMessageTypeDocument NotificationMessageTypeEnum = "document" NotificationMessageTypeOrder NotificationMessageTypeEnum = "order" NotificationMessageTypeSticker NotificationMessageTypeEnum = "sticker" NotificationMessageTypeSystem NotificationMessageTypeEnum = "system" NotificationMessageTypeVideo NotificationMessageTypeEnum = "video" NotificationMessageTypeReaction NotificationMessageTypeEnum = "reaction" NotificationMessageTypeInteractive NotificationMessageTypeEnum = "interactive" NotificationMessageTypeUnknown NotificationMessageTypeEnum = "unknown" NotificationMessageTypeLocation NotificationMessageTypeEnum = "location" NotificationMessageTypeContacts NotificationMessageTypeEnum = "contacts" NotificationMessageTypeUnsupported NotificationMessageTypeEnum = "unsupported" )
type NotificationPayloadAudioMessageSchemaType ¶
type NotificationPayloadAudioMessageSchemaType struct {
Audio struct {
Id string `json:"id,omitempty"`
MIMEType string `json:"mime_type,omitempty"`
SHA256 string `json:"sha256,omitempty"`
Url string `json:"url,omitempty"`
Voice bool `json:"voice,omitempty"` // Is Voice Recording?
} `json:"audio,omitempty"`
}
type NotificationPayloadContactMessageSchemaType ¶
type NotificationPayloadContactMessageSchemaType struct {
Contacts []components.Contact `json:"contacts"`
}
type NotificationPayloadDocumentMessageSchemaType ¶
type NotificationPayloadDocumentMessageSchemaType struct {
Document struct {
Id string `json:"id"`
MIMEType string `json:"mime_type"`
SHA256 string `json:"sha256"`
Caption string `json:"caption,omitempty"`
Filename string `json:"filename,omitempty"`
Link string `json:"link,omitempty"`
} `json:"document,omitempty"`
}
type NotificationPayloadInteractionMessageSchemaType ¶
type NotificationPayloadInteractionMessageSchemaType struct {
Interactive struct {
Type InteractiveNotificationTypeEnum `json:"type"`
NotificationPayloadButtonInteractionMessageSchemaType `json:",inline,omitempty"`
NotificationPayloadListInteractionMessageSchemaType `json:",inline,omitempty"`
} `json:"interactive,omitempty"`
}
type NotificationPayloadMessageContextSchemaType ¶
type NotificationPayloadMessageContextSchemaType struct {
Forwarded bool `json:"forwarded,omitempty"`
FrequentlyForwarded bool `json:"frequently_forwarded,omitempty"`
From string `json:"from,omitempty"`
Id string `json:"id"`
ReferredProduct struct {
CatalogId string `json:"catalog_id"`
ProductRetailerId string `json:"product_retailer_id"`
} `json:"referred_product,omitempty"`
}
type NotificationPayloadOrderMessageSchemaType ¶
type NotificationPayloadOrderMessageSchemaType struct {
// OrderText string `json:"text"`
Order struct {
CatalogId string `json:"catalog_id"`
ProductItems []struct {
ProductRetailerId string `json:"product_retailer_id"`
Quantity int `json:"quantity"`
ItemPrice float64 `json:"item_price"`
Currency string `json:"currency"`
} `json:"product_items"`
Text *string `json:"text,omitempty"`
} `json:"order,omitempty"`
}
type NotificationPayloadSystemMessageSchemaType ¶
type NotificationPayloadSystemMessageSchemaType struct {
System struct {
Body string `json:"body"`
Type SystemNotificationTypeEnum `json:"type"`
WaId string `json:"wa_id"`
} `json:"system,omitempty"`
}
type NotificationPayloadTextMessageSchemaType ¶
type NotificationPayloadTextMessageSchemaType struct {
Text struct {
Body string `json:"body"`
} `json:"text,omitempty"`
}
type NotificationPayloadUnsupportedMessageSchemaType ¶ added in v0.7.2
type NotificationPayloadUnsupportedMessageSchemaType struct {
Unsupported struct {
Type string `json:"type"`
} `json:"unsupported,omitempty"`
}
type NotificationPayloadVideoMessageSchemaType ¶
type NotificationPayloadVideoMessageSchemaType struct {
Video struct {
Id string `json:"id"`
MIMEType string `json:"mime_type"`
SHA256 string `json:"sha256"`
Caption string `json:"caption,omitempty"`
Filename string `json:"filename,omitempty"`
Url string `json:"url,omitempty"`
} `json:"video,omitempty"`
}
type NotificationReasonEnum ¶
type NotificationReasonEnum string
const (
NotificationReasonMessage NotificationReasonEnum = "message"
)
type Origin ¶
type Origin struct {
Type MessageStatusCategoryEnum `json:"type"`
ExpirationTimestamp string `json:"expiration_timestamp,omitempty"`
}
type PaginatedResponse ¶ added in v0.7.0
type PaginatedResponse[T any] struct { Data []T `json:"data"` Paging PaginationDetails `json:"paging,omitempty"` }
PaginatedResponse is a generic wrapper for paginated responses
type PaginationCursors ¶ added in v0.7.0
type PaginationCursors struct {
Before string `json:"before,omitempty"`
After string `json:"after,omitempty"`
}
PaginationCursors represents the before/after cursors used in cursor-based pagination
type PaginationDetails ¶ added in v0.7.0
type PaginationDetails struct {
Cursors PaginationCursors `json:"cursors,omitempty"`
Next string `json:"next,omitempty"`
Previous string `json:"previous,omitempty"`
}
PaginationDetails contains the pagination metadata returned by WhatsApp API
func (*PaginationDetails) GetNextCursor ¶ added in v0.7.0
func (pd *PaginationDetails) GetNextCursor() string
GetNextCursor returns the cursor for the next page
func (*PaginationDetails) GetPreviousCursor ¶ added in v0.7.0
func (pd *PaginationDetails) GetPreviousCursor() string
GetPreviousCursor returns the cursor for the previous page
func (*PaginationDetails) HasNextPage ¶ added in v0.7.0
func (pd *PaginationDetails) HasNextPage() bool
HasNextPage checks if there's a next page available
func (*PaginationDetails) HasPreviousPage ¶ added in v0.7.0
func (pd *PaginationDetails) HasPreviousPage() bool
HasPreviousPage checks if there's a previous page available
type PaginationInput ¶ added in v0.7.0
type PaginationInput struct {
Limit int `json:"limit,omitempty"` // Number of results per page
After string `json:"after,omitempty"` // Cursor for next page
Before string `json:"before,omitempty"` // Cursor for previous page
}
PaginationInput represents the pagination parameters that can be passed to API calls
type PaymentConfigurationUpdateValue ¶ added in v0.7.2
type PaymentConfigurationUpdateValue struct {
ConfigurationName string `json:"configuration_name"`
ProviderName string `json:"provider_name"`
ProviderMid string `json:"provider_mid"`
Status string `json:"status"`
CreatedTimestamp int64 `json:"created_timestamp"`
UpdatedTimestamp int64 `json:"updated_timestamp"`
}
type PhoneNumberManager ¶
type PhoneNumberManager struct {
// contains filtered or unexported fields
}
PhoneNumberManager is responsible for managing phone numbers for WhatsApp Business API and phone number specific operations.
func NewPhoneNumberManager ¶
func NewPhoneNumberManager(config *PhoneNumberManagerConfig) *PhoneNumberManager
NewPhoneNumberManager creates a new instance of PhoneNumberManager.
func (*PhoneNumberManager) Create ¶
func (manager *PhoneNumberManager) Create(phoneNumber, verifiedName, countryCode string) (CreatePhoneNumberResponse, error)
func (*PhoneNumberManager) DeleteQrCode ¶
func (manager *PhoneNumberManager) DeleteQrCode(phoneNumber, id string) (*DeleteQrCodeResponse, error)
DeleteQrCode deletes a QR code by its ID for the specified phone number.
func (*PhoneNumberManager) DeleteUsername ¶ added in v0.8.0
func (manager *PhoneNumberManager) DeleteUsername(phoneNumberId string) (*UsernameMutationResponse, error)
DeleteUsername removes the business username for the phone number id.
func (*PhoneNumberManager) Fetch ¶
func (manager *PhoneNumberManager) Fetch(phoneNumberId string) (*WhatsappBusinessAccountPhoneNumber, error)
Fetch fetches a phone number by its ID.
func (*PhoneNumberManager) FetchAll ¶
func (manager *PhoneNumberManager) FetchAll(getSandBoxNumbers bool) (*WhatsappBusinessAccountPhoneNumberEdge, error)
FetchAll fetches the business account's LIVE phone numbers.
getSandBoxNumbers is currently ignored: only numbers with account_mode LIVE are returned, as in every previous release.
func (*PhoneNumberManager) GenerateQrCode ¶
func (manager *PhoneNumberManager) GenerateQrCode(phoneNumber string, prefilledMessage string) (*GenerateQrCodeResponse, error)
GenerateQrCode generates a QR code for the specified phone number with the given prefilled message.
func (*PhoneNumberManager) GetAllQrCodes ¶
func (manager *PhoneNumberManager) GetAllQrCodes(phoneNumber string) (*GetAllQrCodesResponse, error)
GetAllQrCodes gets all QR codes for the specified phone number.
func (*PhoneNumberManager) GetQrCodeById ¶
func (manager *PhoneNumberManager) GetQrCodeById(phoneNumber, id string) (*GetAllQrCodesResponse, error)
GetQrCodeById gets a QR code by its ID for the specified phone number.
func (*PhoneNumberManager) GetUsername ¶ added in v0.8.0
func (manager *PhoneNumberManager) GetUsername(phoneNumberId string) (*BusinessUsernameResponse, error)
GetUsername fetches the current business username for the phone number id. Username is empty when none is set.
func (*PhoneNumberManager) RequestVerificationCode ¶
func (manager *PhoneNumberManager) RequestVerificationCode(phoneNumberId string, codeMethod VerifyCodeMethod, languageCode string) (RequestVerificationCodeResponse, error)
func (*PhoneNumberManager) SetUsername ¶ added in v0.8.0
func (manager *PhoneNumberManager) SetUsername(phoneNumberId, username string) (*UsernameMutationResponse, error)
SetUsername sets (or changes) the business username for the phone number id.
func (*PhoneNumberManager) UpdateQrCode ¶
func (manager *PhoneNumberManager) UpdateQrCode(phoneNumber, id, prefilledMessage string) (*GenerateQrCodeResponse, error)
UpdateQrCode updates a QR code by its ID for the specified phone number with the given prefilled message.
func (*PhoneNumberManager) VerifyCode ¶
func (manager *PhoneNumberManager) VerifyCode(phoneNumberId, verificationCode string) (VerifyCodeResponse, error)
type PhoneNumberManagerConfig ¶
type PhoneNumberManagerConfig struct {
BusinessAccountId string
ApiAccessToken string
Requester *request_client.RequestClient
}
PhoneNumberManagerConfig holds the configuration for PhoneNumberManager.
type PhoneNumberQualityUpdateCurrentLimitEnum ¶ added in v0.3.0
type PhoneNumberQualityUpdateCurrentLimitEnum string
const ( PhoneNumberQualityUpdateCurrentLimitEnumTier50 PhoneNumberQualityUpdateCurrentLimitEnum = "TIER_50" PhoneNumberQualityUpdateCurrentLimitEnumTier250 PhoneNumberQualityUpdateCurrentLimitEnum = "TIER_250" PhoneNumberQualityUpdateCurrentLimitEnumTier1K PhoneNumberQualityUpdateCurrentLimitEnum = "TIER_1K" PhoneNumberQualityUpdateCurrentLimitEnumTier10K PhoneNumberQualityUpdateCurrentLimitEnum = "TIER_10K" PhoneNumberQualityUpdateCurrentLimitEnumTier100K PhoneNumberQualityUpdateCurrentLimitEnum = "TIER_100K" PhoneNumberQualityUpdateCurrentLimitEnumTierUnlimited PhoneNumberQualityUpdateCurrentLimitEnum = "TIER_UNLIMITED" )
type PhoneNumberQualityUpdateValue ¶
type PhoneNumberQualityUpdateValue struct {
DisplayPhoneNumber string `json:"display_phone_number"`
Event string `json:"event"`
CurrentLimit PhoneNumberQualityUpdateCurrentLimitEnum `json:"current_limit"`
// OldLimit is only sent for messaging limit changes.
OldLimit PhoneNumberQualityUpdateCurrentLimitEnum `json:"old_limit,omitempty"`
// MaxDailyConversationsPerBusiness replaces CurrentLimit and OldLimit in
// newer payloads.
MaxDailyConversationsPerBusiness string `json:"max_daily_conversations_per_business,omitempty"`
}
type Pricing ¶
type Pricing struct {
Billable bool `json:"billable"`
PricingModel string `json:"pricing_model"`
Category MessageStatusCategoryEnum `json:"category"`
}
type ProductError ¶ added in v0.3.7
type ProductFeed ¶ added in v0.3.4
type ProductGroup ¶ added in v0.2.0
type ProductItem ¶ added in v0.2.0
type ProductItem struct {
Id string `json:"id"`
AdditionalImageCdnUrls [][]ImageCdnUrl `json:"additional_image_cdn_urls,omitempty"`
AdditionalImageUrls []string `json:"additional_image_urls,omitempty"`
AdditionalVariantAttributes []KeyValue `json:"additional_variant_attributes,omitempty"`
AgeGroup string `json:"age_group,omitempty"`
Applinks *Applinks `json:"applinks,omitempty"`
Availability string `json:"availability,omitempty"`
Brand string `json:"brand,omitempty"`
CapabilityToReviewStatus []KeyValue `json:"capability_to_review_status,omitempty"`
Category string `json:"category,omitempty"`
CategorySpecificFields interface{} `json:"category_specific_fields,omitempty"`
Color string `json:"color,omitempty"`
CommerceInsights string `json:"commerce_insights,omitempty"`
Condition string `json:"condition,omitempty"`
Currency string `json:"currency,omitempty"`
CustomData []KeyValue `json:"custom_data,omitempty"`
CustomLabel0 string `json:"custom_label_0,omitempty"`
CustomLabel1 string `json:"custom_label_1,omitempty"`
CustomLabel2 string `json:"custom_label_2,omitempty"`
CustomLabel3 string `json:"custom_label_3,omitempty"`
CustomLabel4 string `json:"custom_label_4,omitempty"`
CustomNumber0 string `json:"custom_number_0,omitempty"`
CustomNumber1 string `json:"custom_number_1,omitempty"`
CustomNumber2 string `json:"custom_number_2,omitempty"`
CustomNumber3 string `json:"custom_number_3,omitempty"`
CustomNumber4 string `json:"custom_number_4,omitempty"`
Description string `json:"description,omitempty"`
Errors []ProductError `json:"errors,omitempty"`
ExpirationDate string `json:"expiration_date,omitempty"`
FbProductCategory string `json:"fb_product_category,omitempty"`
Gender string `json:"gender,omitempty"`
Gtin string `json:"gtin,omitempty"`
ImageCdnUrls []ImageCdnUrl `json:"image_cdn_urls,omitempty"`
ImageFetchStatus string `json:"image_fetch_status,omitempty"`
ImageUrl string `json:"image_url,omitempty"`
Images []string `json:"images,omitempty"`
ImporterAddress string `json:"importer_address,omitempty"`
ImporterName string `json:"importer_name,omitempty"`
InvalidationErrors []string `json:"invalidation_errors,omitempty"`
Inventory int `json:"inventory,omitempty"`
ManufacturerInfo string `json:"manufacturer_info,omitempty"`
ManufacturerPartNumber string `json:"manufacturer_part_number,omitempty"`
MarkedForProductLaunch string `json:"marked_for_product_launch,omitempty"`
Material string `json:"material,omitempty"`
MobileLink string `json:"mobile_link,omitempty"`
Name string `json:"name,omitempty"`
OrderingIndex int `json:"ordering_index,omitempty"`
OriginCountry string `json:"origin_country,omitempty"`
ParentProductID string `json:"parent_product_id,omitempty"`
Pattern string `json:"pattern,omitempty"`
PostConversionSignalBasedEnforcementAppealEligibility bool `json:"post_conversion_signal_based_enforcement_appeal_eligibility,omitempty"`
Price string `json:"price,omitempty"`
ProductFeed *ProductFeed `json:"product_feed,omitempty"`
ProductGroup *ProductGroup `json:"product_group,omitempty"`
ProductLocalInfo string `json:"product_local_info,omitempty"`
ProductType string `json:"product_type,omitempty"`
QuantityToSellOnFacebook int `json:"quantity_to_sell_on_facebook,omitempty"`
RetailerId string `json:"retailer_id,omitempty"`
RetailerProductGroupID string `json:"retailer_product_group_id,omitempty"`
ReviewRejectionReasons []string `json:"review_rejection_reasons,omitempty"`
ReviewStatus string `json:"review_status,omitempty"`
SalePrice string `json:"sale_price,omitempty"`
SalePriceEndDate string `json:"sale_price_end_date,omitempty"`
SalePriceStartDate string `json:"sale_price_start_date,omitempty"`
ShippingWeightUnit string `json:"shipping_weight_unit,omitempty"`
ShippingWeightValue float64 `json:"shipping_weight_value,omitempty"`
ShortDescription string `json:"short_description,omitempty"`
Size string `json:"size,omitempty"`
StartDate string `json:"start_date,omitempty"`
Tags []string `json:"tags,omitempty"`
Url string `json:"url,omitempty"`
VendorId string `json:"vendor_id,omitempty"`
VideoFetchStatus string `json:"video_fetch_status,omitempty"`
Visibility string `json:"visibility,omitempty"`
WaComplianceCategory string `json:"wa_compliance_category,omitempty"`
}
ProductItem represents a product in a catalog.
type ProductSet ¶ added in v0.2.0
type ProductSet struct {
Id string `json:"id"`
AutoCreationUrl string `json:"auto_creation_url,omitempty"`
Filter string `json:"filter,omitempty"`
LatestMetadata ProductSetMetadata `json:"latest_metadata,omitempty"`
LiveMetadata ProductSetMetadata `json:"live_metadata,omitempty"`
Name string `json:"name"`
// Omit full ProductCatalog to avoid cyclic properties; use catalog Id instead.
ProductCount uint32 `json:"product_count"`
RetailerId string `json:"retailer_id,omitempty"`
}
ProductSet represents a product set within a catalog.
type ProductSetMetadata ¶ added in v0.2.0
type ProductSetMetadata struct {
UpdateTime string `json:"update_time,omitempty"`
}
ProductSetMetadata represents metadata for a product set.
type ReferralInfo ¶ added in v0.7.2
type ReferralInfo struct {
SourceUrl string `json:"source_url"`
SourceType AdInteractionSourceTypeEnum `json:"source_type"`
SourceId string `json:"source_id"`
Headline string `json:"headline"`
Body string `json:"body"`
ImageUrl string `json:"image_url,omitempty"`
VideoUrl string `json:"video_url,omitempty"`
ThumbnailUrl string `json:"thumbnail_url,omitempty"`
CtwaClid string `json:"ctwa_clid,omitempty"`
MediaType AdInteractionSourceMediaTypeEnum `json:"media_type"`
WelcomeMessage struct {
Text string `json:"text"`
} `json:"welcome_message,omitempty"`
}
ReferralInfo represents referral data from Click to WhatsApp ads
type RequestVerificationCodeResponse ¶
type RequestVerificationCodeResponse struct {
Success bool `json:"success,omitempty"`
}
type SecurityValue ¶
type SenderContact ¶ added in v0.7.2
type SenderContact struct {
WaId string `json:"wa_id"`
Profile Profile `json:"profile"`
IdentityKeyHash string `json:"identity_key_hash,omitempty"`
// BSUID identity fields (Meta business-scoped user id rollout). Present when
// Meta includes them; empty for phone-only contacts. Additive — existing
// phone-known consumers are unaffected.
UserId string `json:"user_id,omitempty"`
ParentUserId string `json:"parent_user_id,omitempty"`
}
type SmbAppStateSyncValue ¶ added in v0.7.2
type SmbAppStateSyncValue struct {
MessagingProduct string `json:"messaging_product"`
Metadata struct {
DisplayPhoneNumber string `json:"display_phone_number"`
PhoneNumberId string `json:"phone_number_id"`
} `json:"metadata"`
StateSync []struct {
Type string `json:"type"` // e.g., "contact"
Contact struct {
FullName string `json:"full_name,omitempty"`
FirstName string `json:"first_name,omitempty"`
PhoneNumber string `json:"phone_number,omitempty"`
} `json:"contact,omitempty"`
Action string `json:"action"` // e.g., "add", "remove", "update"
Metadata struct {
Timestamp string `json:"timestamp"`
} `json:"metadata"`
} `json:"state_sync"`
}
type SmbMessageEcho ¶ added in v0.8.2
type SmbMessageEcho struct {
From string `json:"from"`
To string `json:"to"`
Id string `json:"id"`
Timestamp string `json:"timestamp"`
Type string `json:"type"`
// MessageContent is the object under the key named by Type, for example
// {"body": "hi"} for a text echo.
MessageContent map[string]interface{} `json:"-"`
}
SmbMessageEcho is one message a business sent from the WhatsApp Business app.
func (*SmbMessageEcho) UnmarshalJSON ¶ added in v0.8.2
func (echo *SmbMessageEcho) UnmarshalJSON(data []byte) error
type SmbMessageEchoesValue ¶ added in v0.7.2
type SmbMessageEchoesValue struct {
MessagingProduct string `json:"messaging_product"`
Metadata struct {
DisplayPhoneNumber string `json:"display_phone_number"`
PhoneNumberId string `json:"phone_number_id"`
} `json:"metadata"`
MessageEchoes []SmbMessageEcho `json:"message_echoes"`
}
type Status ¶
type Status struct {
Id string `json:"id"`
Conversation Conversation `json:"conversation,omitempty"`
Errors []Error `json:"errors,omitempty"`
Status string `json:"status"`
Timestamp string `json:"timestamp"`
RecipientId string `json:"recipient_id"`
RecipientType string `json:"recipient_type,omitempty"` // Only included if message sent to a group
RecipientParticipantId string `json:"recipient_participant_id,omitempty"` // Only included if message sent to a group
RecipientIdentityKeyHash string `json:"recipient_identity_key_hash,omitempty"` // Only included if identity change check enabled
BizOpaqueCallbackData string `json:"biz_opaque_callback_data,omitempty"` // Only included if message sent with biz_opaque_callback_data
Pricing Pricing `json:"pricing,omitempty"`
// BSUID identity of the recipient on status updates. Present alongside
// recipient_id in the dual-identifier rollout; either may be omitted.
RecipientUserId string `json:"recipient_user_id,omitempty"`
RecipientParentUserId string `json:"recipient_parent_user_id,omitempty"`
}
type StatusResponse ¶ added in v0.5.0
type StatusResponse struct {
Success bool `json:"success"`
Error *MessageSendError `json:"error,omitempty"`
}
StatusResponse represents the API response for status updates (read receipts).
type SystemNotificationTypeEnum ¶
type SystemNotificationTypeEnum string
const ( SystemNotificationTypeCustomerPhoneNumberChange SystemNotificationTypeEnum = "user_changed_number" SystemNotificationTypeCustomerIdentityChanged SystemNotificationTypeEnum = "customer_identity_changed" )
type TemplateCategoryUpdateValue ¶
type TemplateCategoryUpdateValue struct {
MessageTemplateId int64 `json:"message_template_id"`
MessageTemplateName string `json:"message_template_name"`
MessageTemplateLanguage string `json:"message_template_language"`
PreviousCategory MessageTemplateCategory `json:"previous_category"`
NewCategory MessageTemplateCategory `json:"new_category"`
CorrectCategory MessageTemplateCategory `json:"correct_category"`
}
type TemplateManager ¶
type TemplateManager struct {
// contains filtered or unexported fields
}
TemplateManager is responsible for managing WhatsApp Business message templates.
func NewTemplateManager ¶
func NewTemplateManager(config *TemplateManagerConfig) *TemplateManager
NewTemplateManager creates a new TemplateManager with the given configuration.
func (*TemplateManager) Create ¶
func (manager *TemplateManager) Create(body WhatsappMessageTemplateCreateRequestBody) (*MessageTemplateCreationResponse, error)
Create sends a creation request for a message template.
func (*TemplateManager) Delete ¶
func (manager *TemplateManager) Delete(id string) error
Delete deletes the template with the given ID. Meta needs the template's name as well as its ID, so Delete looks the name up first. Only this language version of the template is deleted.
func (*TemplateManager) DeleteByName ¶ added in v0.8.2
func (manager *TemplateManager) DeleteByName(name string) error
DeleteByName deletes every language version of the template with the given name.
func (*TemplateManager) Fetch ¶
func (manager *TemplateManager) Fetch(Id string) (*WhatsAppBusinessMessageTemplateNode, error)
Fetch fetches a single WhatsApp Business message template by its ID (no changes needed)
func (*TemplateManager) FetchAll
deprecated
func (manager *TemplateManager) FetchAll() (*WhatsAppBusinessTemplatesFetchResponseEdge, error)
Deprecated: Use FetchAllWithPagination for better control
func (*TemplateManager) FetchAllWithPagination ¶ added in v0.7.0
func (manager *TemplateManager) FetchAllWithPagination(paginationInput ...*PaginationInput) (*PaginatedResponse[WhatsAppBusinessMessageTemplateNode], error)
FetchAllWithPagination fetches WhatsApp Business message templates with pagination support
func (*TemplateManager) GetAllTemplates ¶ added in v0.7.0
func (manager *TemplateManager) GetAllTemplates(limit ...int) ([]WhatsAppBusinessMessageTemplateNode, error)
GetAllTemplates fetches all templates across all pages This is a helper method that handles pagination automatically
func (*TemplateManager) MigrateFromOtherBusinessAccount ¶
func (manager *TemplateManager) MigrateFromOtherBusinessAccount(sourcePageNumber int, sourceWabaId int) (*TemplateMigrationResponse, error)
MigrateFromOtherBusinessAccount migrates templates from another business account.
func (*TemplateManager) Update ¶
func (manager *TemplateManager) Update(templateId string, updates WhatsAppBusinessAccountMessageTemplateUpdateRequestBody) (*MessageTemplateCreationResponse, error)
Update sends an update request for a template. Meta answers with {"success": true}, so only Success is set on the returned response.
type TemplateManagerConfig ¶
type TemplateManagerConfig struct {
BusinessAccountId string
ApiAccessToken string
Requester *request_client.RequestClient
}
TemplateManagerConfig represents the configuration for creating a new TemplateManager.
type TemplateMessageButtonType ¶
type TemplateMessageButtonType string
TemplateMessageButtonType represents the type of a button.
const ( TemplateMessageButtonTypeQuickReply TemplateMessageButtonType = "QUICK_REPLY" TemplateMessageButtonTypeUrl TemplateMessageButtonType = "URL" TemplateMessageButtonTypePhoneNumber TemplateMessageButtonType = "PHONE_NUMBER" TemplateMessageButtonTypeCopyCode TemplateMessageButtonType = "COPY_CODE" TemplateMessageButtonTypeCatalog TemplateMessageButtonType = "CATALOG" TemplateMessageButtonTypeMultiProductMessage TemplateMessageButtonType = "MPM" // TemplateMessageButtonTypeRequestContactInfo asks the recipient to share // their contact info (BSUID/phone). The button takes no other fields — the // label is Meta-controlled — so a create-request button is just // {"type": "REQUEST_CONTACT_INFO"}, and sending the template needs no // button parameter. TemplateMessageButtonTypeRequestContactInfo TemplateMessageButtonType = "REQUEST_CONTACT_INFO" )
type TemplateMessageComponentButton ¶
type TemplateMessageComponentButton struct {
Type TemplateMessageButtonType `json:"type,omitempty"`
Text string `json:"text,omitempty"`
PhoneNumber string `json:"phone_number,omitempty"` // required when Type = PHONE_NUMBER
Example []string `json:"example,omitempty"` // required when Type = URL and button uses a variable
Url string `json:"url,omitempty"` // required when Type = URL
}
TemplateMessageComponentButton represents a button component in a message template.
type TemplateMessageComponentCard ¶
type TemplateMessageComponentCard struct {
CardIndex int `json:"card_index,omitempty"`
Components []WhatsAppBusinessHSMWhatsAppHSMComponent `json:"components,omitempty"`
}
TemplateMessageComponentCard represents a card component in a message template.
type TemplateMessageComponentExample ¶
type TemplateMessageComponentExample struct {
HeaderHandle *[]string `json:"header_handle,omitempty"` // for media headers (IMAGE, VIDEO, DOCUMENT)
HeaderTextNamedParams *[]NamedParamExample `json:"header_text_named_params,omitempty"` // for named header params
HeaderText *[]string `json:"header_text,omitempty"` // for text headers (positional examples)
BodyText *[][]string `json:"body_text,omitempty"` // for body components (array of arrays for positional examples)
BodyTextNamedParams *[]NamedParamExample `json:"body_text_named_params,omitempty"`
}
TemplateMessageComponentExample represents an example object for a template component.
type TemplateMessageLimitedTimeOfferParameter ¶
type TemplateMessageLimitedTimeOfferParameter struct {
Text string `json:"text,omitempty"`
HasExpiration bool `json:"has_expiration,omitempty"`
}
TemplateMessageLimitedTimeOfferParameter represents a limited time offer parameter.
type TemplateMessagePreviewEdge ¶
type TemplateMessagePreviewEdge struct {
Data []TemplateMessagePreviewNode `json:"data,omitempty"`
Paging PaginationDetails `json:"paging,omitempty"`
}
TemplateMessagePreviewEdge represents the preview response.
type TemplateMessagePreviewNode ¶
type TemplateMessagePreviewNode struct {
Body string `json:"body,omitempty"`
Buttons []WhatsAppBusinessAccountMessageTemplatePreviewButton `json:"buttons,omitempty"`
Header string `json:"header,omitempty"`
Language string `json:"language,omitempty"`
}
TemplateMessagePreviewNode represents a preview node.
type TemplateMessageQualityScore ¶
type TemplateMessageQualityScore struct {
Date int `json:"date,omitempty"`
Reasons []string `json:"reasons,omitempty"`
Score string `json:"score,omitempty"`
}
TemplateMessageQualityScore represents the quality score of a template.
type TemplateMessageRejectionReasonEnum ¶
type TemplateMessageRejectionReasonEnum string
const ( TemplateMessageRejectionReasonEnumAbusiveContent TemplateMessageRejectionReasonEnum = "ABUSIVE_CONTENT" TemplateMessageRejectionReasonEnumIncorrectCategory TemplateMessageRejectionReasonEnum = "INCORRECT_CATEGORY" TemplateMessageRejectionReasonEnumInvalidFormat TemplateMessageRejectionReasonEnum = "INVALID_FORMAT" TemplateMessageRejectionReasonEnumNone TemplateMessageRejectionReasonEnum = "NONE" TemplateMessageRejectionReasonEnumScam TemplateMessageRejectionReasonEnum = "SCAM" )
type TemplateMessageStatusUpdateDisableInfo ¶
type TemplateMessageStatusUpdateDisableInfo struct {
// DisableDate is kept as text. Meta documents it as a Unix timestamp but
// has also sent it as a string; both are accepted.
DisableDate string `json:"disable_date"`
}
func (*TemplateMessageStatusUpdateDisableInfo) UnmarshalJSON ¶ added in v0.8.2
func (info *TemplateMessageStatusUpdateDisableInfo) UnmarshalJSON(data []byte) error
type TemplateMessageStatusUpdateEventEnum ¶
type TemplateMessageStatusUpdateEventEnum string
const ( TemplateMessageStatusUpdateEventEnumApproved TemplateMessageStatusUpdateEventEnum = "APPROVED" TemplateMessageStatusUpdateEventEnumRejected TemplateMessageStatusUpdateEventEnum = "REJECTED" TemplateMessageStatusUpdateEventEnumFlaggedForDisabling TemplateMessageStatusUpdateEventEnum = "FLAGGED" TemplateMessageStatusUpdateEventEnumPaused TemplateMessageStatusUpdateEventEnum = "PAUSED" TemplateMessageStatusUpdateEventEnumPendingDeletion TemplateMessageStatusUpdateEventEnum = "PENDING_DELETION" )
type TemplateMessageStatusUpdateRejectionInfo ¶ added in v0.8.2
type TemplateMessageStatusUpdateRejectionInfo struct {
Reason string `json:"reason"`
Recommendation string `json:"recommendation"`
}
TemplateMessageStatusUpdateRejectionInfo is sent when a template is rejected with INVALID_FORMAT.
type TemplateMigrationResponse ¶
type TemplateMigrationResponse struct {
MigratedTemplates []string `json:"migrated_templates,omitempty"`
FailedTemplates map[string]string `json:"failed_templates,omitempty"`
}
TemplateMigrationResponse represents the migration response.
type TemplateQualityUpdateValue ¶
type TemplateQualityUpdateValue struct {
PreviousQualityScore string `json:"previous_quality_score"`
NewQualityScore string `json:"new_quality_score"`
MessageTemplateId int64 `json:"message_template_id"`
MessageTemplateName string `json:"message_template_name"`
MessageTemplateLanguage string `json:"message_template_language"`
}
type TemplateStatusUpdateValue ¶
type TemplateStatusUpdateValue struct {
Event TemplateMessageStatusUpdateEventEnum `json:"event"`
MessageTemplateId int64 `json:"message_template_id"`
MessageTemplateName string `json:"message_template_name"`
MessageTemplateLanguage string `json:"message_template_language"`
Reason TemplateMessageRejectionReasonEnum `json:"reason"`
DisableInfo TemplateMessageStatusUpdateDisableInfo `json:"disable_info,omitempty"`
OtherInfo TemplateMessageStatusUpdateOtherInfo `json:"other_info,omitempty"`
RejectionInfo *TemplateMessageStatusUpdateRejectionInfo `json:"rejection_info,omitempty"`
MessageTemplateCategory string `json:"message_template_category,omitempty"`
}
type UserIdUpdateValue ¶ added in v0.8.0
type UserIdUpdateValue struct {
WaId string `json:"wa_id,omitempty"`
OldUserId string `json:"old_user_id,omitempty"`
NewUserId string `json:"new_user_id,omitempty"`
UserId string `json:"user_id,omitempty"`
ParentUserId string `json:"parent_user_id,omitempty"`
}
UserIdUpdateValue is the webhook value for the `user_id_update` field (BSUID transition). Field names follow Meta's payload; all optional. Raw values are preserved for downstream identity bridging.
type UserPreferencesValue ¶ added in v0.7.2
type UsernameMutationResponse ¶ added in v0.8.0
type UsernameMutationResponse struct {
Success bool `json:"success,omitempty"`
Error *MessageSendError `json:"error,omitempty"`
}
UsernameMutationResponse is the POST/DELETE username result.
type VerifyCodeMethod ¶
type VerifyCodeMethod string
const ( VerifyCodeMethodSms VerifyCodeMethod = "SMS" VerifyCodeMethodVoice VerifyCodeMethod = "VOICE" )
type VerifyCodeResponse ¶
type VerifyCodeResponse struct {
Success bool `json:"success,omitempty"`
}
type WabaHealthStatus ¶ added in v0.4.3
type WabaHealthStatus struct {
CanSendMessage string `json:"can_send_message"`
Entities []struct {
EntityType string `json:"entity_type"`
ID string `json:"id"`
CanSendMessage string `json:"can_send_message,omitempty"`
CanReceiveCallSIP string `json:"can_receive_call_sip,omitempty"`
Errors []struct {
ErrorCode int `json:"error_code"`
ErrorDescription string `json:"error_description"`
PossibleSolution string `json:"possible_solution"`
} `json:"errors,omitempty"`
} `json:"entities"`
}
type WabaOfficialBusinessAccount ¶ added in v0.4.3
type WabaOfficialBusinessAccount struct {
OBAStatus string `json:"oba_status"`
}
type WabaQualityScore ¶ added in v0.4.3
type WabaQualityScore struct {
Score string `json:"score"`
}
type WabaThroughput ¶ added in v0.4.3
type WabaThroughput struct {
Level string `json:"level"`
}
type WebApplink ¶ added in v0.2.0
type WebhookFieldEnum ¶
type WebhookFieldEnum string
const ( WebhookFieldEnumAccountAlerts WebhookFieldEnum = "account_alerts" WebhookFieldEnumMessages WebhookFieldEnum = "messages" WebhookFieldEnumSecurity WebhookFieldEnum = "security" WebhookFieldEnumAccountUpdate WebhookFieldEnum = "account_update" WebhookFieldEnumAccountReview WebhookFieldEnum = "account_review_update" WebhookFieldEnumBusinessCapability WebhookFieldEnum = "business_capability_update" WebhookFieldEnumMessageTemplateQuality WebhookFieldEnum = "message_template_quality_update" WebhookFieldEnumMessageTemplateStatus WebhookFieldEnum = "message_template_status_update" WebhookFieldEnumPhoneNumberName WebhookFieldEnum = "phone_number_name_update" WebhookFieldEnumPhoneNumberQuality WebhookFieldEnum = "phone_number_quality_update" WebhookFieldEnumTemplateCategoryUpdate WebhookFieldEnum = "template_category_update" WebhookFieldEnumUserPreferences WebhookFieldEnum = "user_preferences" WebhookFieldEnumMessageTemplateComponentsUpdate WebhookFieldEnum = "message_template_components_update" WebhookFieldEnumPaymentConfigurationUpdate WebhookFieldEnum = "payment_configuration_update" WebhookFieldEnumSmbAppStateSync WebhookFieldEnum = "smb_app_state_sync" WebhookFieldEnumSmbMessageEchoes WebhookFieldEnum = "smb_message_echoes" WebhookFieldEnumHistory WebhookFieldEnum = "history" WebhookFieldEnumUserIdUpdate WebhookFieldEnum = "user_id_update" WebhookFieldEnumBusinessUsernameUpdates WebhookFieldEnum = "business_username_updates" )
type WebhookManager ¶
type WebhookManager struct {
EventManager *EventManager
Requester request_client.RequestClient
// contains filtered or unexported fields
}
WebhookManager represents a manager for handling webhooks.
func NewWebhook ¶
func NewWebhook(options *WebhookManagerConfig) *WebhookManager
NewWebhook creates a new WebhookManager with the given options. It returns nil if Secret or EventManager is missing.
func (*WebhookManager) GetRequestHandler ¶
func (wh *WebhookManager) GetRequestHandler(c echo.Context) error
GetRequestHandler handles GET requests to the webhook endpoint.
func (*WebhookManager) ListenToEvents ¶
func (wh *WebhookManager) ListenToEvents()
ListenToEvents starts the built-in webhook server on 127.0.0.1:<port> and blocks until SIGINT, then shuts the server down.
func (*WebhookManager) PostRequestHandler ¶
func (wh *WebhookManager) PostRequestHandler(c echo.Context) error
PostRequestHandler handles POST requests to the webhook endpoint.
type WebhookManagerConfig ¶
type WebhookManagerConfig struct {
Secret string `validate:"required"`
EventManager *EventManager `validate:"required"`
Requester request_client.RequestClient `validate:"required"`
Path string
Port int
// AppSecret is the Meta app secret. When set, POST requests whose
// X-Hub-Signature-256 header does not match the HMAC-SHA256 of the raw
// body are rejected with 401. When empty, signatures are not checked.
AppSecret string
}
WebhookManagerConfig represents the configuration options for creating a new WebhookManager.
type WhatsAppBusinessAccountMessageTemplateDeleteRequestBody ¶
type WhatsAppBusinessAccountMessageTemplateDeleteRequestBody struct {
HsmId string `json:"hsm_id,omitempty"`
Name string `json:"name,omitempty"`
}
WhatsAppBusinessAccountMessageTemplateDeleteRequestBody represents the request body for deleting a template.
type WhatsAppBusinessAccountMessageTemplatePreviewButton ¶
type WhatsAppBusinessAccountMessageTemplatePreviewButton struct {
AutoFillText string `json:"auto_fill_text,omitempty"`
Text string `json:"text,omitempty"`
}
WhatsAppBusinessAccountMessageTemplatePreviewButton represents a preview button.
type WhatsAppBusinessAccountMessageTemplateUpdateRequestBody ¶
type WhatsAppBusinessAccountMessageTemplateUpdateRequestBody struct {
Components []WhatsappMessageTemplateComponentCreateOrUpdateRequestBody `json:"components,omitempty"`
Category string `json:"category,omitempty"`
MessageSendTtlSeconds int `json:"message_send_ttl_seconds,omitempty"`
}
WhatsAppBusinessAccountMessageTemplateUpdateRequestBody represents the request body for updating a template.
type WhatsAppBusinessHSMWhatsAppHSMComponent ¶
type WhatsAppBusinessHSMWhatsAppHSMComponent struct {
AddSecurityRecommendation bool `json:"add_security_recommendation,omitempty"`
Buttons []TemplateMessageComponentButton `json:"buttons,omitempty"`
Cards []TemplateMessageComponentCard `json:"cards,omitempty"`
CodeExpirationMinutes int `json:"code_expiration_minutes,omitempty"`
Example *TemplateMessageComponentExample `json:"example,omitempty"`
Format MessageTemplateComponentFormat `json:"format,omitempty"`
LimitedTimeOffer *TemplateMessageLimitedTimeOfferParameter `json:"limited_time_offer,omitempty"`
Text string `json:"text,omitempty"`
Type MessageTemplateComponentType `json:"type,omitempty"`
}
WhatsAppBusinessHSMWhatsAppHSMComponent represents a component in a message template. Note: The "Type" field here now uses MessageTemplateComponentType.
type WhatsAppBusinessMessageTemplateNode ¶
type WhatsAppBusinessMessageTemplateNode struct {
Id string `json:"id,omitempty"`
Category MessageTemplateCategory `json:"category,omitempty"`
Components []WhatsAppBusinessHSMWhatsAppHSMComponent `json:"components,omitempty"`
CorrectCategory string `json:"correct_category,omitempty"`
CtaUrlLinkTrackingOptedOut bool `json:"cta_url_link_tracking_opted_out,omitempty"`
Language string `json:"language,omitempty"`
LibraryTemplateName string `json:"library_template_name,omitempty"`
MessageSendTtlSeconds int `json:"message_send_ttl_seconds,omitempty"`
Name string `json:"name,omitempty"`
PreviousCategory string `json:"previous_category,omitempty"`
QualityScore TemplateMessageQualityScore `json:"quality_score,omitempty"`
RejectedReason string `json:"rejected_reason,omitempty"`
Status MessageTemplateStatus `json:"status,omitempty"`
}
WhatsAppBusinessMessageTemplateNode represents a WhatsApp Business message template.
type WhatsAppBusinessTemplatesFetchResponseEdge ¶
type WhatsAppBusinessTemplatesFetchResponseEdge struct {
Data []WhatsAppBusinessMessageTemplateNode `json:"data,omitempty"`
Paging PaginationDetails `json:"paging,omitempty"`
}
WhatsAppBusinessTemplatesFetchResponseEdge represents the response structure for fetching templates.
type WhatsappBusinessAccountPhoneNumber ¶
type WhatsappBusinessAccountPhoneNumber struct {
VerifiedName string `json:"verified_name,omitempty"`
DisplayPhoneNumber string `json:"display_phone_number,omitempty"`
Id string `json:"id,omitempty"`
QualityRating string `json:"quality_rating,omitempty"`
CodeVerificationStatus WhatsappBusinessAccountPhoneNumberCodeVerificationStatus `json:"code_verification_status,omitempty"`
Status WhatsappBusinessAccountPhoneNumberStatus `json:"status,omitempty"` // CONNECTED
PlatformType WhatsappBusinessAccountPhoneNumberPlatformType `json:"platform_type,omitempty"`
CountryDialCode string `json:"country_dial_code,omitempty"`
SearchVisibility string `json:"search_visibility,omitempty"`
Certificate string `json:"certificate,omitempty"`
HealthStatus *WabaHealthStatus `json:"health_status,omitempty"`
IsOfficialBusinessAccount bool `json:"is_official_business_account,omitempty"`
IsOnBizApp bool `json:"is_on_biz_app,omitempty"`
IsPinEnabled bool `json:"is_pin_enabled,omitempty"`
IsPreverifiedNumber bool `json:"is_preverified_number,omitempty"`
LastOnboardedTime string `json:"last_onboarded_time,omitempty"`
MessagingLimitTier WhatsappBusinessAccountPhoneNumberMessagingLimitTier `json:"messaging_limit_tier,omitempty"`
NameStatus WhatsappBusinessAccountPhoneNumberNameStatus `json:"name_status,omitempty"`
NewCertificate string `json:"new_certificate,omitempty"`
NewDisplayName string `json:"new_display_name,omitempty"`
NewNameStatus WhatsappBusinessAccountPhoneNumberNameStatus `json:"new_name_status,omitempty"`
EligibilityForApiBusinessGlobalSearch string `json:"eligibility_for_api_business_global_search,omitempty"`
AccountMode string `json:"account_mode,omitempty"`
Throughput *WabaThroughput `json:"throughput,omitempty"`
OfficialBusinessAccount *WabaOfficialBusinessAccount `json:"official_business_account,omitempty"`
QualityScore *WabaQualityScore `json:"quality_score,omitempty"`
}
WhatsappBusinessAccountPhoneNumber represents a WhatsApp Business Account phone number.
type WhatsappBusinessAccountPhoneNumberCodeVerificationStatus ¶ added in v0.4.3
type WhatsappBusinessAccountPhoneNumberCodeVerificationStatus string
const ( WhatsappBusinessAccountPhoneNumberCodeVerificationStatusVerified WhatsappBusinessAccountPhoneNumberCodeVerificationStatus = "VERIFIED" WhatsappBusinessAccountPhoneNumberCodeVerificationStatusNotVerified WhatsappBusinessAccountPhoneNumberCodeVerificationStatus = "NOT_VERIFIED" WhatsappBusinessAccountPhoneNumberCodeVerificationStatusExpired WhatsappBusinessAccountPhoneNumberCodeVerificationStatus = "EXPIRED" )
type WhatsappBusinessAccountPhoneNumberEdge ¶
type WhatsappBusinessAccountPhoneNumberEdge struct {
Data []WhatsappBusinessAccountPhoneNumber `json:"data,omitempty"`
Paging PaginationDetails `json:"paging,omitempty"`
Summary string `json:"summary,omitempty"`
}
WhatsappBusinessAccountPhoneNumberEdge represents a list of WhatsApp Business Account phone numbers.
type WhatsappBusinessAccountPhoneNumberMessagingLimitTier ¶ added in v0.4.3
type WhatsappBusinessAccountPhoneNumberMessagingLimitTier string
const ( WhatsappBusinessAccountPhoneNumberMessagingLimitTierTier50 WhatsappBusinessAccountPhoneNumberMessagingLimitTier = "TIER_50" WhatsappBusinessAccountPhoneNumberMessagingLimitTierTier250 WhatsappBusinessAccountPhoneNumberMessagingLimitTier = "TIER_250" WhatsappBusinessAccountPhoneNumberMessagingLimitTierTier1K WhatsappBusinessAccountPhoneNumberMessagingLimitTier = "TIER_1K" WhatsappBusinessAccountPhoneNumberMessagingLimitTierTier10K WhatsappBusinessAccountPhoneNumberMessagingLimitTier = "TIER_10K" WhatsappBusinessAccountPhoneNumberMessagingLimitTierTier100K WhatsappBusinessAccountPhoneNumberMessagingLimitTier = "TIER_100K" WhatsappBusinessAccountPhoneNumberMessagingLimitTierTierUnlimited WhatsappBusinessAccountPhoneNumberMessagingLimitTier = "TIER_UNLIMITED" )
type WhatsappBusinessAccountPhoneNumberNameStatus ¶ added in v0.4.3
type WhatsappBusinessAccountPhoneNumberNameStatus string
const ( WhatsappBusinessAccountPhoneNumberNameStatusApproved WhatsappBusinessAccountPhoneNumberNameStatus = "APPROVED" WhatsappBusinessAccountPhoneNumberNameStatusAvailableWithoutReview WhatsappBusinessAccountPhoneNumberNameStatus = "AVAILABLE_WITHOUT_REVIEW" WhatsappBusinessAccountPhoneNumberNameStatusDeclined WhatsappBusinessAccountPhoneNumberNameStatus = "DECLINED" WhatsappBusinessAccountPhoneNumberNameStatusExpired WhatsappBusinessAccountPhoneNumberNameStatus = "EXPIRED" WhatsappBusinessAccountPhoneNumberNameStatusNonExists WhatsappBusinessAccountPhoneNumberNameStatus = "NON_EXISTS" WhatsappBusinessAccountPhoneNumberNameStatusNone WhatsappBusinessAccountPhoneNumberNameStatus = "NONE" WhatsappBusinessAccountPhoneNumberNameStatusPendingReview WhatsappBusinessAccountPhoneNumberNameStatus = "PENDING_REVIEW" )
type WhatsappBusinessAccountPhoneNumberPlatformType ¶ added in v0.4.3
type WhatsappBusinessAccountPhoneNumberPlatformType string
const ( WhatsappBusinessAccountPhoneNumberPlatformTypeCloudApi WhatsappBusinessAccountPhoneNumberPlatformType = "CLOUD_API" WhatsappBusinessAccountPhoneNumberPlatformTypeNotApplicable WhatsappBusinessAccountPhoneNumberPlatformType = "NOT_APPLICABLE" WhatsappBusinessAccountPhoneNumberPlatformTypeOnPremise WhatsappBusinessAccountPhoneNumberPlatformType = "ON_PREMISE" )
type WhatsappBusinessAccountPhoneNumberStatus ¶ added in v0.4.3
type WhatsappBusinessAccountPhoneNumberStatus string
const ( WhatsappBusinessAccountPhoneNumberStatusPending WhatsappBusinessAccountPhoneNumberStatus = "PENDING" WhatsappBusinessAccountPhoneNumberStatusDeleted WhatsappBusinessAccountPhoneNumberStatus = "DELETED" WhatsappBusinessAccountPhoneNumberStatusMigrated WhatsappBusinessAccountPhoneNumberStatus = "MIGRATED" WhatsappBusinessAccountPhoneNumberStatusBanned WhatsappBusinessAccountPhoneNumberStatus = "BANNED" WhatsappBusinessAccountPhoneNumberStatusRestricted WhatsappBusinessAccountPhoneNumberStatus = "RESTRICTED" WhatsappBusinessAccountPhoneNumberStatusRateLimited WhatsappBusinessAccountPhoneNumberStatus = "RATE_LIMITED" WhatsappBusinessAccountPhoneNumberStatusFlagged WhatsappBusinessAccountPhoneNumberStatus = "FLAGGED" WhatsappBusinessAccountPhoneNumberStatusConnected WhatsappBusinessAccountPhoneNumberStatus = "CONNECTED" WhatsappBusinessAccountPhoneNumberStatusDisconnected WhatsappBusinessAccountPhoneNumberStatus = "DISCONNECTED" WhatsappBusinessAccountPhoneNumberStatusUnknown WhatsappBusinessAccountPhoneNumberStatus = "UNKNOWN" WhatsappBusinessAccountPhoneNumberStatusUnverified WhatsappBusinessAccountPhoneNumberStatus = "UNVERIFIED" )
type WhatsappMessageTemplateButtonCreateRequestBody ¶
type WhatsappMessageTemplateButtonCreateRequestBody struct {
Type string `json:"type,omitempty"`
Text string `json:"text,omitempty"`
Url string `json:"url,omitempty"`
PhoneNumber string `json:"phone_number,omitempty"`
Example []string `json:"example,omitempty"` // For URL buttons with variables.
FlowId string `json:"flow_id,omitempty"`
ZeroTapTermsAccepted bool `json:"zero_tap_terms_accepted,omitempty"`
}
WhatsappMessageTemplateButtonCreateRequestBody represents the request body for creating a button.
type WhatsappMessageTemplateButtonCreateRequestBodyAlias ¶
type WhatsappMessageTemplateButtonCreateRequestBodyAlias = WhatsappMessageTemplateButtonCreateRequestBody
WhatsappMessageTemplateButtonCreateRequestBody alias used in component creation.
type WhatsappMessageTemplateComponentCreateOrUpdateRequestBody ¶
type WhatsappMessageTemplateComponentCreateOrUpdateRequestBody struct {
Type MessageTemplateComponentType `json:"type,omitempty"`
Cards []TemplateMessageComponentCard `json:"cards,omitempty"`
Format MessageTemplateComponentFormat `json:"format,omitempty"`
Text string `json:"text,omitempty"`
Buttons []WhatsappMessageTemplateButtonCreateRequestBody `json:"buttons,omitempty"`
Example *TemplateMessageComponentExample `json:"example,omitempty"`
}
WhatsappMessageTemplateComponentCreateOrUpdateRequestBody represents the request body for creating/updating a component.
type WhatsappMessageTemplateCreateRequestBody ¶
type WhatsappMessageTemplateCreateRequestBody struct {
AllowCategoryChange bool `json:"allow_category_change,omitempty"`
Category string `json:"category,omitempty" validate:"required"`
Components []WhatsappMessageTemplateComponentCreateOrUpdateRequestBody `json:"components" validate:"required"`
Name string `json:"name,omitempty" validate:"required"`
Language string `json:"language" validate:"required"`
LibraryTemplateName string `json:"library_template_name,omitempty"`
LibraryTemplateButtonInputs []WhatsappMessageTemplateButtonCreateRequestBody `json:"library_template_button_inputs,omitempty"`
}
WhatsappMessageTemplateCreateRequestBody represents the request body for creating a message template.
func (*WhatsappMessageTemplateCreateRequestBody) AddComponent ¶
func (body *WhatsappMessageTemplateCreateRequestBody) AddComponent(component WhatsappMessageTemplateComponentCreateOrUpdateRequestBody)
AddComponent appends a component to the template creation request body.