zavudev 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +37 -0
  3. data/README.md +1 -1
  4. data/lib/zavudev/models/channel.rb +1 -5
  5. data/lib/zavudev/models/function_create_params.rb +36 -4
  6. data/lib/zavudev/models/function_create_response.rb +4 -2
  7. data/lib/zavudev/models/function_deploy_params.rb +31 -3
  8. data/lib/zavudev/models/function_deploy_response.rb +20 -3
  9. data/lib/zavudev/models/function_get_deployment_response.rb +20 -3
  10. data/lib/zavudev/models/function_retrieve_response.rb +4 -2
  11. data/lib/zavudev/models/function_update_params.rb +41 -3
  12. data/lib/zavudev/models/function_update_response.rb +4 -2
  13. data/lib/zavudev/models/invitation.rb +101 -9
  14. data/lib/zavudev/models/invitation_create_params.rb +34 -13
  15. data/lib/zavudev/models/invitation_list_params.rb +14 -0
  16. data/lib/zavudev/models/message.rb +28 -6
  17. data/lib/zavudev/models/message_send_params.rb +2 -5
  18. data/lib/zavudev/models/message_type.rb +16 -0
  19. data/lib/zavudev/models/phone_number_pricing.rb +7 -2
  20. data/lib/zavudev/models/phone_number_search_available_params.rb +13 -1
  21. data/lib/zavudev/models/sender.rb +12 -1
  22. data/lib/zavudev/models/sender_create_params.rb +72 -4
  23. data/lib/zavudev/models/sender_update_params.rb +65 -1
  24. data/lib/zavudev/models/sender_webhook.rb +47 -1
  25. data/lib/zavudev/models/senders/agent/agent_tool.rb +19 -1
  26. data/lib/zavudev/models/senders/agent/tool_create_params.rb +7 -2
  27. data/lib/zavudev/models/senders/agent/tool_test_response.rb +90 -5
  28. data/lib/zavudev/models/senders/agent.rb +198 -1
  29. data/lib/zavudev/models/senders/agent_create_params.rb +188 -1
  30. data/lib/zavudev/models/senders/agent_execution.rb +26 -1
  31. data/lib/zavudev/models/senders/agent_update_params.rb +188 -1
  32. data/lib/zavudev/models/template.rb +1 -0
  33. data/lib/zavudev/models/template_create_params.rb +19 -9
  34. data/lib/zavudev/models/webhook_event.rb +51 -19
  35. data/lib/zavudev/resources/broadcasts.rb +20 -4
  36. data/lib/zavudev/resources/functions.rb +35 -10
  37. data/lib/zavudev/resources/invitations.rb +18 -12
  38. data/lib/zavudev/resources/messages.rb +24 -4
  39. data/lib/zavudev/resources/number_10dlc/brands.rb +5 -1
  40. data/lib/zavudev/resources/number_10dlc/campaigns.rb +6 -1
  41. data/lib/zavudev/resources/phone_numbers.rb +12 -3
  42. data/lib/zavudev/resources/senders/agent/executions.rb +5 -0
  43. data/lib/zavudev/resources/senders/agent/tools.rb +14 -2
  44. data/lib/zavudev/resources/senders/agent.rb +18 -2
  45. data/lib/zavudev/resources/senders.rb +15 -3
  46. data/lib/zavudev/version.rb +1 -1
  47. data/rbi/zavudev/models/channel.rbi +1 -5
  48. data/rbi/zavudev/models/function_create_params.rbi +50 -2
  49. data/rbi/zavudev/models/function_create_response.rbi +6 -2
  50. data/rbi/zavudev/models/function_deploy_params.rbi +42 -2
  51. data/rbi/zavudev/models/function_deploy_response.rbi +20 -0
  52. data/rbi/zavudev/models/function_get_deployment_response.rbi +20 -0
  53. data/rbi/zavudev/models/function_retrieve_response.rbi +6 -2
  54. data/rbi/zavudev/models/function_update_params.rbi +57 -2
  55. data/rbi/zavudev/models/function_update_response.rbi +6 -2
  56. data/rbi/zavudev/models/invitation.rbi +162 -13
  57. data/rbi/zavudev/models/invitation_create_params.rbi +51 -18
  58. data/rbi/zavudev/models/invitation_list_params.rbi +17 -0
  59. data/rbi/zavudev/models/message.rbi +47 -8
  60. data/rbi/zavudev/models/message_send_params.rbi +4 -10
  61. data/rbi/zavudev/models/message_type.rbi +18 -0
  62. data/rbi/zavudev/models/phone_number_pricing.rbi +6 -2
  63. data/rbi/zavudev/models/phone_number_search_available_params.rbi +13 -0
  64. data/rbi/zavudev/models/sender.rbi +17 -0
  65. data/rbi/zavudev/models/sender_create_params.rbi +136 -4
  66. data/rbi/zavudev/models/sender_update_params.rbi +124 -0
  67. data/rbi/zavudev/models/sender_webhook.rbi +69 -0
  68. data/rbi/zavudev/models/senders/agent/agent_tool.rbi +26 -3
  69. data/rbi/zavudev/models/senders/agent/tool_create_params.rbi +6 -2
  70. data/rbi/zavudev/models/senders/agent/tool_test_response.rbi +130 -5
  71. data/rbi/zavudev/models/senders/agent.rbi +320 -3
  72. data/rbi/zavudev/models/senders/agent_create_params.rbi +304 -0
  73. data/rbi/zavudev/models/senders/agent_execution.rbi +31 -3
  74. data/rbi/zavudev/models/senders/agent_update_params.rbi +304 -0
  75. data/rbi/zavudev/models/template.rbi +5 -0
  76. data/rbi/zavudev/models/template_create_params.rbi +27 -6
  77. data/rbi/zavudev/models/webhook_event.rbi +55 -20
  78. data/rbi/zavudev/resources/broadcasts.rbi +20 -4
  79. data/rbi/zavudev/resources/functions.rbi +62 -6
  80. data/rbi/zavudev/resources/invitations.rbi +36 -16
  81. data/rbi/zavudev/resources/messages.rbi +27 -10
  82. data/rbi/zavudev/resources/number_10dlc/brands.rbi +5 -1
  83. data/rbi/zavudev/resources/number_10dlc/campaigns.rbi +6 -1
  84. data/rbi/zavudev/resources/phone_numbers.rbi +10 -2
  85. data/rbi/zavudev/resources/senders/agent/executions.rbi +5 -0
  86. data/rbi/zavudev/resources/senders/agent/tools.rbi +13 -2
  87. data/rbi/zavudev/resources/senders/agent.rbi +16 -0
  88. data/rbi/zavudev/resources/senders.rbi +56 -2
  89. data/sig/zavudev/models/channel.rbs +0 -2
  90. data/sig/zavudev/models/function_create_params.rbs +14 -0
  91. data/sig/zavudev/models/function_deploy_params.rbs +14 -0
  92. data/sig/zavudev/models/function_deploy_response.rbs +5 -0
  93. data/sig/zavudev/models/function_get_deployment_response.rbs +5 -0
  94. data/sig/zavudev/models/function_update_params.rbs +21 -0
  95. data/sig/zavudev/models/invitation.rbs +58 -3
  96. data/sig/zavudev/models/invitation_create_params.rbs +2 -2
  97. data/sig/zavudev/models/invitation_list_params.rbs +3 -1
  98. data/sig/zavudev/models/message.rbs +7 -0
  99. data/sig/zavudev/models/message_type.rbs +4 -0
  100. data/sig/zavudev/models/phone_number_search_available_params.rbs +7 -0
  101. data/sig/zavudev/models/sender.rbs +7 -0
  102. data/sig/zavudev/models/sender_create_params.rbs +35 -0
  103. data/sig/zavudev/models/sender_update_params.rbs +35 -0
  104. data/sig/zavudev/models/sender_webhook.rbs +17 -0
  105. data/sig/zavudev/models/senders/agent/agent_tool.rbs +10 -3
  106. data/sig/zavudev/models/senders/agent/tool_test_response.rbs +68 -4
  107. data/sig/zavudev/models/senders/agent.rbs +161 -3
  108. data/sig/zavudev/models/senders/agent_create_params.rbs +152 -1
  109. data/sig/zavudev/models/senders/agent_execution.rbs +13 -3
  110. data/sig/zavudev/models/senders/agent_update_params.rbs +152 -1
  111. data/sig/zavudev/models/template.rbs +2 -1
  112. data/sig/zavudev/models/template_create_params.rbs +9 -6
  113. data/sig/zavudev/models/webhook_event.rbs +10 -2
  114. data/sig/zavudev/resources/functions.rbs +7 -0
  115. data/sig/zavudev/resources/phone_numbers.rbs +1 -0
  116. data/sig/zavudev/resources/senders/agent.rbs +2 -0
  117. data/sig/zavudev/resources/senders.rbs +6 -0
  118. metadata +2 -2
