manager

package
v0.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2025 License: AGPL-3.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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"`
	AlertSeverity    AccountAlertSeverityEnum `json:"alert_severity"`
	AlertStatus      string                   `json:"alert_status"`
	AlertType        string                   `json:"alert_type"`
	AlertDescription string                   `json:"alert_description"`
}

type AccountReviewUpdateValue

type AccountReviewUpdateValue struct {
	Decision string `json:"decision"`
}

type AccountUpdateBanInfo

type AccountUpdateBanInfo struct {
	WabaBanState []string `json:"waba_ban_state"`
	WabaBanDate  string   `json:"waba_ban_date"`
}

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 AccountUpdateRestrictionInfo

type AccountUpdateRestrictionInfo struct {
	RestrictionType string `json:"restriction_type"`
	Expiration      string `json:"expiration"`
}

type AccountUpdateValue

type AccountUpdateValue struct {
	PhoneNumber string                 `json:"phone_number,omitempty"`
	Event       AccountUpdateEventEnum `json:"event"`
}

type AccountUpdateViolationInfo

type AccountUpdateViolationInfo struct {
	ViolationType string `json:"violation_type"`
}

type AdInteractionSourceMediaTypeEnum

type AdInteractionSourceMediaTypeEnum string
const (
	AdInteractionSourceMediaTypeImage AdInteractionSourceMediaTypeEnum = "image"
	AdInteractionSourceMediaTypeVideo AdInteractionSourceMediaTypeEnum = "video"
)

type AdInteractionSourceTypeEnum

type AdInteractionSourceTypeEnum string
const (
	AdInteractionSourceTypeUnknown AdInteractionSourceTypeEnum = "unknown"
)

type BusinessCapabilityUpdateValue

type BusinessCapabilityUpdateValue struct {
	MaxDailyConversationPerPhone int `json:"max_daily_conversation_per_phone"`
	MaxPhoneNumbersPerBusiness   int `json:"max_phone_numbers_per_business"`
}

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 Contact

type Contact struct {
	WaId    string  `json:"wa_id"`
	Profile Profile `json:"profile"`
}

type Conversation

type Conversation struct {
	Id     string `json:"id"`
	Origin Origin `json:"origin,omitempty"`
}

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 Entry

type Entry struct {
	Id      string   `json:"id"`
	Changes []Change `json:"changes"`
}

type Error

type Error struct {
}

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.

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 function will be called whenever the event is published. It returns the event type that the handler is registered for.

func (*EventManager) Publish

func (em *EventManager) Publish(event events.EventType, data events.BaseEvent) error

Publish publishes an event to the event system and notifies all the subscribers.

func (*EventManager) Subscribe

func (em *EventManager) Subscribe(eventName events.EventType) (chan ChannelEvent, error)

Subscribe adds a new subscriber to the specified event type. The subscriber will be notified when the event is published.

func (*EventManager) Unsubscribe

func (em *EventManager) Unsubscribe(id events.EventType)

Unsubscribe removes a subscriber from the specified event 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 added in v0.0.13

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
}

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)

GetMediaIdByUrl retrieves the media ID by its URL.

func (*MediaManager) GetMediaUrlById

func (mm *MediaManager) GetMediaUrlById(id string) (string, error)

GetMediaUrlById retrieves the media URL by its ID.

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) Send

func (mm *MessageManager) Send(message components.BaseMessage, phoneNumber string) (string, error)

Send sends a message with the given parameters and returns the response. TODO: return the structured response from here

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 MessageTemplateCategory

type MessageTemplateCategory string

MessageTemplateCategory represents the category of a WhatsApp Business message template.

const (
	MessageTemplateCategoryUtility        MessageTemplateCategory = "UTILITY"
	MessageTemplateCategoryMarketing      MessageTemplateCategory = "MARKETING"
	MessageTemplateCategoryAuthentication MessageTemplateCategory = "AUTHENTICATION"
)

