Documentation ¶
Index ¶
- Constants
- type BotClientList
- type MessagePayload
- type ReplyMessage
- type WaBot
- func (wb *WaBot) Register()
- func (wb *WaBot) SendImgMsg(recipient types.JID, uploadedImg *whatsmeow.UploadResponse, ...) error
- func (wb *WaBot) SendMsg(recipient types.JID, msg string) error
- func (wb *WaBot) UploadImgToWhatsapp(imgPath string) (*[]byte, *whatsmeow.UploadResponse, error)
- func (wb *WaBot) ValidateAndGetRecipient(phone string, ignoreInContactList bool) (*types.JID, error)
- type WaManager
- type WebhookBody
Constants ¶
View Source
const ( IncomingMessage = "INCOMING_MESSAGE" OutgoingMessage = "OUTGOING_MESSAGE" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BotClientList ¶
BotClientList defines the variable to store WaBot objects
type MessagePayload ¶ added in v0.0.10
type MessagePayload struct { From string `json:"from"` To string `json:"to"` Message string `json:"message,omitempty"` ImageFileName string `json:"image_filename,omitempty"` ImageCaption string `json:"image_caption,omitempty"` }
func (*MessagePayload) Sanitize ¶ added in v0.0.10
func (p *MessagePayload) Sanitize()
Sanitize sanitizes message payload
func (*MessagePayload) Validate ¶ added in v0.0.10
func (p *MessagePayload) Validate() error
Validate validates message payload
type ReplyMessage ¶
type WaBot ¶
type WaBot struct { Client *whatsmeow.Client Log *logger.Logger HttpClient *http.Client EventHandlerID uint32 Phone string WebhookUrl string ImageDir string EchoMsg bool WHookEnabled bool }
WaBot defines the bot client
func LoginExistingWASession ¶
func LoginExistingWASession(httpClient *http.Client, webhookUrl, imageDir string, container *sqlstore.Container, log *logger.Logger, jidStr, phone string, echoMsg, wHookEnabled bool) (*WaBot, error)
LoginExistingWASession logins with an existing session on the database
func NewWhatsappClient ¶
func NewWhatsappClient(httpClient *http.Client, webhookUrl, imageDir string, container *sqlstore.Container, log *logger.Logger, phone, fileDir string, echoMsg, wHookEnabled bool, printTerminal bool) (*WaBot, error)
NewWhatsappClient initializes Whatsapp client
func (*WaBot) SendImgMsg ¶ added in v0.0.10
func (wb *WaBot) SendImgMsg(recipient types.JID, uploadedImg *whatsmeow.UploadResponse, imgCaption, contentType string, fileLength uint64) error
SendImgMsg sends image-based message to designated whatsapp number
func (*WaBot) UploadImgToWhatsapp ¶ added in v0.0.10
UploadImgToWhatsapp uploads the prepared image to Whatsapp server
type WebhookBody ¶
type WebhookBody struct { PhoneOwner string `json:"phone_owner"` EventType string `json:"event_type"` MsgId string `json:"msg_id"` MsgType string `json:"msg_type"` Phone string `json:"phone"` Name string `json:"name"` Message string `json:"message"` TargetJID string `json:"target_jid"` TargetDevice string `json:"target_device"` Timestamp string `json:"timestamp"` }
Click to show internal directories.
Click to hide internal directories.