@@ -108,7 +108,9 @@ module Zavudev
108
108
  sig { returns(T.nilable(String)) }
109
109
  attr_accessor :description
110
110
 
111
- # HTTPS endpoint when httpEnabled is true.
111
+ # HTTPS endpoint, present only while httpEnabled is true. Null otherwise,
112
+ # including for a function that was previously exposed — the stored URL stops
113
+ # serving the moment HTTP is turned off, so it is never returned.
112
114
  sig { returns(T.nilable(String)) }
113
115
  attr_accessor :public_url
114
116
 
@@ -157,7 +159,9 @@ module Zavudev
157
159
  # ID of the deployment currently serving traffic.
158
160
  active_deployment_id: nil,
159
161
  description: nil,
160
- # HTTPS endpoint when httpEnabled is true.
162
+ # HTTPS endpoint, present only while httpEnabled is true. Null otherwise,
163
+ # including for a function that was previously exposed — the stored URL stops
164
+ # serving the moment HTTP is turned off, so it is never returned.
161
165
  public_url: nil
162
166
  )
163
167
  end
@@ -20,6 +20,11 @@ module Zavudev
20
20
  attr_accessor :expires_at
21
21
 
22
22
  # Current status of the partner invitation.
23
+ #
24
+ # `failed` means the client started the connection and it did not finish (they
25
+ # cancelled Meta's dialog, denied a permission, or abandoned the tab). A failed
26
+ # invitation is still usable: the same link can be retried, and it moves back to
27
+ # `in_progress` when the client tries again.
23
28
  sig { returns(Zavudev::Invitation::Status::TaggedSymbol) }
24
29
  attr_accessor :status
25
30
 
