Class: Whatsapp::Webhook::AutomaticEvents
- Inherits:
-
Object
- Object
- Whatsapp::Webhook::AutomaticEvents
- Defined in:
- lib/ruby/whatsapp/webhook/automatic_events.rb
Overview
Purchase or lead event detection from Click to WhatsApp ad conversations.
Best-effort schema: Meta's public docs describe this field in one line with
no published JSON example; event_data's nested shape isn't confidently
typeable from that description alone, so it's kept as a raw hash rather than
guessing further. Validate against a real payload before relying on this in
production.
Source: https://developers.facebook.com/documentation/business-messaging/whatsapp/webhooks/overview
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(event_type:, message_id:, event_data:) ⇒ AutomaticEvents
constructor
A new instance of AutomaticEvents.
Constructor Details
#initialize(event_type:, message_id:, event_data:) ⇒ AutomaticEvents
Returns a new instance of AutomaticEvents.
26 27 28 29 30 |
# File 'lib/ruby/whatsapp/webhook/automatic_events.rb', line 26 def initialize(event_type:, message_id:, event_data:) @event_type = event_type @message_id = @event_data = event_data end |
Instance Attribute Details
#event_data ⇒ Hash
24 25 26 |
# File 'lib/ruby/whatsapp/webhook/automatic_events.rb', line 24 def event_data @event_data end |
#event_type ⇒ String?
Returns e.g. "purchase", "lead".
16 17 18 |
# File 'lib/ruby/whatsapp/webhook/automatic_events.rb', line 16 def event_type @event_type end |
#message_id ⇒ String?
20 21 22 |
# File 'lib/ruby/whatsapp/webhook/automatic_events.rb', line 20 def @message_id end |
Class Method Details
.deserialize(data) ⇒ AutomaticEvents
35 36 37 38 39 |
# File 'lib/ruby/whatsapp/webhook/automatic_events.rb', line 35 def deserialize(data) data ||= {} new(event_type: data["event_type"], message_id: data["message_id"], event_data: data["event_data"] || {}) end |