Class: Whatsapp::MessageTemplates::Response::Created
- Inherits:
-
Object
- Object
- Whatsapp::MessageTemplates::Response::Created
- Defined in:
- lib/ruby/whatsapp/message_templates/response/created.rb
Overview
The response to creating a template: {id, status, category}.
status is worth checking rather than assuming: a template built from scratch
normally comes back PENDING and takes up to 24 hours to review, but a library
clone or an authentication template is usually APPROVED immediately, and a
category Meta disagrees with comes back REJECTED right away.
category is echoed back because Meta may have reassigned it — automatic
recategorisation has been the default since 2025-04-09.
Source: https://developers.facebook.com/docs/graph-api/reference/whats-app-business-account/message_templates/
Instance Attribute Summary collapse
-
#category ⇒ String?
The category Meta actually assigned.
- #id ⇒ String?
- #status ⇒ String?
Class Method Summary collapse
Instance Method Summary collapse
-
#approved? ⇒ Boolean
Whether the template is already sendable.
-
#initialize(id: nil, status: nil, category: nil) ⇒ Created
constructor
A new instance of Created.
-
#pending? ⇒ Boolean
Whether the template is still in review.
-
#rejected? ⇒ Boolean
Whether the template failed review.
Constructor Details
#initialize(id: nil, status: nil, category: nil) ⇒ Created
Returns a new instance of Created.
32 33 34 35 36 |
# File 'lib/ruby/whatsapp/message_templates/response/created.rb', line 32 def initialize(id: nil, status: nil, category: nil) @id = id @status = status @category = category end |
Instance Attribute Details
#category ⇒ String?
Returns The category Meta actually assigned.
27 28 29 |
# File 'lib/ruby/whatsapp/message_templates/response/created.rb', line 27 def category @category end |
#id ⇒ String?
19 20 21 |
# File 'lib/ruby/whatsapp/message_templates/response/created.rb', line 19 def id @id end |
#status ⇒ String?
23 24 25 |
# File 'lib/ruby/whatsapp/message_templates/response/created.rb', line 23 def status @status end |
Class Method Details
.deserialize(data) ⇒ Created
41 42 43 44 45 |
# File 'lib/ruby/whatsapp/message_templates/response/created.rb', line 41 def deserialize(data) data ||= {} new(id: data["id"], status: data["status"], category: data["category"]) end |
Instance Method Details
#approved? ⇒ Boolean
Returns Whether the template is already sendable.
49 50 51 |
# File 'lib/ruby/whatsapp/message_templates/response/created.rb', line 49 def approved? status == Statuses::APPROVED end |