import "github.com/sarthakjdev/wapi.go/pkg/events"

type AdInteractionEvent

AdInteractionEvent represents an ad interaction event.

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

func NewAdInteractionEvent

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

NewAdInteractionEvent creates a new instance of AdInteractionEvent.

type AdInteractionSourceMediaType

AdInteractionSourceMediaType represents the media type of an ad interaction source.

type AdInteractionSourceMediaType string
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

AdInteractionSourceType represents the source type of an ad interaction.

type AdInteractionSourceType string
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

AdSource represents the source of an ad.

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

type AudioMessageEvent

AudioMessageEvent represents an event for an audio message.

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

func NewAudioMessageEvent

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

NewAudioMessageEvent creates a new AudioMessageEvent instance.

type BaseEvent

type BaseEvent interface {
    GetEventType() string
}

type BaseMediaMessageEvent

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

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

type BaseMessageEvent

type BaseMessageEvent struct {
    requester   request_client.RequestClient
    MessageId   string         `json:"message_id"`
    Context     MessageContext `json:"context"`
    Timestamp   string         `json:"timestamp"`
    IsForwarded bool           `json:"is_forwarded"`
    PhoneNumber string         `json:"phone_number"`
}

func NewBaseMessageEvent

func NewBaseMessageEvent(phoneNumber string, messageId string, timestamp string, from string, isForwarded bool, requester request_client.RequestClient) 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 BaseSystemEvent

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

func (BaseSystemEvent) GetEventType

func (bme BaseSystemEvent) GetEventType() string

type BaseSystemEventInterface

type BaseSystemEventInterface interface {
    BaseEvent
}

type ContactsMessageEvent

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

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

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

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

type DocumentMessageEvent struct {
    BaseMediaMessageEvent
    Document components.DocumentMessage
}

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

type ImageMessageEvent

ImageMessageEvent represents an event for an image message.

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

func NewImageMessageEvent

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

NewImageMessageEvent creates a new ImageMessageEvent instance.

type ListInteractionEvent

ListInteractionEvent represents an interaction event related to a list.

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

func NewListInteractionEvent

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

NewListInteractionEvent creates a new ListInteractionEvent instance.

type LocationMessageEvent

LocationMessageEvent represents an event that contains a location message.

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

func NewLocationMessageEvent

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

NewLocationMessageEvent creates a new LocationMessageEvent instance.

type MessageContext

type MessageContext struct {
    From string `json:"from"`
}

type MessageDeliveredEvent

MessageDeliveredEvent represents an event related to an undelivered message.

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

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

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

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

func NewMessageReadEvent

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

NewMessageReadEvent creates a new instance of MessageReadEvent.

type MessageSentEvent

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

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

func NewMessageSentEvent

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

NewMessageSentEvent creates a new instance of MessageSentEvent.

type MessageUndeliveredEvent

MessageUndeliveredEvent represents an event related to an undelivered message.

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

func NewMessageUndeliveredEvent

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

NewMessageUndeliveredEvent creates a new instance of MessageUndeliveredEvent.

type OrderEvent

OrderEvent represents an event related to an order.

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

func NewOrderEvent

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

NewOrderEvent creates a new OrderEvent instance.

type ProductInquiryEvent

ProductInquiryEvent represents an event related to a product inquiry.

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

func NewProductInquiryEvent

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

NewProductInquiryEvent creates a new instance of ProductInquiryEvent.

type QuickReplyButtonInteractionEvent

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

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

func NewQuickReplyButtonInteractionEvent

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

NewQuickReplyButtonInteractionEvent creates a new instance of QuickReplyButtonInteractionEvent.

type ReactionMessageEvent

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

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

func NewReactionMessageEvent

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

NewReactionMessageEvent creates a new ReactionMessageEvent instance.

type ReadyEvent

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

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

func NewReadyEvent

func NewReadyEvent() *ReadyEvent

NewReadyEvent creates a new instance of ReadyEvent.

type ReplyButtonInteractionEvent

ReplyButtonInteractionEvent represents an interaction event triggered by a reply button.

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

func NewReplyButtonInteractionEvent

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

NewReplyButtonInteractionEvent creates a new instance of ReplyButtonInteractionEvent.

type StickerMessageEvent

StickerMessageEvent represents an event for a sticker message.

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

func NewStickerMessageEvent

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

NewStickerMessageEvent creates a new StickerMessageEvent instance.

type TextMessageEvent

TextMessageEvent represents an event for a text message.

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

func NewTextMessageEvent

func NewTextMessageEvent(baseMessageEvent BaseMessageEvent, text string) *TextMessageEvent

NewTextMessageEvent creates a new TextMessageEvent instance.

type VideoMessageEvent

VideoMessageEvent represents a WhatsApp video message event.

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

func NewVideoMessageEvent

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

NewVideoMessageEvent creates a new VideoMessageEvent instance.