events

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountAlertEvent

type AccountAlertEvent struct {
	BaseBusinessAccountEvent
}

func NewAccountAlertEvent

func NewAccountAlertEvent() *AccountAlertEvent

type AccountReviewUpdateEvent

type AccountReviewUpdateEvent struct {
	BaseBusinessAccountEvent
}

func NewAccountReviewUpdateEvent

func NewAccountReviewUpdateEvent() *AccountReviewUpdateEvent

type AccountUpdateEvent

type AccountUpdateEvent struct {
	BaseBusinessAccountEvent
}

func NewAccountUpdateEvent

func NewAccountUpdateEvent() *AccountUpdateEvent

type AdInteractionEvent

type AdInteractionEvent struct {
	BaseMessageEvent `json:",inline"`
	AdSource         AdSource `json:"adSource"`
	Text             string   `json:"text"`
}

AdInteractionEvent represents an ad interaction event.

func NewAdInteractionEvent

func NewAdInteractionEvent(baseMessageEvent BaseMessageEvent, adSource AdSource, text string) *AdInteractionEvent

NewAdInteractionEvent creates a new instance of AdInteractionEvent.

type AdInteractionSourceMediaType

type AdInteractionSourceMediaType string

AdInteractionSourceMediaType represents the media type of an ad interaction source.

const (
	// AdInteractionSourceMediaTypeImage indicates that the ad interaction source is an image.
	AdInteractionSourceMediaTypeImage AdInteractionSourceMediaType = "image"
	// AdInteractionSourceMediaTypeVideo indicates that the ad interaction source is a video.
	AdInteractionSourceMediaTypeVideo AdInteractionSourceMediaType = "video"
)

type AdInteractionSourceType

type AdInteractionSourceType string

AdInteractionSourceType represents the source type of an ad interaction.

const (
	// AdInteractionSourceTypePost indicates that the ad interaction is from a post.
	AdInteractionSourceTypePost AdInteractionSourceType = "post"
	// AdInteractionSourceTypeAd indicates that the ad interaction is from an ad.
	AdInteractionSourceTypeAd AdInteractionSourceType = "ad"
)

type AdSource

type AdSource struct {
	Url          string                       `json:"url"`
	Id           string                       `json:"id"`
	Type         AdInteractionSourceType      `json:"type"`
	Title        string                       `json:"title"`
	Description  string                       `json:"description"`
	MediaUrl     string                       `json:"mediaUrl"`
	MediaType    AdInteractionSourceMediaType `json:"mediaType"`
	ThumbnailUrl string                       `json:"thumbnailUrl"`
	CtwaClid     string                       `json:"ctwaClid"`
}

AdSource represents the source of an ad.

type AudioMessageEvent

type AudioMessageEvent struct {
	BaseMediaMessageEvent `json:",inline"`
	Audio                 components.AudioMessage `json:"audio"`
}

AudioMessageEvent represents an event for an audio message.

func NewAudioMessageEvent

func NewAudioMessageEvent(baseMessageEvent BaseMessageEvent, audio components.AudioMessage, mimeType, sha256, mediaId string) *AudioMessageEvent

NewAudioMessageEvent creates a new AudioMessageEvent instance.

type BaseBusinessAccountEvent

type BaseBusinessAccountEvent struct {
	Timestamp string `json:"timestamp"`
}

func (BaseBusinessAccountEvent) GetEventType

func (bme BaseBusinessAccountEvent) GetEventType() string

type BaseBusinessAccountEventInterface

type BaseBusinessAccountEventInterface interface {
	BaseEvent
}

type BaseEvent

type BaseEvent interface {
	GetEventType() string
}

type BaseMediaMessageEvent

type BaseMediaMessageEvent struct {
	BaseMessageEvent `json:",inline"`
	MediaId          string `json:"media_id"`
	MimeType         string `json:"mime_type"`
	Sha256           string `json:"sha256"`
}

BaseMediaMessageEvent represents a base media message event which contains media information.

type BaseMessageEvent