Constants representing different message template categories.

type MessageTemplateComponentFormat

type MessageTemplateComponentFormat string

MessageTemplateComponentFormat represents the format of a message template component.

const (
	MessageTemplateComponentFormatText     MessageTemplateComponentFormat = "TEXT"
	MessageTemplateComponentFormatImage    MessageTemplateComponentFormat = "IMAGE"
	MessageTemplateComponentFormatDocument MessageTemplateComponentFormat = "DOCUMENT"
	MessageTemplateComponentFormatVideo    MessageTemplateComponentFormat = "VIDEO"
	MessageTemplateComponentFormatLocation MessageTemplateComponentFormat = "LOCATION"
)

Constants representing different message template component formats.

type MessageTemplateComponentType

type MessageTemplateComponentType string

MessageTemplateComponentType represents the type of a message template component.

const (
	MessageTemplateComponentTypeGreeting         MessageTemplateComponentType = "GREETING"
	MessageTemplateComponentTypeHeader           MessageTemplateComponentType = "HEADER"
	MessageTemplateComponentTypeBody             MessageTemplateComponentType = "BODY"
	MessageTemplateComponentTypeFooter           MessageTemplateComponentType = "FOOTER"
	MessageTemplateComponentTypeButtons          MessageTemplateComponentType = "BUTTONS"
	MessageTemplateComponentTypeCarousel         MessageTemplateComponentType = "CAROUSEL"
	MessageTemplateComponentTypeLimitedTimeOffer MessageTemplateComponentType = "LIMITED_TIME_OFFER"
)

Constants representing different message template component types.

type MessageTemplateCreationResponse

type MessageTemplateCreationResponse struct {
	Id       string                  `json:"id,omitempty"`
	Status   MessageTemplateStatus   `json:"status,omitempty"`
	Category MessageTemplateCategory `json:"category,omitempty"`
}

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"
)

Constants representing different message template statuses.

type MessageTemplateType

type MessageTemplateType string
const (
	MessageTemplateTypeHeader MessageTemplateType = "HEADER"
	MessageTemplateTypeBody   MessageTemplateType = "BODY"
	MessageTemplateTypeButton MessageTemplateType = "BUTTONS"
	MessageTemplateTypeFooter MessageTemplateType = "FOOTER"
)

type MessagesValue

type MessagesValue struct {
	MessagingProduct string    `json:"messaging_product"`
	Metadata         Metadata  `json:"metadata"`
	Contacts         []Contact `json:"contacts,omitempty"`
	Statuses         []Status  `json:"statuses,omitempty"`
	Messages         []Message `json:"messages,omitempty"`
	Errors           []Error   `json:"errors,omitempty"`
}

type Metadata

type Metadata struct {
	DisplayPhoneNumber string `json:"display_phone_number"`
	PhoneNumberId      string `json:"phone_number_id"`
}

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"
)

type NotificationPayloadAudioMessageSchemaType

type NotificationPayloadAudioMessageSchemaType struct {
	Audio struct {
		Id       string `json:"id,omitempty"`
		MIMEType string `json:"mime_type,omitempty"`
		SHA256   string `json:"sha256,omitempty"`
	} `json:"audio,omitempty"`
}

type NotificationPayloadButtonInteractionMessageSchemaType

type NotificationPayloadButtonInteractionMessageSchemaType struct {
	ButtonReply struct {
		ReplyId string `json:"reply_id"`
		Title   string `json:"title"`
	} `json:"button_reply,omitempty"`
}

type NotificationPayloadButtonMessageSchemaType

type NotificationPayloadButtonMessageSchemaType struct {
	Button struct {
		Payload string `json:"payload"`
		Text    string `json:"text"`
	} `json:"button,omitempty"`
}

type NotificationPayloadContactMessageSchemaType

type NotificationPayloadContactMessageSchemaType struct {
	Contacts []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"`
	} `json:"document,omitempty"`
}

