Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/internal/event_types/event_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const (
NEWSLETTER = "NEWSLETTER"
QRCODE = "QRCODE"
BUTTON_CLICK = "BUTTON_CLICK"
PICTURE = "PICTURE"
USER_ABOUT = "USER_ABOUT"
BUSINESS_NAME = "BUSINESS_NAME"
Comment on lines +19 to +21

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 question (security): Double-check that exposing PICTURE/USER_ABOUT/BUSINESS_NAME as event types aligns with privacy expectations.

Since these fields can now flow through webhooks/queues, please confirm they’re acceptable to treat as event payloads from a privacy/compliance perspective (e.g., sensitivity, redaction needs, integrator consent). It may also be worth checking how we handle similar profile events today and aligning with those safeguards for consistency.

)

var AllEventTypes = []string{
Expand All @@ -33,6 +36,9 @@ var AllEventTypes = []string{
NEWSLETTER,
QRCODE,
BUTTON_CLICK,
PICTURE,
USER_ABOUT,
BUSINESS_NAME,
}

var validEventTypes = map[string]bool{
Expand All @@ -51,6 +57,9 @@ var validEventTypes = map[string]bool{
NEWSLETTER: true,
QRCODE: true,
BUTTON_CLICK: true,
PICTURE: true,
USER_ABOUT: true,
BUSINESS_NAME: true,
}

func IsEventType(eventType string) bool {
Expand Down
24 changes: 24 additions & 0 deletions pkg/whatsmeow/service/whatsmeow.go
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,15 @@ func (mycli *MyClient) myEventHandler(rawEvt interface{}) {
case *events.PushName:
doWebhook = true
postMap["event"] = "PushName"
case *events.Picture:
doWebhook = true
postMap["event"] = "Picture"
case *events.UserAbout:
doWebhook = true
postMap["event"] = "UserAbout"
case *events.BusinessName:
doWebhook = true
postMap["event"] = "BusinessName"
case *events.IdentityChange:
doWebhook = false
case *events.GroupInfo:
Expand Down Expand Up @@ -2127,6 +2136,21 @@ func (w *whatsmeowService) CallWebhook(instance *instance_model.Instance, queueN
w.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Event received of type %s", instance.Id, eventType)
w.sendToQueueOrWebhook(instance, queueName, jsonData)
}
case "Picture":
if contains(subscriptions, "PICTURE") {
w.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Event received of type %s", instance.Id, eventType)
w.sendToQueueOrWebhook(instance, queueName, jsonData)
}
case "UserAbout":
if contains(subscriptions, "USER_ABOUT") {
w.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Event received of type %s", instance.Id, eventType)
w.sendToQueueOrWebhook(instance, queueName, jsonData)
}
case "BusinessName":
if contains(subscriptions, "BUSINESS_NAME") {
w.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Event received of type %s", instance.Id, eventType)
w.sendToQueueOrWebhook(instance, queueName, jsonData)
}

default:
return
Expand Down