type BaseMessageEvent struct {
	BusinessAccountId string `json:"business_account_id"`

	MessageId   string              `json:"message_id"`
	From        string              `json:"from"`
	SenderName  string              `json:"sender_name"`
	Context     MessageContext      `json:"context"`
	Timestamp   string              `json:"timestamp"`
	IsForwarded bool                `json:"is_forwarded"`
	PhoneNumber BusinessPhoneNumber `json:"phone_number"`
	// contains filtered or unexported fields
}

func NewBaseMessageEvent

func NewBaseMessageEvent(params BaseMessageEventParams) BaseMessageEvent

func (BaseMessageEvent) GetEventType

func (bme BaseMessageEvent) GetEventType() string

func (*BaseMessageEvent) React

func (baseMessageEvent *BaseMessageEvent) React(emoji string) (string, error)

React to the message

func (*BaseMessageEvent) Reply

func (baseMessageEvent *BaseMessageEvent) Reply(Message components.BaseMessage) (string, error)

Reply to the message

type BaseMessageEventInterface

type BaseMessageEventInterface interface {
	BaseEvent
	Reply() (string, error)
	React() (string, error)
}

type BaseMessageEventParams added in v0.0.13

type BaseMessageEventParams struct {
	BusinessAccountId string
	MessageId         string
	PhoneNumber       BusinessPhoneNumber
	Timestamp         string
	From              string // * whatsapp account id of the user who sent the message
	SenderName        string
	IsForwarded       bool
	Context           MessageContext // * this context will not be present if in case a message is a reply to another message
	Requester         request_client.RequestClient
}

type BaseSystemEvent

type BaseSystemEvent struct {
	Timestamp string `json:"timestamp"`
}

func (BaseSystemEvent) GetEventType

func (bme BaseSystemEvent) GetEventType() string

type BaseSystemEventInterface

type BaseSystemEventInterface interface {
	BaseEvent
}

type BusinessCapabilityUpdateEvent

type BusinessCapabilityUpdateEvent struct {
	BaseBusinessAccountEvent
}

func NewBusinessCapabilityUpdateEvent

func NewBusinessCapabilityUpdateEvent() *BusinessCapabilityUpdateEvent

type BusinessPhoneNumber added in v0.0.15

type BusinessPhoneNumber struct {
	DisplayNumber string `json:"display_number"`
	Id            string `json:"id"`
}

type ContactsMessageEvent

type ContactsMessageEvent struct {
	BaseMessageEvent `json:",inline"`
	Contacts         components.ContactMessage `json:"contacts"`
}

ContactsMessageEvent represents an event that occurs when a message with contacts is received.

func NewContactsMessageEvent

func NewContactsMessageEvent(baseMessageEvent BaseMessageEvent, contacts components.ContactMessage) *ContactsMessageEvent

NewContactsMessageEvent creates a new ContactsMessageEvent instance.

type CustomerIdentityChangedEvent

type CustomerIdentityChangedEvent struct {
	BaseSystemEvent   `json:",inline"`
	Acknowledged      string `json:"acknowledged"`
	CreationTimestamp string `json:"creationTime"`
	Hash              string `json:"hash"`
}

type CustomerNumberChangedEvent

type CustomerNumberChangedEvent struct {
	BaseSystemEvent   `json:",inline"`
	ChangeDescription string `json:"changeDescription"`
	NewWaId           string `json:"newWaId"`
	OldWaId           string `json:"oldWaId"`
}

type DocumentMessageEvent

type DocumentMessageEvent struct {
	BaseMediaMessageEvent
	Document components.DocumentMessage
}

DocumentMessageEvent represents an event that occurs when a document message is received.

func NewDocumentMessageEvent

func NewDocumentMessageEvent(baseMessageEvent BaseMessageEvent, document components.DocumentMessage, mediaId, sha256, mimeType string) *DocumentMessageEvent

NewDocumentMessageEvent creates a new DocumentMessageEvent instance.

type EventType