type NotificationPayloadErrorSchemaType

type NotificationPayloadErrorSchemaType struct {
	Code      int    `json:"code"`
	Title     string `json:"title"`
	Message   string `json:"message"`
	ErrorData struct {
		Details string `json:"details"`
	} `json:"error_data,omitempty"`
}

type NotificationPayloadImageMessageSchemaType

type NotificationPayloadImageMessageSchemaType struct {
	Image struct {
		Id       string `json:"id"`
		MIMEType string `json:"mime_type"`
		SHA256   string `json:"sha256"`
		Caption  string `json:"caption,omitempty"`
	} `json:"image,omitempty"`
}

type NotificationPayloadInteractionMessageSchemaType

type NotificationPayloadInteractionMessageSchemaType struct {
	Interactive struct {
		Type                                                  InteractiveNotificationTypeEnum `json:"type"`
		NotificationPayloadButtonInteractionMessageSchemaType `json:",inline,omitempty"`
		NotificationPayloadListInteractionMessageSchemaType   `json:",inline,omitempty"`
	} `json:"interactive,omitempty"`
}

type NotificationPayloadListInteractionMessageSchemaType

type NotificationPayloadListInteractionMessageSchemaType struct {
	ListReply struct {
		Id          string `json:"id"`
		Title       string `json:"title"`
		Description string `json:"description"`
	} `json:"list_reply,omitempty"`
}

type NotificationPayloadLocationMessageSchemaType

type NotificationPayloadLocationMessageSchemaType struct {
	Location struct {
		Latitude  float64 `json:"latitude"`
		Longitude float64 `json:"longitude"`
		Name      string  `json:"name,omitempty"`
		Address   string  `json:"address,omitempty"`
	} `json:"location,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          string `json:"quantity"`
			ItemPrice         string `json:"item_price"`
			Currency          string `json:"currency"`
		} `json:"product_items"`
	} `json:"order,omitempty"`
}

type NotificationPayloadReactionMessageSchemaType

type NotificationPayloadReactionMessageSchemaType struct {
	Reaction struct {
		MessageId string `json:"message_id"`
		Emoji     string `json:"emoji"`
	} `json:"reaction,omitempty"`
}

type NotificationPayloadStickerMessageSchemaType

type NotificationPayloadStickerMessageSchemaType struct {
	Sticker struct {
		Id       string `json:"id"`
		MIMEType string `json:"mime_type"`
		SHA256   string `json:"sha256"`
		Animated bool   `json:"animated"`
	} `json:"sticker,omitempty"`
}

type NotificationPayloadSystemMessageSchemaType

type NotificationPayloadSystemMessageSchemaType struct {
	System struct {
		Identity string                     `json:"identity"`
		Body     string                     `json:"body"`
		Customer string                     `json:"customer"`
		Type     SystemNotificationTypeEnum `json:"type"`
		WaId     string                     `json:"wa_id"`
	} `json:"system,omitempty"`
	Identity struct {
		Acknowledged     string `json:"acknowledged"`
		CreatedTimestamp string `json:"created_timestamp"`
		Hash             string `json:"hash"`
	} `json:"identity,omitempty"`
}

type NotificationPayloadTextMessageSchemaType

type NotificationPayloadTextMessageSchemaType struct {
	Text struct {
		Body string `json:"body"`
	} `json:"text,omitempty"`
	Referral 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"`
		CtwaCLId     string                           `json:"ctwa_clid"`
		MediaType    AdInteractionSourceMediaTypeEnum `json:"media_type"`
	} `json:"referral,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"`
	} `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 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) 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 all phone numbers based on the provided filters.

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) RequestVerificationCode

func (manager *PhoneNumberManager) RequestVerificationCode(phoneNumberId string, codeMethod VerifyCodeMethod, languageCode string) (RequestVerificationCodeResponse, error)

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 PhoneNumberNameUpdateValue

type PhoneNumberNameUpdateValue struct {
	DisplayPhoneNumber    string `json:"display_phone_number"`
	Decision              string `json:"decision"`
	RequestedVerifiedName string `json:"requested_verified_name"`
	RejectionReason       string `json:"rejection_reason"`
}

type PhoneNumberQualityUpdateValue

type PhoneNumberQualityUpdateValue struct {
	DisplayPhoneNumber string `json:"display_phone_number"`
	Event              string `json:"event"`
	CurrentLimit       string `json:"current_limit"`
}

type Pricing

type Pricing struct {
	PricingModel string                    `json:"pricing_model"`
	Category     MessageStatusCategoryEnum `json:"category"`
}

type Profile

type Profile struct {
	Name string `json:"name"`
}

type RequestVerificationCodeResponse

type RequestVerificationCodeResponse struct {
	Success bool `json:"success,omitempty"`
}

type SecurityValue

type SecurityValue struct {
	DisplayPhoneNumber string `json:"display_phone_number"`
	Event              string `json:"event"`
	Requester          string `json:"requester"`
}

type Status

type Status struct {
	Conversation Conversation `json:"conversation,omitempty"`
	Errors       []Error      `json:"errors,omitempty"`
	Status       string       `json:"status"`
	Timestamp    string       `json:"timestamp"`
	RecipientId  string       `json:"recipient_id"`
	Pricing      Pricing      `json:"pricing,omitempty"`
}

type SystemNotificationTypeEnum

type SystemNotificationTypeEnum string
const (
	SystemNotificationTypeCustomerPhoneNumberChange SystemNotificationTypeEnum = "user_changed_number"
	SystemNotificationTypeCustomerIdentityChanged   SystemNotificationTypeEnum = "customer_identity_changed"
)

type TemplateCategoryUpdateValue

type TemplateCategoryUpdateValue struct {
	MessageTemplateId       string                  `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) Delete