@@ -42,8 +47,23 @@ module Zavudev
42
47
  sig { returns(T.nilable(Time)) }
43
48
  attr_accessor :completed_at
44
49
 
45
- # How the client connects WhatsApp: `whatsapp_waba` (official Cloud API via
46
- # embedded signup) or `whatsapp_alt` (QR-linked).
50
+ # The account the client linked, populated once the invitation is `completed`.
51
+ # Null before that. Use it to show the partner what was connected without fetching
52
+ # the sender.
53
+ sig { returns(T.nilable(Zavudev::Invitation::ConnectedAccount)) }
54
+ attr_reader :connected_account
55
+
56
+ sig do
57
+ params(
58
+ connected_account:
59
+ T.nilable(Zavudev::Invitation::ConnectedAccount::OrHash)
60
+ ).void
61
+ end
62
+ attr_writer :connected_account
63
+
64
+ # Which Meta channel the client connects: `whatsapp_waba` (official WhatsApp Cloud
65
+ # API via embedded signup) or `messenger` (a Facebook Page's Messenger inbox,
66
+ # including Marketplace chats).
47
67
  sig do
48
68
  returns(T.nilable(Zavudev::Invitation::ConnectionType::TaggedSymbol))
49
69
  end
@@ -56,7 +76,19 @@ module Zavudev
56
76
  end
57
77
  attr_writer :connection_type
58
78
 
59
- # ID of a pre-assigned Zavu phone number for WhatsApp registration.
79
+ sig { returns(T.nilable(Time)) }
80
+ attr_accessor :failed_at
81
+
82
+ # Stable code for why the last attempt failed, present when `status` is `failed`.
83
+ # Values include `fb_cancelled` (client closed Meta's dialog), `fb_not_authorized`
84
+ # (permission denied), `signup_abandoned` (started but never finished),
85
+ # `meta_no_pages` (the client administers no Facebook Page), and `internal_error`.
86
+ # Treat unknown codes as a generic failure.
87
+ sig { returns(T.nilable(String)) }
88
+ attr_accessor :failure_reason
89
+
90
+ # ID of a pre-assigned Zavu phone number for WhatsApp registration. Always null
91
+ # for `messenger` invitations.
60
92
  sig { returns(T.nilable(String)) }
61
93
  attr_accessor :phone_number_id
62
94
 
@@ -83,7 +115,11 @@ module Zavudev
83
115
  client_name: T.nilable(String),
84
116
  client_phone: T.nilable(String),
85
117
  completed_at: T.nilable(Time),
118
+ connected_account:
119
+ T.nilable(Zavudev::Invitation::ConnectedAccount::OrHash),
86
120
  connection_type: Zavudev::Invitation::ConnectionType::OrSymbol,
121
+ failed_at: T.nilable(Time),
122
+ failure_reason: T.nilable(String),
87
123
  phone_number_id: T.nilable(String),
88
124
  sender_id: T.nilable(String),
89
125
  started_at: T.nilable(Time),
@@ -97,6 +133,11 @@ module Zavudev
97
133
  created_at:,
98
134
  expires_at:,
99
135
  # Current status of the partner invitation.
136
+ #
137
+ # `failed` means the client started the connection and it did not finish (they
138
+ # cancelled Meta's dialog, denied a permission, or abandoned the tab). A failed
139
+ # invitation is still usable: the same link can be retried, and it moves back to
140
+ # `in_progress` when the client tries again.
100
141
  status:,
101
142
  updated_at:,
102
143
  # Full URL to share with the client.
@@ -105,10 +146,23 @@ module Zavudev
105
146
  client_name: nil,
106
147
  client_phone: nil,
107
148
  completed_at: nil,
108
- # How the client connects WhatsApp: `whatsapp_waba` (official Cloud API via
109
- # embedded signup) or `whatsapp_alt` (QR-linked).
149
+ # The account the client linked, populated once the invitation is `completed`.
150
+ # Null before that. Use it to show the partner what was connected without fetching
151
+ # the sender.
152
+ connected_account: nil,
153
+ # Which Meta channel the client connects: `whatsapp_waba` (official WhatsApp Cloud
154
+ # API via embedded signup) or `messenger` (a Facebook Page's Messenger inbox,
155
+ # including Marketplace chats).
110
156
  connection_type: nil,
111
- # ID of a pre-assigned Zavu phone number for WhatsApp registration.
157
+ failed_at: nil,
158
+ # Stable code for why the last attempt failed, present when `status` is `failed`.
159
+ # Values include `fb_cancelled` (client closed Meta's dialog), `fb_not_authorized`
160
+ # (permission denied), `signup_abandoned` (started but never finished),
161
+ # `meta_no_pages` (the client administers no Facebook Page), and `internal_error`.
162
+ # Treat unknown codes as a generic failure.
163
+ failure_reason: nil,
164
+ # ID of a pre-assigned Zavu phone number for WhatsApp registration. Always null
165
+ # for `messenger` invitations.
112
166
  phone_number_id: nil,
113
167
  # ID of the sender created when invitation is completed.
114
168
  sender_id: nil,
@@ -131,7 +185,10 @@ module Zavudev
131
185
  client_name: T.nilable(String),
132
186
  client_phone: T.nilable(String),
133
187
  completed_at: T.nilable(Time),
188
+ connected_account: T.nilable(Zavudev::Invitation::ConnectedAccount),
134
189
  connection_type: Zavudev::Invitation::ConnectionType::TaggedSymbol,