type EventType string
const (
	TextMessageEventType                  EventType = "text_message"
	AudioMessageEventType                 EventType = "audio_message"
	VideoMessageEventType                 EventType = "video_message"
	ImageMessageEventType                 EventType = "image_message"
	ContactMessageEventType               EventType = "contact_message"
	DocumentMessageEventType              EventType = "document_message"
	LocationMessageEventType              EventType = "location_message"
	ReactionMessageEventType              EventType = "reaction_message"
	ListInteractionMessageEventType       EventType = "list_interaction_message"
	TemplateMessageEventType              EventType = "template_message"
	QuickReplyMessageEventType            EventType = "quick_reply_message"
	ReplyButtonInteractionEventType       EventType = "reply_button_interaction"
	StickerMessageEventType               EventType = "sticker_message"
	AdInteractionEventType                EventType = "ad_interaction_message"
	CustomerIdentityChangedEventType      EventType = "customer_identity_changed"
	CustomerNumberChangedEventType        EventType = "customer_number_changed"
	MessageDeliveredEventType             EventType = "message_delivered"
	MessageFailedEventType                EventType = "message_failed"
	MessageReadEventType                  EventType = "message_read"
	MessageSentEventType                  EventType = "message_sent"
	MessageUndeliveredEventType           EventType = "message_undelivered"
	OrderReceivedEventType                EventType = "order_received"
	ProductInquiryEventType               EventType = "product_inquiry"
	UnknownEventType                      EventType = "unknown"
	ErrorEventType                        EventType = "error"
	WarnEventType                         EventType = "warn"
	ReadyEventType                        EventType = "ready"
	MessageTemplateStatusUpdateEventType  EventType = "message_template_status_update"
	MessageTemplateQualityUpdateEventType EventType = "message_template_quality_update"
	PhoneNumberNameUpdateEventType        EventType = "phone_number_name_update"
	PhoneNumberQualityUpdateEventType     EventType = "phone_number_quality_update"
	SecurityEventType                     EventType = "security"
	AccountUpdateEventType                EventType = "account_update"
	AccountReviewUpdateEventType          EventType = "account_review_update"
	AccountAlertsEventType                EventType = "account_alerts"
	BusinessCapabilityUpdateEventType     EventType = "business_capability_update"
)

type ImageMessageEvent

type ImageMessageEvent struct {
	BaseMediaMessageEvent `json:",inline"`
	Image                 components.ImageMessage `json:"image"`
}

ImageMessageEvent represents an event for an image message.

func NewImageMessageEvent

func NewImageMessageEvent(baseMessageEvent BaseMessageEvent, image components.ImageMessage, mimeType, sha256, mediaId string) *ImageMessageEvent

NewImageMessageEvent creates a new ImageMessageEvent instance.

type ListInteractionEvent

type ListInteractionEvent struct {
	BaseMessageEvent `json:",inline"`
	Title            string `json:"title"`
	ListId           string `json:"list_id"`
	Description      string `json:"description"`
}

ListInteractionEvent represents an interaction event related to a list.

func NewListInteractionEvent

func NewListInteractionEvent(baseMessageEvent BaseMessageEvent, title, listId, description string) *ListInteractionEvent

NewListInteractionEvent creates a new ListInteractionEvent instance.

type LocationMessageEvent

type LocationMessageEvent struct {
	BaseMessageEvent `json:",inline"`
	Location         components.LocationMessage `json:"location"`
}

LocationMessageEvent represents an event that contains a location message.

func NewLocationMessageEvent

func NewLocationMessageEvent(baseMessageEvent BaseMessageEvent, location components.LocationMessage) *LocationMessageEvent

NewLocationMessageEvent creates a new LocationMessageEvent instance.

type MessageContext

type MessageContext struct {
	RepliedToMessageId string `json:"replied_to_message_id"`
}

type MessageDeliveredEvent

type MessageDeliveredEvent struct {
	BaseSystemEvent `json:",inline"`
	MessageId       string `json:"messageId"`
	SentTo          string `json:"sentTo"`
}

MessageDeliveredEvent represents an event related to an undelivered message.

func NewMessageDeliveredEvent

func NewMessageDeliveredEvent(baseSystemEvent BaseSystemEvent, messageId, sendTo string) *MessageDeliveredEvent