func (tm *TemplateManager) Delete(id string)

func (*TemplateManager) Fetch

Fetch fetches a single WhatsApp Business message template by its ID.

func (*TemplateManager) FetchAll

FetchAll fetches all WhatsApp Business message templates.

func (*TemplateManager) MigrateFromOtherBusinessAccount

func (manager *TemplateManager) MigrateFromOtherBusinessAccount(sourcePageNumber int, sourceWabaId int) (*TemplateMigrationResponse, error)

func (*TemplateManager) Update

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
const (
	TemplateMessageButtonTypeQuickReply  TemplateMessageButtonType = "QUICK_REPLY"
	TemplateMessageButtonTypeUrl         TemplateMessageButtonType = "URL"
	TemplateMessageButtonTypePhoneNumber TemplateMessageButtonType = "PHONE_NUMBER"
	TemplateMessageButtonTypeCopyCode    TemplateMessageButtonType = "COPY_CODE"
)

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 has a variable
	Url         string                    `json:"url,omitempty"`          // required when Type = URL
}

TemplateMessageComponentButton represents a button component in a WhatsApp Business message template.

type TemplateMessageComponentButtonExample

type TemplateMessageComponentButtonExample []string

type TemplateMessageComponentCard

type TemplateMessageComponentCard struct {
}

TemplateMessageComponentCard represents a card component in a WhatsApp Business message template.

type TemplateMessageComponentExample

type TemplateMessageComponentExample struct {
	HeaderHandle []string   `json:"header_handle,omitempty"`
	HeaderText   []string   `json:"header_text,omitempty"`
	BodyText     [][]string `json:"body_text,omitempty"`
}

TemplateMessageComponentExample represents an example component in a WhatsApp Business message template.

type TemplateMessageLimitedTimeOfferParameter

type TemplateMessageLimitedTimeOfferParameter struct {
}

TemplateMessageLimitedTimeOfferParameter represents a limited time offer parameter in a WhatsApp Business message template.