190
+ failed_at: T.nilable(Time),
191
+ failure_reason: T.nilable(String),
135
192
  phone_number_id: T.nilable(String),
136
193
  sender_id: T.nilable(String),
137
194
  started_at: T.nilable(Time),
@@ -143,6 +200,11 @@ module Zavudev
143
200
  end
144
201
 
145
202
  # Current status of the partner invitation.
203
+ #
204
+ # `failed` means the client started the connection and it did not finish (they
205
+ # cancelled Meta's dialog, denied a permission, or abandoned the tab). A failed
206
+ # invitation is still usable: the same link can be retried, and it moves back to
207
+ # `in_progress` when the client tries again.
146
208
  module Status
147
209
  extend Zavudev::Internal::Type::Enum
148
210
 
@@ -156,6 +218,7 @@ module Zavudev
156
218
  COMPLETED = T.let(:completed, Zavudev::Invitation::Status::TaggedSymbol)
157
219
  EXPIRED = T.let(:expired, Zavudev::Invitation::Status::TaggedSymbol)
158
220
  CANCELLED = T.let(:cancelled, Zavudev::Invitation::Status::TaggedSymbol)
221
+ FAILED = T.let(:failed, Zavudev::Invitation::Status::TaggedSymbol)
159
222
 
160
223
  sig do
161
224
  override.returns(T::Array[Zavudev::Invitation::Status::TaggedSymbol])
@@ -164,8 +227,97 @@ module Zavudev
164
227
  end
165
228
  end
166
229
 
167
- # How the client connects WhatsApp: `whatsapp_waba` (official Cloud API via
168
- # embedded signup) or `whatsapp_alt` (QR-linked).
230
+ class ConnectedAccount < Zavudev::Internal::Type::BaseModel
231
+ OrHash =
232
+ T.type_alias do
233
+ T.any(
234
+ Zavudev::Invitation::ConnectedAccount,
235
+ Zavudev::Internal::AnyHash
236
+ )
237
+ end
238
+
239
+ # Provider-side identifier: the WhatsApp phone number ID, or the Facebook Page ID.
240
+ sig { returns(String) }
241
+ attr_accessor :id
242
+
243
+ sig do
244
+ returns(Zavudev::Invitation::ConnectedAccount::Channel::TaggedSymbol)
245
+ end
246
+ attr_accessor :channel
247
+
248
+ # Display name of the connected account: the WhatsApp verified name, or the
249
+ # Facebook Page name.
250
+ sig { returns(T.nilable(String)) }
251
+ attr_accessor :name
252
+
253
+ # The account the client linked, populated once the invitation is `completed`.
254
+ # Null before that. Use it to show the partner what was connected without fetching
255
+ # the sender.
256
+ sig do
257
+ params(
258
+ id: String,
259
+ channel: Zavudev::Invitation::ConnectedAccount::Channel::OrSymbol,
260
+ name: T.nilable(String)
261
+ ).returns(T.attached_class)
262
+ end
263
+ def self.new(
264
+ # Provider-side identifier: the WhatsApp phone number ID, or the Facebook Page ID.
265
+ id:,
266
+ channel:,
267
+ # Display name of the connected account: the WhatsApp verified name, or the
268
+ # Facebook Page name.
269
+ name: nil
270
+ )
271
+ end
272
+
273
+ sig do
274
+ override.returns(
275
+ {
276
+ id: String,
277
+ channel:
278
+ Zavudev::Invitation::ConnectedAccount::Channel::TaggedSymbol,
279
+ name: T.nilable(String)
280
+ }
281
+ )
282
+ end
283
+ def to_hash
284
+ end
285
+
286
+ module Channel
287
+ extend Zavudev::Internal::Type::Enum
288
+
289
+ TaggedSymbol =
290
+ T.type_alias do
291
+ T.all(Symbol, Zavudev::Invitation::ConnectedAccount::Channel)
292
+ end
293
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
294
+
295
+ WHATSAPP =
296
+ T.let(
297
+ :whatsapp,
298
+ Zavudev::Invitation::ConnectedAccount::Channel::TaggedSymbol
299
+ )
300
+ MESSENGER =
301
+ T.let(
302
+ :messenger,
303
+ Zavudev::Invitation::ConnectedAccount::Channel::TaggedSymbol
304
+ )
305
+
306
+ sig do
307
+ override.returns(
308
+ T::Array[
309
+ Zavudev::Invitation::ConnectedAccount::Channel::TaggedSymbol
310
+ ]
311
+ )
312
+ end
313
+ def self.values
314
+ end
315
+ end
316
+ end
317
+
318
+ # Which Meta channel the client connects: `whatsapp_waba` (official WhatsApp Cloud
319
+ # API via embedded signup) or `messenger` (a Facebook Page's Messenger inbox,
320
+ # including Marketplace chats).
169
321
  module ConnectionType
170
322
  extend Zavudev::Internal::Type::Enum
171
323
 
@@ -178,11 +330,8 @@ module Zavudev
178
330
  :whatsapp_waba,
179
331
  Zavudev::Invitation::ConnectionType::TaggedSymbol
180
332
  )
