Class: Whatsapp::Webhook::AccountUpdate

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/whatsapp/webhook/account_update.rb,
lib/ruby/whatsapp/webhook/account_update/ban_info.rb

Overview

Partner-led verification, authentication rates, primary location, policy violations, offboarding, reconnection, or deletion of a WhatsApp Business Account.

Best-effort schema: Meta's public docs describe this field in one line with no published JSON example. Validate against a real payload (App Dashboard "send test payload") before relying on these attribute names in production. Source: https://developers.facebook.com/documentation/business-messaging/whatsapp/webhooks/overview

Defined Under Namespace

Classes: BanInfo

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(phone_number:, event:, ban_info: nil) ⇒ AccountUpdate

Returns a new instance of AccountUpdate.



25
26
27
28
29
# File 'lib/ruby/whatsapp/webhook/account_update.rb', line 25

def initialize(phone_number:, event:, ban_info: nil)
  @phone_number = phone_number
  @event = event
  @ban_info = ban_info
end

Instance Attribute Details

#ban_infoBanInfo?

Returns:



23
24
25
# File 'lib/ruby/whatsapp/webhook/account_update.rb', line 23

def ban_info
  @ban_info
end

#eventString?

Returns e.g. "VERIFIED_ACCOUNT", "DISABLED_UPDATE", "PARTNER_APP_INSTALLED".

Returns:

  • (String, nil)

    e.g. "VERIFIED_ACCOUNT", "DISABLED_UPDATE", "PARTNER_APP_INSTALLED".



19
20
21
# File 'lib/ruby/whatsapp/webhook/account_update.rb', line 19

def event
  @event
end

#phone_numberString?

Returns:

  • (String, nil)


15
16
17
# File 'lib/ruby/whatsapp/webhook/account_update.rb', line 15

def phone_number
  @phone_number
end

Class Method Details

.deserialize(data) ⇒ AccountUpdate

Parameters:

  • data (Hash)

    The raw value hash.

Returns:



34
35
36
37
38
39
40
41
42
# File 'lib/ruby/whatsapp/webhook/account_update.rb', line 34

def deserialize(data)
  data ||= {}

  new(
    phone_number: data["phone_number"],
    event: data["event"],
    ban_info: data["ban_info"] ? BanInfo.deserialize(data["ban_info"]) : nil
  )
end