MessageDeliveredEvent creates a new instance of MessageUndeliveredEvent.

type MessageFailedEvent

type MessageFailedEvent struct {
	BaseSystemEvent `json:",inline"`
	MessageId       string `json:"messageId"`
	SentTo          string `json:"sentTo"`
	FailReason      string `json:"failReason"`
}

func NewMessageFailedEvent

func NewMessageFailedEvent(baseSystemEvent BaseSystemEvent, messageId, sendTo, failReason string) *MessageFailedEvent

type MessageReadEvent

type MessageReadEvent struct {
	BaseSystemEvent `json:",inline"`
	MessageId       string `json:"messageId"`
	SentTo          string `json:"sentTo"`
}

MessageReadEvent represents an event indicating that a message has been read.

func NewMessageReadEvent

func NewMessageReadEvent(baseSystemEvent BaseSystemEvent, messageId, sendTo string) *MessageReadEvent

NewMessageReadEvent creates a new instance of MessageReadEvent.

type MessageSentEvent

type MessageSentEvent struct {
	BaseSystemEvent `json:",inline"`
	MessageId       string `json:"messageId"`
	SentTo          string `json:"sentTo"`
}

MessageSentEvent represents an event indicating that a message has been sent.

func NewMessageSentEvent

func NewMessageSentEvent(baseSystemEvent BaseSystemEvent, messageId, sendTo string) *MessageSentEvent

NewMessageSentEvent creates a new instance of MessageSentEvent.

type MessageTemplateQualityUpdateEvent

type MessageTemplateQualityUpdateEvent struct {
	BaseBusinessAccountEvent
}

func NewMessageTemplateQualityUpdateEvent

func NewMessageTemplateQualityUpdateEvent() *MessageTemplateQualityUpdateEvent

type MessageTemplateStatusUpdateEvent

type MessageTemplateStatusUpdateEvent struct {
	BaseBusinessAccountEvent
}

func NewMessageTemplateStatusUpdateEvent

func NewMessageTemplateStatusUpdateEvent() *MessageTemplateStatusUpdateEvent

type MessageUndeliveredEvent

type MessageUndeliveredEvent struct {
	BaseSystemEvent `json:",inline"`
	MessageId       string `json:"messageId"`
	SentTo          string `json:"sentTo"`
}

MessageUndeliveredEvent represents an event related to an undelivered message.

func NewMessageUndeliveredEvent

func NewMessageUndeliveredEvent(baseSystemEvent BaseSystemEvent, messageId, sendTo string) *MessageUndeliveredEvent

NewMessageUndeliveredEvent creates a new instance of MessageUndeliveredEvent.

type OrderEvent

type OrderEvent struct {
	BaseMessageEvent `json:",inline"`
	Order            components.Order `json:"order"`
}

OrderEvent represents an event related to an order.

func NewOrderEvent

func NewOrderEvent(baseMessageEvent BaseMessageEvent, order components.Order) *OrderEvent

NewOrderEvent creates a new OrderEvent instance.

type PhoneNumberNameUpdateEvent

type PhoneNumberNameUpdateEvent struct {
	BaseBusinessAccountEvent
}

func NewPhoneNumberNameUpdateEvent

func NewPhoneNumberNameUpdateEvent() *PhoneNumberNameUpdateEvent

type PhoneNumberQualityUpdateEvent

type PhoneNumberQualityUpdateEvent struct {
	BaseBusinessAccountEvent
}

func NewPhoneNumberQualityUpdateEvent

func NewPhoneNumberQualityUpdateEvent() *PhoneNumberQualityUpdateEvent

type ProductInquiryEvent

type ProductInquiryEvent struct {
	BaseMessageEvent `json:",inline"`
	ProductId        string `json:"productId"`
	CatalogId        string `json:"catalogId"`
	Text             string `json:"text"`
}

ProductInquiryEvent represents an event related to a product inquiry.

func NewProductInquiryEvent

func NewProductInquiryEvent(baseMessageEvent BaseMessageEvent, productId, catalogId, text string) *ProductInquiryEvent