type TemplateMessagePreviewEdge

type TemplateMessagePreviewEdge struct {
	Data   []TemplateMessagePreviewNode               `json:"data,omitempty"`
	Paging internal.WhatsAppBusinessApiPaginationMeta `json:"paging,omitempty"`
}

type TemplateMessagePreviewNode

type TemplateMessagePreviewNode struct {
	Body     string                                                `json:"body,omitempty"`
	Buttons  []WhatsAppBusinessAccountMessageTemplatePreviewButton `json:"buttons,omitempty"`
	Footer   string                                                `json:"footer,omitempty"`
	Header   string                                                `json:"header,omitempty"`
	Language string                                                `json:"language,omitempty"`
}

type TemplateMessageQualityScore

type TemplateMessageQualityScore struct {
	Date    int      `json:"date,omitempty"`
	Reasons []string `json:"reasons,omitempty"`
	Score   int      `json:"score,omitempty"`
}

TemplateMessageQualityScore represents the quality score of a WhatsApp Business message 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 string `json:"disable_date"`
}

type TemplateMessageStatusUpdateEventEnum

type TemplateMessageStatusUpdateEventEnum string
const (
	TemplateMessageStatusUpdateEventEnumApproved            TemplateMessageStatusUpdateEventEnum = "APPROVED"
	TemplateMessageStatusUpdateEventEnumRejected            TemplateMessageStatusUpdateEventEnum = "REJECTED"
	TemplateMessageStatusUpdateEventEnumFlaggedForDisabling TemplateMessageStatusUpdateEventEnum = "FLAGGED"
	TemplateMessageStatusUpdateEventEnumPaused              TemplateMessageStatusUpdateEventEnum = "PAUSED"
	TemplateMessageStatusUpdateEventEnumPendingDeletion     TemplateMessageStatusUpdateEventEnum = "PENDING_DELETION"
)

type TemplateMessageStatusUpdateOtherInfo

type TemplateMessageStatusUpdateOtherInfo struct {
	Title string `json:"title"`
}

type TemplateMigrationResponse

type TemplateMigrationResponse struct {
	MigratedTemplates []string          `json:"migrated_templates,omitempty"`
	FailedTemplates   map[string]string `json:"failed_templates,omitempty"`
}

type TemplateQualityUpdateValue

type TemplateQualityUpdateValue struct {
	PreviousQualityScore    string `json:"previous_quality_score"`
	NewQualityScore         string `json:"new_quality_score"`
	MessageTemplateId       string `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       string                                 `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"`
}

type VerifyCodeMethod

type VerifyCodeMethod string
const (
	VerifyCodeMethodSms   VerifyCodeMethod = "SMS"
	VerifyCodeMethodVoice VerifyCodeMethod = "VOICE"
)

type VerifyCodeResponse

type VerifyCodeResponse struct {
	Success bool `json:"success,omitempty"`
}

type WebhookFieldEnum

type WebhookFieldEnum string
const (
	WebhookFieldEnumAccountAlerts          WebhookFieldEnum = "account_alerts"
	WebhookFieldEnumMessages               WebhookFieldEnum = "messages"
	WebhookFieldEnumSecurity               WebhookFieldEnum = "security"
	WebhookFieldEnumAccountUpdate          WebhookFieldEnum = "account_update"
	WebhookFieldEnumAccountReview          WebhookFieldEnum = "account_review"
	WebhookFieldEnumBusinessCapability     WebhookFieldEnum = "business_capability"
	WebhookFieldEnumMessageTemplateQuality WebhookFieldEnum = "message_template_quality"
	WebhookFieldEnumMessageTemplateStatus  WebhookFieldEnum = "message_template_status"
	WebhookFieldEnumPhoneNumberName        WebhookFieldEnum = "phone_number_name"
	WebhookFieldEnumPhoneNumberQuality     WebhookFieldEnum = "phone_number_quality"
	WebhookFieldEnumTemplateCategoryUpdate WebhookFieldEnum = "template_category"
)

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.

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 listening to events and handles incoming requests.

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
}

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"`
}