181
- WHATSAPP_ALT =
182
- T.let(
183
- :whatsapp_alt,
184
- Zavudev::Invitation::ConnectionType::TaggedSymbol
185
- )
333
+ MESSENGER =
334
+ T.let(:messenger, Zavudev::Invitation::ConnectionType::TaggedSymbol)
186
335
 
187
336
  sig do
188
337
  override.returns(
@@ -11,7 +11,8 @@ module Zavudev
11
11
  T.any(Zavudev::InvitationCreateParams, Zavudev::Internal::AnyHash)
12
12
  end
13
13
 
14
- # ISO country codes for allowed phone numbers.
14
+ # ISO country codes for allowed phone numbers. Only valid when `connectionType` is
15
+ # `whatsapp_waba` — sending it with `messenger` returns 400.
15
16
  sig { returns(T.nilable(T::Array[String])) }
16
17
  attr_reader :allowed_phone_countries
17
18
 
@@ -39,10 +40,19 @@ module Zavudev
39
40
  sig { params(client_phone: String).void }
40
41
  attr_writer :client_phone
41
42
 
42
- # How the client connects WhatsApp. `whatsapp_waba` (default) runs Meta's embedded
43
- # signup to link an official WhatsApp Business Account. `whatsapp_alt` links the
44
- # number by scanning a QR code — available only to teams with the WhatsApp
45
- # Alternative feature enabled.
43
+ # Which Meta channel the client connects, and how.
44
+ #
45
+ # - `whatsapp_waba` (default): Meta's embedded signup links an official WhatsApp
46
+ # Business Account. Accepts `phoneNumberId` and `allowedPhoneCountries`.
47
+ # - `messenger`: the client authorizes with Facebook and picks a Facebook Page
48
+ # they administer. The Page's Messenger inbox — including Marketplace chats — is
49
+ # routed to Zavu. They must be an admin of at least one Page. A Page can only be
50
+ # connected to one Zavu project at a time: if the client picks a Page that
51
+ # another project already connected, the newer connection wins and the older one
52
+ # is disconnected.
53
+ #
54
+ # One invitation connects one channel. To onboard a client on several channels,
55
+ # create one invitation per channel; each completes into its own sender.
46
56
  sig do
47
57
  returns(
48
58
  T.nilable(Zavudev::InvitationCreateParams::ConnectionType::OrSymbol)
@@ -66,7 +76,9 @@ module Zavudev
66
76
  attr_writer :expires_in_days
67
77
 
68
78
  # ID of a Zavu phone number to pre-assign for WhatsApp registration. If provided,
69
- # the client will use this number instead of their own.
79
+ # the client will use this number instead of their own. Only valid when
80
+ # `connectionType` is `whatsapp_waba` — sending it with `messenger` returns 400,
81
+ # since a Facebook Page has no phone number.
70
82
  sig { returns(T.nilable(String)) }
71
83
  attr_reader :phone_number_id
72
84
 
@@ -87,7 +99,8 @@ module Zavudev
87
99
  ).returns(T.attached_class)
88
100
  end
89
101
  def self.new(
90
- # ISO country codes for allowed phone numbers.
102
+ # ISO country codes for allowed phone numbers. Only valid when `connectionType` is
103
+ # `whatsapp_waba` — sending it with `messenger` returns 400.
91
104
  allowed_phone_countries: nil,
92
105
  # Email of the client being invited.
93
106
  client_email: nil,
@@ -95,15 +108,26 @@ module Zavudev
95
108
  client_name: nil,
96
109
  # Phone number of the client in E.164 format.
97
110
  client_phone: nil,
98
- # How the client connects WhatsApp. `whatsapp_waba` (default) runs Meta's embedded
99
- # signup to link an official WhatsApp Business Account. `whatsapp_alt` links the
100
- # number by scanning a QR code — available only to teams with the WhatsApp
101
- # Alternative feature enabled.
111
+ # Which Meta channel the client connects, and how.
112
+ #
113
+ # - `whatsapp_waba` (default): Meta's embedded signup links an official WhatsApp
114
+ # Business Account. Accepts `phoneNumberId` and `allowedPhoneCountries`.
115
+ # - `messenger`: the client authorizes with Facebook and picks a Facebook Page
116
+ # they administer. The Page's Messenger inbox — including Marketplace chats — is
117
+ # routed to Zavu. They must be an admin of at least one Page. A Page can only be
118
+ # connected to one Zavu project at a time: if the client picks a Page that
119
+ # another project already connected, the newer connection wins and the older one
120
+ # is disconnected.
121
+ #
122
+ # One invitation connects one channel. To onboard a client on several channels,
123
+ # create one invitation per channel; each completes into its own sender.
102
124
  connection_type: nil,
103
125
  # Number of days until the invitation expires.
104
126
  expires_in_days: nil,
105
127
  # ID of a Zavu phone number to pre-assign for WhatsApp registration. If provided,
106
- # the client will use this number instead of their own.
128
+ # the client will use this number instead of their own. Only valid when
129
+ # `connectionType` is `whatsapp_waba` — sending it with `messenger` returns 400,
130
+ # since a Facebook Page has no phone number.
107
131
  phone_number_id: nil,
108
132
  request_options: {}
109
133
  )
@@ -127,10 +151,19 @@ module Zavudev
127
151
  def to_hash
128
152
  end
129
153
 
130
- # How the client connects WhatsApp. `whatsapp_waba` (default) runs Meta's embedded
131
- # signup to link an official WhatsApp Business Account. `whatsapp_alt` links the
132
- # number by scanning a QR code — available only to teams with the WhatsApp
133
- # Alternative feature enabled.
154
+ # Which Meta channel the client connects, and how.
155
+ #
156
+ # - `whatsapp_waba` (default): Meta's embedded signup links an official WhatsApp
157
+ # Business Account. Accepts `phoneNumberId` and `allowedPhoneCountries`.
158
+ # - `messenger`: the client authorizes with Facebook and picks a Facebook Page
159
+ # they administer. The Page's Messenger inbox — including Marketplace chats — is
160
+ # routed to Zavu. They must be an admin of at least one Page. A Page can only be
161
+ # connected to one Zavu project at a time: if the client picks a Page that
162
+ # another project already connected, the newer connection wins and the older one
163
+ # is disconnected.
164
+ #
165
+ # One invitation connects one channel. To onboard a client on several channels,
166
+ # create one invitation per channel; each completes into its own sender.
134
167
  module ConnectionType
135
168
  extend Zavudev::Internal::Type::Enum
136
169
 
@@ -145,9 +178,9 @@ module Zavudev
145
178
  :whatsapp_waba,
146
179
  Zavudev::InvitationCreateParams::ConnectionType::TaggedSymbol
147
180
  )
148
- WHATSAPP_ALT =
181
+ MESSENGER =
149
182
  T.let(
150
- :whatsapp_alt,
183
+ :messenger,
151
184
  Zavudev::InvitationCreateParams::ConnectionType::TaggedSymbol
152
185
  )
153
186
 
@@ -24,6 +24,11 @@ module Zavudev
24
24
  attr_writer :limit
25
25
 
26
26
  # Current status of the partner invitation.
27
+ #
28
+ # `failed` means the client started the connection and it did not finish (they
29
+ # cancelled Meta's dialog, denied a permission, or abandoned the tab). A failed
30
+ # invitation is still usable: the same link can be retried, and it moves back to
31
+ # `in_progress` when the client tries again.
27
32
  sig do
28
33
  returns(T.nilable(Zavudev::InvitationListParams::Status::OrSymbol))
29
34
  end
@@ -46,6 +51,11 @@ module Zavudev
46
51
  cursor: nil,
47
52
  limit: nil,
48
53
  # Current status of the partner invitation.
54
+ #
55
+ # `failed` means the client started the connection and it did not finish (they
56
+ # cancelled Meta's dialog, denied a permission, or abandoned the tab). A failed
57
+ # invitation is still usable: the same link can be retried, and it moves back to
58
+ # `in_progress` when the client tries again.
49
59
  status: nil,
50
60
  request_options: {}
51
61
  )
@@ -65,6 +75,11 @@ module Zavudev
65
75
  end
66
76
 
67
77
  # Current status of the partner invitation.
78
+ #
79
+ # `failed` means the client started the connection and it did not finish (they
80
+ # cancelled Meta's dialog, denied a permission, or abandoned the tab). A failed
81
+ # invitation is still usable: the same link can be retried, and it moves back to
82
+ # `in_progress` when the client tries again.
68
83
  module Status
69
84
  extend Zavudev::Internal::Type::Enum
70
85
 
@@ -85,6 +100,8 @@ module Zavudev
85
100
  T.let(:expired, Zavudev::InvitationListParams::Status::TaggedSymbol)
86
101
  CANCELLED =
87
102
  T.let(:cancelled, Zavudev::InvitationListParams::Status::TaggedSymbol)
103
+ FAILED =
104
+ T.let(:failed, Zavudev::InvitationListParams::Status::TaggedSymbol)
88
105
 
89
106
  sig do
90
107
  override.returns(
@@ -9,10 +9,7 @@ module Zavudev
9
9
  sig { returns(String) }
10
10
  attr_accessor :id
11
11
 
12
- # Delivery channel. Use 'auto' for intelligent routing. `whatsapp_alt` is the
13
- # QR-linked WhatsApp channel and is only accepted for teams with the WhatsApp
14
- # Alternative feature enabled; the sender must have a connected whatsapp_alt
15
- # session.
12
+ # Delivery channel. Use 'auto' for intelligent routing.
16
13
  sig { returns(Zavudev::Channel::TaggedSymbol) }
17
14
  attr_accessor :channel
18
15
 
@@ -21,6 +18,20 @@ module Zavudev
21
18
 
22
19
  # Type of message. Non-text types are supported by WhatsApp and Telegram (varies
23
20
  # by type).
21
+ #
22
+ # `location_request` asks the recipient to share their location and is
23
+ # WhatsApp-only. It takes no `content` object — the prompt goes in `text` (max
24
+ # 1024 characters) and the button label is fixed by WhatsApp. The recipient's
25
+ # answer arrives as an inbound `location` message whose `content.replyToMessageId`
26
+ # is the ID of the request.
27
+ #
28
+ # `request_contact_info` asks the recipient to share their phone number and is
29
+ # WhatsApp-only. Like `location_request` it takes no `content` object — the prompt
30
+ # goes in `text` (max 1024 characters) and WhatsApp renders a fixed **Share
31
+ # Contact Info** button. The answer arrives as an inbound `contact` message. Use
32
+ # it to recover the phone number of a contact who adopted a WhatsApp username and
33
+ # is only known by their business-scoped user ID (BSUID); when they share it, Zavu
34
+ # automatically links the phone number to that contact.
24
35
  sig { returns(Zavudev::MessageType::TaggedSymbol) }
25
36
  attr_accessor :message_type
26
37
 
@@ -37,6 +48,16 @@ module Zavudev
37
48
  sig { params(content: Zavudev::MessageContent::OrHash).void }
38
49
  attr_writer :content
39
50
 
51
+ # ID of the conversation (inbox thread) this message belongs to. Use it to build a
52
+ # direct dashboard link:
53
+ # `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`. Omitted only
54
+ # on legacy messages created before conversation threading.
55
+ sig { returns(T.nilable(String)) }
56
+ attr_reader :conversation_id
57
+
58
+ sig { params(conversation_id: String).void }
59
+ attr_writer :conversation_id
60
+
40
61
  # Zavu platform charge in USD for this message. Messaging is billed against your
41
62
  # plan's monthly limits plus usage-based overage.
42
63
  sig { returns(T.nilable(Float)) }
@@ -103,6 +124,7 @@ module Zavudev
103
124
  status: Zavudev::MessageStatus::OrSymbol,
104
125
  to: String,
105
126
  content: Zavudev::MessageContent::OrHash,
127
+ conversation_id: String,
106
128
  cost: T.nilable(Float),
107
129
  cost_provider: T.nilable(Float),
108
130
  cost_total: T.nilable(Float),
@@ -118,19 +140,35 @@ module Zavudev
118
140
  end
119
141
  def self.new(
120
142
  id:,
121
- # Delivery channel. Use 'auto' for intelligent routing. `whatsapp_alt` is the
122
- # QR-linked WhatsApp channel and is only accepted for teams with the WhatsApp
123
- # Alternative feature enabled; the sender must have a connected whatsapp_alt
124
- # session.
143
+ # Delivery channel. Use 'auto' for intelligent routing.
125
144
  channel:,
126
145
  created_at:,
127
146
  # Type of message. Non-text types are supported by WhatsApp and Telegram (varies
128
147
  # by type).
148
+ #
149
+ # `location_request` asks the recipient to share their location and is
150
+ # WhatsApp-only. It takes no `content` object — the prompt goes in `text` (max
151
+ # 1024 characters) and the button label is fixed by WhatsApp. The recipient's
152
+ # answer arrives as an inbound `location` message whose `content.replyToMessageId`
153
+ # is the ID of the request.
154
+ #
155
+ # `request_contact_info` asks the recipient to share their phone number and is
156
+ # WhatsApp-only. Like `location_request` it takes no `content` object — the prompt
157
+ # goes in `text` (max 1024 characters) and WhatsApp renders a fixed **Share
158
+ # Contact Info** button. The answer arrives as an inbound `contact` message. Use
159
+ # it to recover the phone number of a contact who adopted a WhatsApp username and
160
+ # is only known by their business-scoped user ID (BSUID); when they share it, Zavu
161
+ # automatically links the phone number to that contact.
129
162
  message_type:,
130
163
  status:,
131
164
  to:,
132
165
  # Content for non-text message types (WhatsApp and Telegram).
133
166
  content: nil,
167
+ # ID of the conversation (inbox thread) this message belongs to. Use it to build a
168
+ # direct dashboard link:
169
+ # `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`. Omitted only
170
+ # on legacy messages created before conversation threading.
171
+ conversation_id: nil,
134
172
  # Zavu platform charge in USD for this message. Messaging is billed against your
135
173
  # plan's monthly limits plus usage-based overage.
136
174
  cost: nil,
@@ -161,6 +199,7 @@ module Zavudev
161
199
  status: Zavudev::MessageStatus::TaggedSymbol,
162
200
  to: String,
163
201
  content: Zavudev::MessageContent,
202
+ conversation_id: String,
164
203
  cost: T.nilable(Float),
165
204
  cost_provider: T.nilable(Float),
166
205
  cost_total: T.nilable(Float),
@@ -12,13 +12,10 @@ module Zavudev
12
12
  end
13
13
 
14
14
  # Recipient phone number in E.164 format, email address, WhatsApp business-scoped
15
- # user ID (BSUID, e.g. `US.13491208655302741918`), WhatsApp group JID
16
- # (`<id>@g.us`, e.g. `120363000000000000@g.us`), or numeric chat ID (for
15
+ # user ID (BSUID, e.g. `US.13491208655302741918`), or numeric chat ID (for
17
16
  # Telegram/Instagram/Messenger). A BSUID is routed to WhatsApp and sent via the
18
17
  # `recipient` field; use it to message a contact who adopted a username and whose
19
- # phone number is hidden. A group JID is only valid on the `whatsapp_alt` channel
20
- # and supports text and media (image, video, audio, document, sticker, location,
21
- # contact).
18
+ # phone number is hidden.
22
19
  sig { returns(String) }
23
20
  attr_accessor :to
24
21
 
@@ -145,13 +142,10 @@ module Zavudev
145
142
  end
146
143
  def self.new(
147
144
  # Recipient phone number in E.164 format, email address, WhatsApp business-scoped
148
- # user ID (BSUID, e.g. `US.13491208655302741918`), WhatsApp group JID
149
- # (`<id>@g.us`, e.g. `120363000000000000@g.us`), or numeric chat ID (for
145
+ # user ID (BSUID, e.g. `US.13491208655302741918`), or numeric chat ID (for
150
146
  # Telegram/Instagram/Messenger). A BSUID is routed to WhatsApp and sent via the
151
147
  # `recipient` field; use it to message a contact who adopted a username and whose
152
- # phone number is hidden. A group JID is only valid on the `whatsapp_alt` channel
153
- # and supports text and media (image, video, audio, document, sticker, location,
154
- # contact).
148
+ # phone number is hidden.
155
149
  to:,
156
150
  # Email attachments. Only supported when channel is 'email'. Maximum 40MB total
157
151
  # size.
@@ -4,6 +4,20 @@ module Zavudev
4
4
  module Models
5
5
  # Type of message. Non-text types are supported by WhatsApp and Telegram (varies
6
6
  # by type).
7
+ #
8
+ # `location_request` asks the recipient to share their location and is
9
+ # WhatsApp-only. It takes no `content` object — the prompt goes in `text` (max
10
+ # 1024 characters) and the button label is fixed by WhatsApp. The recipient's
11
+ # answer arrives as an inbound `location` message whose `content.replyToMessageId`
12
+ # is the ID of the request.
13
+ #
14
+ # `request_contact_info` asks the recipient to share their phone number and is
15
+ # WhatsApp-only. Like `location_request` it takes no `content` object — the prompt
16
+ # goes in `text` (max 1024 characters) and WhatsApp renders a fixed **Share
17
+ # Contact Info** button. The answer arrives as an inbound `contact` message. Use
18
+ # it to recover the phone number of a contact who adopted a WhatsApp username and
19
+ # is only known by their business-scoped user ID (BSUID); when they share it, Zavu
20
+ # automatically links the phone number to that contact.
7
21
  module MessageType
8
22
  extend Zavudev::Internal::Type::Enum
9
23
 
@@ -21,6 +35,10 @@ module Zavudev
21
35
  BUTTONS = T.let(:buttons, Zavudev::MessageType::TaggedSymbol)
22
36
  LIST = T.let(:list, Zavudev::MessageType::TaggedSymbol)
23
37
  CTA_URL = T.let(:cta_url, Zavudev::MessageType::TaggedSymbol)
38
+ REQUEST_CONTACT_INFO =
39
+ T.let(:request_contact_info, Zavudev::MessageType::TaggedSymbol)
40
+ LOCATION_REQUEST =
41
+ T.let(:location_request, Zavudev::MessageType::TaggedSymbol)
24
42
  REACTION = T.let(:reaction, Zavudev::MessageType::TaggedSymbol)
25
43
  TEMPLATE = T.let(:template, Zavudev::MessageType::TaggedSymbol)
26
44
 
@@ -8,7 +8,9 @@ module Zavudev
8
8
  T.any(Zavudev::PhoneNumberPricing, Zavudev::Internal::AnyHash)
9
9
  end
10
10
 
11
- # Whether this number qualifies for the free first US number offer.
11
+ # Whether this number qualifies as the plan-included US number on paid plans. The
12
+ # benefit is one per account: it is never offered again once claimed, not even
13
+ # after the number is released.
12
14
  sig { returns(T.nilable(T::Boolean)) }
13
15
  attr_reader :is_free_eligible
14
16
 
@@ -37,7 +39,9 @@ module Zavudev
37
39
  ).returns(T.attached_class)
38
40
  end
39
41
  def self.new(
40
- # Whether this number qualifies for the free first US number offer.
42
+ # Whether this number qualifies as the plan-included US number on paid plans. The
43
+ # benefit is one per account: it is never offered again once claimed, not even
44
+ # after the number is released.
41
45
  is_free_eligible: nil,
42
46
  # Monthly price in USD.
43
47
  monthly_price: nil,
@@ -18,6 +18,14 @@ module Zavudev
18
18
  sig { returns(String) }
19
19
  attr_accessor :country_code
20
20
 
21
+ # Comma-separated capabilities the number must have: `sms`, `voice`, `mms`.
22
+ # Numbers missing any of them are dropped.
23
+ sig { returns(T.nilable(String)) }
24
+ attr_reader :capabilities
25
+
26
+ sig { params(capabilities: String).void }
27
+ attr_writer :capabilities
28
+
21
29
  # Search for numbers containing this string.
22
30
  sig { returns(T.nilable(String)) }
23
31
  attr_reader :contains
@@ -42,6 +50,7 @@ module Zavudev
42
50
  sig do
43
51
  params(
44
52
  country_code: String,
53
+ capabilities: String,
45
54
  contains: String,
46
55
  limit: Integer,
47
56
  type: Zavudev::PhoneNumberType::OrSymbol,
@@ -51,6 +60,9 @@ module Zavudev
51
60
  def self.new(
52
61
  # Two-letter ISO country code.
53
62
  country_code:,
63
+ # Comma-separated capabilities the number must have: `sms`, `voice`, `mms`.
64
+ # Numbers missing any of them are dropped.
65
+ capabilities: nil,
54
66
  # Search for numbers containing this string.
55
67
  contains: nil,
56
68
  # Maximum number of results to return.
@@ -65,6 +77,7 @@ module Zavudev
65
77
  override.returns(
66
78
  {
67
79
  country_code: String,
80
+ capabilities: String,
68
81
  contains: String,
69
82
  limit: Integer,
70
83
  type: Zavudev::PhoneNumberType::OrSymbol,