NewProductInquiryEvent creates a new instance of ProductInquiryEvent.

type QuickReplyButtonInteractionEvent

type QuickReplyButtonInteractionEvent struct {
	BaseMessageEvent `json:",inline"`
	ButtonText       string `json:"button_text"`
	ButtonPayload    string `json:"button_payload"`
}

QuickReplyButtonInteractionEvent represents an event triggered when a user interacts with a quick reply button.

func NewQuickReplyButtonInteractionEvent

func NewQuickReplyButtonInteractionEvent(baseMessageEvent BaseMessageEvent, buttonText, buttonPayload string) *QuickReplyButtonInteractionEvent

NewQuickReplyButtonInteractionEvent creates a new instance of QuickReplyButtonInteractionEvent.

type ReactionMessageEvent

type ReactionMessageEvent struct {
	BaseMessageEvent `json:",inline"`
	Reaction         components.ReactionMessage
}

ReactionMessageEvent represents an event that occurs when a reaction is added to a message.

func NewReactionMessageEvent

func NewReactionMessageEvent(baseMessageEvent BaseMessageEvent, reaction components.ReactionMessage) *ReactionMessageEvent

NewReactionMessageEvent creates a new ReactionMessageEvent instance.

type ReadyEvent

type ReadyEvent struct {
	BaseSystemEvent `json:",inline"`
}

ReadyEvent represents an event that is triggered when the system is ready.

func NewReadyEvent

func NewReadyEvent() *ReadyEvent

NewReadyEvent creates a new instance of ReadyEvent.

type ReplyButtonInteractionEvent

type ReplyButtonInteractionEvent struct {
	BaseMessageEvent `json:",inline"`
	Title            string `json:"title"`
	ButtonId         string `json:"button_id"`
}

ReplyButtonInteractionEvent represents an interaction event triggered by a reply button.

func NewReplyButtonInteractionEvent

func NewReplyButtonInteractionEvent(baseMessageEvent BaseMessageEvent, title, buttonId string) *ReplyButtonInteractionEvent

NewReplyButtonInteractionEvent creates a new instance of ReplyButtonInteractionEvent.

type SecurityEvent

type SecurityEvent struct {
	BaseBusinessAccountEvent
}

func NewSecurity

func NewSecurity() *SecurityEvent

type StickerMessageEvent

type StickerMessageEvent struct {
	BaseMediaMessageEvent `json:",inline"`
	Sticker               components.StickerMessage
}

StickerMessageEvent represents an event for a sticker message.

func NewStickerMessageEvent

func NewStickerMessageEvent(baseMessageEvent BaseMessageEvent, sticker components.StickerMessage, mediaId, sha256, mimeType string) *StickerMessageEvent

NewStickerMessageEvent creates a new StickerMessageEvent instance.

type TemplateCategoryUpdateEvent

type TemplateCategoryUpdateEvent struct {
	BaseBusinessAccountEvent
}

func NewMessageTemplateCategoryUpdateEvent

func NewMessageTemplateCategoryUpdateEvent() *TemplateCategoryUpdateEvent

type TextMessageEvent

type TextMessageEvent struct {
	BaseMessageEvent `json:",inline"`
	Text             string `json:"text"`
}

TextMessageEvent represents an event for a text message.

func NewTextMessageEvent

func NewTextMessageEvent(baseMessageEvent BaseMessageEvent, text string) *TextMessageEvent

NewTextMessageEvent creates a new TextMessageEvent instance.

type VideoMessageEvent

type VideoMessageEvent struct {
	BaseMediaMessageEvent `json:",inline"`
	Video                 components.VideoMessage `json:"video"`
}

VideoMessageEvent represents a WhatsApp video message event.

func NewVideoMessageEvent

func NewVideoMessageEvent(baseMessageEvent BaseMessageEvent, video components.VideoMessage, mimeType, sha256, mediaId string) *VideoMessageEvent

NewVideoMessageEvent creates a new VideoMessageEvent instance.

Jump to

Keyboard shortcuts

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