type WhatsAppBusinessAccountMessageTemplatePreviewButton

type WhatsAppBusinessAccountMessageTemplatePreviewButton struct {
	AutoFillText string `json:"auto_fill_text,omitempty"`
	Text         string `json:"text,omitempty"`
}

type WhatsAppBusinessAccountMessageTemplateUpdateRequestBody

type WhatsAppBusinessAccountMessageTemplateUpdateRequestBody struct {
	Components            []WhatsappMessageTemplateComponentCreateOrUpdateRequestBody `json:"components,omitempty"`
	Category              string                                                      `json:"category,omitempty"`
	MessageSendTtlSeconds int                                                         `json:"message_send_ttl_seconds,omitempty"`
}

this is the request body for the message template update request

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                      MessageTemplateStatus                    `json:"type,omitempty"`
}

WhatsAppBusinessHSMWhatsAppHSMComponent represents a component in a WhatsApp Business message template.

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 internal.WhatsAppBusinessApiPaginationMeta `json:"paging,omitempty"`
}

WhatsAppBusinessTemplatesFetchResponseEdge represents the response structure for fetching WhatsApp Business message templates.

type WhatsappApiNotificationPayloadSchemaType

type WhatsappApiNotificationPayloadSchemaType struct {
	Object string  `json:"object"`
	Entry  []Entry `json:"entry"`
}

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"`
	CodeVerification   struct {
		Status string `json:"code_verification_status,omitempty"`
	} `json:"code_verification_status,omitempty"`
	PlatformType string `json:"platform_type,omitempty"`
}

WhatsappBusinessAccountPhoneNumber represents a WhatsApp Business Account phone number.

type WhatsappBusinessAccountPhoneNumberEdge

type WhatsappBusinessAccountPhoneNumberEdge struct {
	Data    []WhatsappBusinessAccountPhoneNumber       `json:"data,omitempty"`
	Paging  internal.WhatsAppBusinessApiPaginationMeta `json:"paging,omitempty"`
	Summary string                                     `json:"summary,omitempty"`
}

WhatsappBusinessAccountPhoneNumberEdge represents a list of WhatsApp Business Account phone numbers.

type WhatsappMessageTemplateButtonCreateRequestBody

type WhatsappMessageTemplateButtonCreateRequestBody struct {
	// enum {QUICK_REPLY, URL, PHONE_NUMBER, OTP, MPM, CATALOG, FLOW, VOICE_CALL}
	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"`
	FlowId               string `json:"flow_id,omitempty"`
	ZeroTapTermsAccepted bool   `json:"zero_tap_terms_accepted,omitempty"`
}

WhatsappMessageTemplateButtonCreateRequestBody represents the request body for creating a button in a message template.

type WhatsappMessageTemplateComponentCreateOrUpdateRequestBody

type WhatsappMessageTemplateComponentCreateOrUpdateRequestBody struct {
	Type    MessageTemplateComponentType                     `json:"type,omitempty"`
	Format  MessageTemplateComponentFormat                   `json:"format,omitempty"`
	Text    string                                           `json:"text,omitempty"`
	Buttons []WhatsappMessageTemplateButtonCreateRequestBody `json:"buttons,omitempty"`
}

WhatsappMessageTemplateComponentCreateOrUpdateRequestBody represents the request body for creating or updating a component in a message template.

func (*WhatsappMessageTemplateComponentCreateOrUpdateRequestBody) AddButton

AddButton adds a button to the component.

type WhatsappMessageTemplateCreateRequestBody

type WhatsappMessageTemplateCreateRequestBody struct {
	AllowCategoryChange bool `json:"allow_category_change,omitempty" `

	// enum {UTILITY, MARKETING, AUTHENTICATION}
	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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL