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
@@ -78,7 +78,18 @@ module Zavudev
78
78
  Zavudev::Internal::Type::ArrayOf[String],
79
79
  api_name: :triggerOnMessageTypes
80
80
 
81
- # @!method initialize(sender_id:, api_key: nil, context_window_messages: nil, enabled: nil, include_contact_metadata: nil, max_tokens: nil, model: nil, name: nil, provider: nil, system_prompt: nil, temperature: nil, trigger_on_channels: nil, trigger_on_message_types: nil, request_options: {})
81
+ # @!attribute voice
82
+ # Voice Agent configuration. Patch this object to enable voice, change the
83
+ # greeting, or adjust call limits. Requires the Voice Agents feature to be enabled
84
+ # for your team.
85
+ #
86
+ # @return [Zavudev::Models::Senders::AgentUpdateParams::Voice, nil]
87
+ optional :voice, -> { Zavudev::Senders::AgentUpdateParams::Voice }
88
+
89
+ # @!method initialize(sender_id:, api_key: nil, context_window_messages: nil, enabled: nil, include_contact_metadata: nil, max_tokens: nil, model: nil, name: nil, provider: nil, system_prompt: nil, temperature: nil, trigger_on_channels: nil, trigger_on_message_types: nil, voice: nil, request_options: {})
90
+ # Some parameter documentations has been truncated, see
91
+ # {Zavudev::Models::Senders::AgentUpdateParams} for more details.
92
+ #
82
93
  # @param sender_id [String]
83
94
  #
84
95
  # @param api_key [String]
@@ -105,7 +116,183 @@ module Zavudev
105
116
  #
106
117
  # @param trigger_on_message_types [Array<String>]
107
118
  #
119
+ # @param voice [Zavudev::Models::Senders::AgentUpdateParams::Voice] Voice Agent configuration. Patch this object to enable voice, change the greetin
120
+ #
108
121
  # @param request_options [Zavudev::RequestOptions, Hash{Symbol=>Object}]
122
+
123
+ class Voice < Zavudev::Internal::Type::BaseModel
124
+ # @!attribute enabled
125
+ # Whether the agent handles voice calls. When false, the sender's number is not
126
+ # answered by the voice agent and outbound calls are rejected.
127
+ #
128
+ # @return [Boolean]
129
+ required :enabled, Zavudev::Internal::Type::Boolean
130
+
131
+ # @!attribute greeting
132
+ # Opening line the agent speaks when the call connects. If omitted, the agent
133
+ # waits for the caller to speak first.
134
+ #
135
+ # @return [String, nil]
136
+ optional :greeting, String
137
+
138
+ # @!attribute greetings
139
+ # Greeting per language, keyed by language code. Used when the caller's language
140
+ # differs from the one `greeting` is written in.
141
+ #
142
+ # @return [Hash{Symbol=>String}, nil]
143
+ optional :greetings, Zavudev::Internal::Type::HashOf[String]
144
+
145
+ # @!attribute interruptible
146
+ # Whether the caller can interrupt the agent while it is speaking (barge-in). When
147
+ # true, the agent stops talking as soon as the caller starts.
148
+ #
149
+ # @return [Boolean, nil]
150
+ optional :interruptible, Zavudev::Internal::Type::Boolean
151
+
152
+ # @!attribute language
153
+ # BCP-47 language code used for both speech recognition and speech synthesis (e.g.
154
+ # `en`, `es`, `pt-BR`). Auto-detected from the recipient when omitted.
155
+ #
156
+ # @return [String, nil]
157
+ optional :language, String
158
+
159
+ # @!attribute max_call_duration_minutes
160
+ # Hard limit on call length in minutes. The call ends automatically when reached.
161
+ #
162
+ # @return [Integer, nil]
163
+ optional :max_call_duration_minutes, Integer, api_name: :maxCallDurationMinutes
164
+
165
+ # @!attribute max_idle_seconds
166
+ # How long the agent waits during silence before ending the call.
167
+ #
168
+ # @return [Integer, nil]
169
+ optional :max_idle_seconds, Integer, api_name: :maxIdleSeconds
170
+
171
+ # @!attribute model
172
+ # Model that runs the conversation, co-located in the voice network for lowest
173
+ # latency. Independent of the model used for text messaging. Derived from the
174
+ # agent's text model when omitted.
175
+ #
176
+ # @return [String, nil]
177
+ optional :model, String
178
+
179
+ # @!attribute record_calls
180
+ # Whether the call audio is recorded.
181
+ #
182
+ # @return [Boolean, nil]
183
+ optional :record_calls, Zavudev::Internal::Type::Boolean, api_name: :recordCalls
184
+
185
+ # @!attribute stt_model
186
+ # Speech-recognition model. Uses the default when omitted.
187
+ #
188
+ # @return [String, nil]
189
+ optional :stt_model, String, api_name: :sttModel
190
+
191
+ # @!attribute stt_provider
192
+ # Speech-recognition provider. Uses the default when omitted.
193
+ #
194
+ # @return [String, nil]
195
+ optional :stt_provider, String, api_name: :sttProvider
196
+
197
+ # @!attribute transfer_phone_number
198
+ # E.164 phone number the agent can transfer the call to. When set, the agent is
199
+ # given a transfer tool it can use to hand the call to a human.
200
+ #
201
+ # @return [String, nil]
202
+ optional :transfer_phone_number, String, api_name: :transferPhoneNumber
203
+
204
+ # @!attribute tts_provider
205
+ # Speech-synthesis provider. Uses the default when omitted.
206
+ #
207
+ # @return [String, nil]
208
+ optional :tts_provider, String, api_name: :ttsProvider
209
+
210
+ # @!attribute tts_voice_id
211
+ # Identifier of the synthesized voice that speaks. Choose from the voices
212
+ # available in the dashboard. Uses a neutral default when omitted.
213
+ #
214
+ # @return [String, nil]
215
+ optional :tts_voice_id, String, api_name: :ttsVoiceId
216
+
217
+ # @!attribute voicemail_action
218
+ # What the agent does when an answering machine or voicemail is detected on an
219
+ # outbound call.
220
+ #
221
+ # @return [Symbol, Zavudev::Models::Senders::AgentUpdateParams::Voice::VoicemailAction, nil]
222
+ optional :voicemail_action,
223
+ enum: -> { Zavudev::Senders::AgentUpdateParams::Voice::VoicemailAction },
224
+ api_name: :voicemailAction
225
+
226
+ # @!attribute voicemail_message
227
+ # Message spoken when `voicemailAction` is `leave_message`. Falls back to
228
+ # `greeting` when omitted.
229
+ #
230
+ # @return [String, nil]
231
+ optional :voicemail_message, String, api_name: :voicemailMessage
232
+
233
+ # @!attribute voice_speed
234
+ # Speech rate. 1.0 is natural. Only honoured by voices that support rate control;
235
+ # ignored by the others.
236
+ #
237
+ # @return [Float, nil]
238
+ optional :voice_speed, Float, api_name: :voiceSpeed
239
+
240
+ # @!method initialize(enabled:, greeting: nil, greetings: nil, interruptible: nil, language: nil, max_call_duration_minutes: nil, max_idle_seconds: nil, model: nil, record_calls: nil, stt_model: nil, stt_provider: nil, transfer_phone_number: nil, tts_provider: nil, tts_voice_id: nil, voicemail_action: nil, voicemail_message: nil, voice_speed: nil)
241
+ # Some parameter documentations has been truncated, see
242
+ # {Zavudev::Models::Senders::AgentUpdateParams::Voice} for more details.
243
+ #
244
+ # Voice Agent configuration. Patch this object to enable voice, change the
245
+ # greeting, or adjust call limits. Requires the Voice Agents feature to be enabled
246
+ # for your team.
247
+ #
248
+ # @param enabled [Boolean] Whether the agent handles voice calls. When false, the sender's number is not an
249
+ #
250
+ # @param greeting [String] Opening line the agent speaks when the call connects. If omitted, the agent wait
251
+ #
252
+ # @param greetings [Hash{Symbol=>String}] Greeting per language, keyed by language code. Used when the caller's language d
253
+ #
254
+ # @param interruptible [Boolean] Whether the caller can interrupt the agent while it is speaking (barge-in). When
255
+ #
256
+ # @param language [String] BCP-47 language code used for both speech recognition and speech synthesis (e.g.
257
+ #
258
+ # @param max_call_duration_minutes [Integer] Hard limit on call length in minutes. The call ends automatically when reached.
259
+ #
260
+ # @param max_idle_seconds [Integer] How long the agent waits during silence before ending the call.
261
+ #
262
+ # @param model [String] Model that runs the conversation, co-located in the voice network for lowest lat
263
+ #
264
+ # @param record_calls [Boolean] Whether the call audio is recorded.
265
+ #
266
+ # @param stt_model [String] Speech-recognition model. Uses the default when omitted.
267
+ #
268
+ # @param stt_provider [String] Speech-recognition provider. Uses the default when omitted.
269
+ #
270
+ # @param transfer_phone_number [String] E.164 phone number the agent can transfer the call to. When set, the agent is gi
271
+ #
272
+ # @param tts_provider [String] Speech-synthesis provider. Uses the default when omitted.
273
+ #
274
+ # @param tts_voice_id [String] Identifier of the synthesized voice that speaks. Choose from the voices availabl
275
+ #
276
+ # @param voicemail_action [Symbol, Zavudev::Models::Senders::AgentUpdateParams::Voice::VoicemailAction] What the agent does when an answering machine or voicemail is detected on an out
277
+ #
278
+ # @param voicemail_message [String] Message spoken when `voicemailAction` is `leave_message`. Falls back to `greetin
279
+ #
280
+ # @param voice_speed [Float] Speech rate. 1.0 is natural. Only honoured by voices that support rate control;
281
+
282
+ # What the agent does when an answering machine or voicemail is detected on an
283
+ # outbound call.
284
+ #
285
+ # @see Zavudev::Models::Senders::AgentUpdateParams::Voice#voicemail_action
286
+ module VoicemailAction
287
+ extend Zavudev::Internal::Type::Enum
288
+
289
+ HANGUP = :hangup
290
+ LEAVE_MESSAGE = :leave_message
291
+
292
+ # @!method self.values
293
+ # @return [Array<Symbol>]
294
+ end
295
+ end
109
296
  end
110
297
  end
111
298
  end
@@ -249,6 +249,7 @@ module Zavudev
249
249
  URL = :url
250
250
  PHONE = :phone
251
251
  OTP = :otp
252
+ REQUEST_CONTACT_INFO = :request_contact_info
252
253
 
253
254
  # @!method self.values
254
255
  # @return [Array<Symbol>]
@@ -122,12 +122,10 @@ module Zavudev
122
122
  # @param request_options [Zavudev::RequestOptions, Hash{Symbol=>Object}]
123
123
 
124
124
  class Button < Zavudev::Internal::Type::BaseModel
125
- # @!attribute text
126
- #
127
- # @return [String]
128
- required :text, String
129
-
130
125
  # @!attribute type
126
+ # `request_contact_info` renders a fixed **Share Contact Info** button that asks
127
+ # the recipient to share their phone number — useful when a contact adopted a
128
+ # WhatsApp username and you only know their BSUID. It takes no other fields.
131
129
  #
132
130
  # @return [Symbol, Zavudev::Models::TemplateCreateParams::Button::Type]
133
131
  required :type, enum: -> { Zavudev::TemplateCreateParams::Button::Type }
@@ -164,6 +162,13 @@ module Zavudev
164
162
  # @return [String, nil]
165
163
  optional :signature_hash, String, api_name: :signatureHash
166
164
 
165
+ # @!attribute text
166
+ # Button label. Required for every type except `request_contact_info`, whose label
167
+ # is fixed by WhatsApp.
168
+ #
169
+ # @return [String, nil]
170
+ optional :text, String
171
+
167
172
  # @!attribute url
168
173
  # Button destination. Use `{{1}}` exactly once for a dynamic URL (e.g.
169
174
  # `https://example.com/orders/{{1}}`); WhatsApp only accepts the strict `{{1}}`
@@ -172,13 +177,11 @@ module Zavudev
172
177
  # @return [String, nil]
173
178
  optional :url, String
174
179
 
175
- # @!method initialize(text:, type:, example: nil, otp_type: nil, package_name: nil, phone_number: nil, signature_hash: nil, url: nil)
180
+ # @!method initialize(type:, example: nil, otp_type: nil, package_name: nil, phone_number: nil, signature_hash: nil, text: nil, url: nil)
176
181
  # Some parameter documentations has been truncated, see
177
182
  # {Zavudev::Models::TemplateCreateParams::Button} for more details.
178
183
  #
179
- # @param text [String]
180
- #
181
- # @param type [Symbol, Zavudev::Models::TemplateCreateParams::Button::Type]
184
+ # @param type [Symbol, Zavudev::Models::TemplateCreateParams::Button::Type] `request_contact_info` renders a fixed **Share Contact Info** button that asks t
182
185
  #
183
186
  # @param example [String] Sample value Meta uses to review templates with a dynamic URL button. Substitute
184
187
  #
@@ -190,8 +193,14 @@ module Zavudev
190
193
  #
191
194
  # @param signature_hash [String] Android app signature hash. Required for ONE_TAP buttons.
192
195
  #
196
+ # @param text [String] Button label. Required for every type except `request_contact_info`, whose label
197
+ #
193
198
  # @param url [String] Button destination. Use `{{1}}` exactly once for a dynamic URL (e.g. `https://ex
194
199
 
200
+ # `request_contact_info` renders a fixed **Share Contact Info** button that asks
201
+ # the recipient to share their phone number — useful when a contact adopted a
202
+ # WhatsApp username and you only know their BSUID. It takes no other fields.
203
+ #
195
204
  # @see Zavudev::Models::TemplateCreateParams::Button#type
196
205
  module Type
197
206
  extend Zavudev::Internal::Type::Enum
@@ -200,6 +209,7 @@ module Zavudev
200
209
  URL = :url
201
210
  PHONE = :phone
202
211
  OTP = :otp
212
+ REQUEST_CONTACT_INFO = :request_contact_info
203
213
 
204
214
  # @!method self.values
205
215
  # @return [Array<Symbol>]
@@ -17,22 +17,21 @@ module Zavudev
17
17
  #
18
18
  # **Inbound events:**
19
19
  #
20
- # - `message.inbound`: New message received from a contact. Reactions are
21
- # delivered as `message.inbound` with `messageType='reaction'`. When the contact
22
- # replied to (quoted) an earlier message, `data.content` carries the reply
23
- # context: `replyToMessageId`, `replyToProviderMessageId`, `replyToFrom`,
24
- # `replyToText`, and `replyToMessageType`. `data.providerTimestamp` is the
25
- # provider's original receive time in Unix milliseconds (the moment the channel
26
- # received the message from the contact — WhatsApp, Telegram, Instagram,
27
- # Messenger; `null` for SMS and email). Compare it against the top-level
28
- # `timestamp` (when Zavu dispatched the webhook) to detect and ignore delayed
29
- # deliveries.
30
- # - `message.status`: A contact posted a WhatsApp status/story (currently WhatsApp
31
- # Alternative only). It is NOT a conversation message and never enters the inbox
32
- # — it is delivered only if you subscribe to `message.status`. `data` carries
33
- # `from` (the author in E.164), `messageType` (`text`, `image`, `video`,
34
- # `audio`), `text` (caption/text when present), `mimetype` (for media stories),
35
- # and `providerTimestamp`. Media bytes are not included.
20
+ # - `message.inbound`: New message received from a contact. `data.conversationId`
21
+ # is the inbox thread id (deep-link with
22
+ # `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`); it is
23
+ # `null` while the conversation row is still being created (the first message of
24
+ # a brand-new thread, or several near-simultaneous first messages), where
25
+ # `conversation.new` carries the id instead — `GET /v1/messages/{messageId}`
26
+ # always has it. Reactions are delivered as `message.inbound` with
27
+ # `messageType='reaction'`. When the contact replied to (quoted) an earlier
28
+ # message, `data.content` carries the reply context: `replyToMessageId`,
29
+ # `replyToProviderMessageId`, `replyToFrom`, `replyToText`, and
30
+ # `replyToMessageType`. `data.providerTimestamp` is the provider's original
31
+ # receive time in Unix milliseconds (the moment the channel received the message
32
+ # from the contact — WhatsApp, Telegram, Instagram, Messenger; `null` for SMS
33
+ # and email). Compare it against the top-level `timestamp` (when Zavu dispatched
34
+ # the webhook) to detect and ignore delayed deliveries.
36
35
  # - `message.unsupported`: Received a message type that is not supported
37
36
  #
38
37
  # **Broadcast events:**
@@ -42,13 +41,42 @@ module Zavudev
42
41
  #
43
42
  # **Other events:**
44
43
  #
45
- # - `conversation.new`: New conversation started with a contact
44
+ # - `conversation.new`: New conversation started with a contact. `data` carries
45
+ # `conversationId` (the inbox thread id — deep-link with
46
+ # `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`), the
47
+ # `phoneNumber` or `email` key, `channel`, `firstMessageId`, `firstMessageText`,
48
+ # and `profileName`.
46
49
  # - `template.status_changed`: WhatsApp template approval status changed
47
50
  #
48
51
  # **Partner events:**
49
52
  #
50
53
  # - `invitation.status_changed`: A partner invitation status changed (pending,
51
- # in_progress, completed, cancelled)
54
+ # in_progress, completed, cancelled, failed). `data` carries `invitationId`,
55
+ # `clientName`, `clientEmail`, `connectionType` (`whatsapp_waba` or
56
+ # `messenger`), `previousStatus`, and `currentStatus`. On `completed` it also
57
+ # carries `senderId` and `connectedAccount` (`channel`, `id`, `name`) — the
58
+ # WhatsApp number or Facebook Page that was linked. On `failed` it carries
59
+ # `failureReason`; the invitation link stays usable, so a client can retry it.
60
+ #
61
+ # **Voice Agent events:** For every voice event, `data` carries `callId`,
62
+ # `direction`, `from`, `to`, `status`, `durationSeconds`, `endReason`, and
63
+ # `transcriptAvailable`. The terminal events (`call.completed`, `call.failed`)
64
+ # additionally carry `cost` — what the call was billed, in USD, combining
65
+ # telephony and the managed voice pipeline — and `currency`. They are dispatched
66
+ # after the call is charged, so `cost` is populated rather than zero; telephony
67
+ # can still be settling on an outbound call, in which case
68
+ # `GET /v1/calls/{callId}` holds the reconciled figure.
69
+ #
70
+ # - `call.initiated`: An outbound call was created and is dialing, or an inbound
71
+ # call was received. `data.status` = `ringing`
72
+ # - `call.answered`: The call was answered and the voice agent is connected.
73
+ # `data.status` = `in_progress`
74
+ # - `call.completed`: The call ended after a conversation. `data.status` =
75
+ # `completed`; `durationSeconds` and `endReason` describe how it ended, and
76
+ # `transcriptAvailable` indicates whether a transcript can be fetched.
77
+ # - `call.failed`: The call could not be completed (busy, no answer, canceled, or
78
+ # an error). `data.status` is the terminal status and `endReason` explains the
79
+ # cause.
52
80
  #
53
81
  # **Custom domain events:**
54
82
  #
@@ -63,14 +91,18 @@ module Zavudev
63
91
  MESSAGE_SENT = :"message.sent"
64
92
  MESSAGE_DELIVERED = :"message.delivered"
65
93
  MESSAGE_READ = :"message.read"
94
+ MESSAGE_STATUS = :"message.status"
66
95
  MESSAGE_FAILED = :"message.failed"
67
96
  MESSAGE_INBOUND = :"message.inbound"
68
- MESSAGE_STATUS = :"message.status"
69
97
  MESSAGE_UNSUPPORTED = :"message.unsupported"
70
98
  BROADCAST_STATUS_CHANGED = :"broadcast.status_changed"
71
99
  CONVERSATION_NEW = :"conversation.new"
72
100
  TEMPLATE_STATUS_CHANGED = :"template.status_changed"
73
101
  INVITATION_STATUS_CHANGED = :"invitation.status_changed"
102
+ CALL_INITIATED = :"call.initiated"
103
+ CALL_ANSWERED = :"call.answered"
104
+ CALL_COMPLETED = :"call.completed"
105
+ CALL_FAILED = :"call.failed"
74
106
  DOMAIN_VERIFIED = :"domain.verified"
75
107
  DOMAIN_FAILED = :"domain.failed"
76
108
 
@@ -253,10 +253,26 @@ module Zavudev
253
253
  )
254
254
  end
255
255
 
256
- # Start sending the broadcast immediately or schedule for later. Broadcasts go
257
- # through automated AI content review before sending. If the review passes, the
258
- # broadcast proceeds. If rejected, use PATCH to edit content, then call POST
259
- # /retry-review. Reserves the estimated cost from your balance.
256
+ # Start sending the broadcast immediately or schedule for later.
257
+ #
258
+ # **Verification is required to send, and there are two of them.** The team must
259
+ # have completed both identity verification (KYC) and business verification (KYB);
260
+ # passing one is not enough. Drafts can be created, edited and kept without
261
+ # either. Every send path — dashboard, API and CLI alike — enforces both,
262
+ # returning `403` with code `kyc_required` or `kyb_required` for whichever is
263
+ # outstanding.
264
+ #
265
+ # **Review depends on the channel, and cannot be bypassed.** A draft is submitted
266
+ # to automated content review here; it does not go straight out. A WhatsApp
267
+ # broadcast built on a Meta-approved template skips review (Meta already vetted
268
+ # the content) and begins sending. An email broadcast sends as soon as the
269
+ # automated review passes. Every other channel moves to `pending_admin_review` and
270
+ # waits for a person. If the review rejects it, use PATCH to edit the content then
271
+ # call POST /retry-review.
272
+ #
273
+ # Calling this on a broadcast that is already `approved` or `scheduled` sends or
274
+ # reschedules it directly, since it has already been reviewed. Reserves the
275
+ # estimated cost from your balance.
260
276
  #
261
277
  # @overload send_(broadcast_id, scheduled_at: nil, request_options: {})
262
278
  #
@@ -6,6 +6,9 @@ module Zavudev
6
6
  # @return [Zavudev::Resources::Functions::Secrets]
7
7
  attr_reader :secrets
8
8
 
9
+ # Some parameter documentations has been truncated, see
10
+ # {Zavudev::Models::FunctionCreateParams} for more details.
11
+ #
9
12
  # Create a new Zavu Function. The function starts in `draft` status. A dedicated
10
13
  # API key is auto-provisioned and injected as the `ZAVU_API_KEY` secret so the
11
14
  # function can call back into the Zavu API without manual setup.
@@ -13,7 +16,7 @@ module Zavudev
13
16
  # Provide `sourceCode` to seed the draft. Call
14
17
  # `POST /v1/functions/{functionId}/deploy` afterwards to publish.
15
18
  #
16
- # @overload create(name:, slug:, dependencies: nil, description: nil, http_enabled: nil, memory_mb: nil, runtime: nil, source_code: nil, timeout_sec: nil, request_options: {})
19
+ # @overload create(name:, slug:, dependencies: nil, description: nil, entrypoint: nil, files: nil, http_enabled: nil, memory_mb: nil, runtime: nil, source_code: nil, timeout_sec: nil, request_options: {})
17
20
  #
18
21
  # @param name [String]
19
22
  #
@@ -23,15 +26,19 @@ module Zavudev
23
26
  #
24
27
  # @param description [String]
25
28
  #
29
+ # @param entrypoint [String] Which file in `files` is the entry point. Defaults to `index.ts`.
30
+ #
31
+ # @param files [Hash{Symbol=>String}] The project's source files, keyed by path relative to the project root (e.g. `in
32
+ #
26
33
  # @param http_enabled [Boolean] Whether to expose a public HTTPS URL for this function.
27
34
  #
28
35
  # @param memory_mb [Integer, Zavudev::Models::FunctionCreateParams::MemoryMB]
29
36
  #
30
37
  # @param runtime [Symbol, Zavudev::Models::FunctionCreateParams::Runtime] Runtime the function is deployed on.
31
38
  #
32
- # @param source_code [String] TypeScript source code for the function entry point (max ~900KB).
39
+ # @param source_code [String] Shortcut for a single-file function: exactly equivalent to sending `files` with
33
40
  #
34
- # @param timeout_sec [Integer]
41
+ # @param timeout_sec [Integer] Per-invocation timeout in seconds. Event and cron invocations are asynchronous,
35
42
  #
36
43
  # @param request_options [Zavudev::RequestOptions, Hash{Symbol=>Object}, nil]
37
44
  #
@@ -69,17 +76,28 @@ module Zavudev
69
76
  )
70
77
  end
71
78
 
72
- # Update the draft source code and/or dependency map without triggering a build.
73
- # Visible in the dashboard immediately, but the live (deployed) function does not
74
- # change until `POST /v1/functions/{functionId}/deploy` runs.
79
+ # Some parameter documentations has been truncated, see
80
+ # {Zavudev::Models::FunctionUpdateParams} for more details.
75
81
  #
76
- # @overload update(function_id, dependencies: nil, source_code: nil, request_options: {})
82
+ # Update an existing function. `sourceCode` / `dependencies` edit the draft
83
+ # without triggering a build — they go live on the next
84
+ # `POST /v1/functions/{functionId}/deploy`. `httpEnabled` is applied to the
85
+ # deployed function immediately, so turning the public endpoint on or off does not
86
+ # require a redeploy.
87
+ #
88
+ # @overload update(function_id, dependencies: nil, entrypoint: nil, files: nil, http_enabled: nil, source_code: nil, request_options: {})
77
89
  #
78
90
  # @param function_id [String] Zavu Function ID.
79
91
  #
80
92
  # @param dependencies [Hash{Symbol=>String}] New dependency map (replaces existing dependencies).
81
93
  #
82
- # @param source_code [String] New source code to publish (replaces the draft).
94
+ # @param entrypoint [String] Which file in `files` is the entry point. Defaults to `index.ts`.
95
+ #
96
+ # @param files [Hash{Symbol=>String}] The project's source files, keyed by path relative to the project root (e.g. `in
97
+ #
98
+ # @param http_enabled [Boolean] Expose the function on its public HTTPS URL, or take it down. Applies to the alr
99
+ #
100
+ # @param source_code [String] Shortcut for a single-file function: exactly equivalent to sending `files` with
83
101
  #
84
102
  # @param request_options [Zavudev::RequestOptions, Hash{Symbol=>Object}, nil]
85
103
  #
@@ -119,18 +137,25 @@ module Zavudev
119
137
  )
120
138
  end
121
139
 
140
+ # Some parameter documentations has been truncated, see
141
+ # {Zavudev::Models::FunctionDeployParams} for more details.
142
+ #
122
143
  # Publish the function. If `sourceCode` or `dependencies` are provided in the
123
144
  # body, they replace the current draft before deployment. Returns immediately with
124
145
  # a deployment ID — poll `GET /v1/functions/deployments/{deploymentId}` until
125
146
  # status is `active` or `failed`.
126
147
  #
127
- # @overload deploy(function_id, dependencies: nil, source_code: nil, request_options: {})
148
+ # @overload deploy(function_id, dependencies: nil, entrypoint: nil, files: nil, source_code: nil, request_options: {})
128
149
  #
129
150
  # @param function_id [String] Zavu Function ID.
130
151
  #
131
152
  # @param dependencies [Hash{Symbol=>String}] New dependency map (replaces existing dependencies).
132
153
  #
133
- # @param source_code [String] New source code to publish (replaces the draft).
154
+ # @param entrypoint [String] Which file in `files` is the entry point. Defaults to `index.ts`.
155
+ #
156
+ # @param files [Hash{Symbol=>String}] The project's source files, keyed by path relative to the project root (e.g. `in
157
+ #
158
+ # @param source_code [String] Shortcut for a single-file function: exactly equivalent to sending `files` with
134
159
  #
135
160
  # @param request_options [Zavudev::RequestOptions, Hash{Symbol=>Object}, nil]
136
161
  #
@@ -6,22 +6,25 @@ module Zavudev
6
6
  # Some parameter documentations has been truncated, see
7
7
  # {Zavudev::Models::InvitationCreateParams} for more details.
8
8
  #
9
- # Create a partner invitation link for a client to connect WhatsApp. The client
10
- # opens the returned `url` and connects. Set `connectionType` to choose how they
11
- # connect:
9
+ # Create a partner invitation link for a client to connect a Meta channel. The
10
+ # client opens the returned `url` and authorizes with Meta; the resulting sender
11
+ # is created in your project when they finish, and the invitation transitions to
12
+ # `completed`.
12
13
  #
13
- # - `whatsapp_waba` (default): the client completes Meta's embedded signup,
14
- # linking an official WhatsApp Business Account.
15
- # - `whatsapp_alt`: the client links their number by scanning a QR code. Requires
16
- # the WhatsApp Alternative feature to be enabled for your team (otherwise
17
- # returns 400).
14
+ # `connectionType` picks the channel:
18
15
  #
19
- # Either way, the resulting sender is created in your project when the client
20
- # completes the flow, and the invitation transitions to `completed`.
16
+ # - `whatsapp_waba` (default): Meta's embedded signup links an official WhatsApp
17
+ # Business Account.
18
+ # - `messenger`: the client picks a Facebook Page they administer; its Messenger
19
+ # inbox (including Marketplace chats) is routed to Zavu.
20
+ #
21
+ # One invitation connects one channel — create one per channel to onboard a client
22
+ # on several. `phoneNumberId` and `allowedPhoneCountries` apply to `whatsapp_waba`
23
+ # only.
21
24
  #
22
25
  # @overload create(allowed_phone_countries: nil, client_email: nil, client_name: nil, client_phone: nil, connection_type: nil, expires_in_days: nil, phone_number_id: nil, request_options: {})
23
26
  #
24
- # @param allowed_phone_countries [Array<String>] ISO country codes for allowed phone numbers.
27
+ # @param allowed_phone_countries [Array<String>] ISO country codes for allowed phone numbers. Only valid when `connectionType` is
25
28
  #
26
29
  # @param client_email [String] Email of the client being invited.
27
30
  #
@@ -29,7 +32,7 @@ module Zavudev
29
32
  #
30
33
  # @param client_phone [String] Phone number of the client in E.164 format.
31
34
  #
32
- # @param connection_type [Symbol, Zavudev::Models::InvitationCreateParams::ConnectionType] How the client connects WhatsApp. `whatsapp_waba` (default) runs Meta's embedded
35
+ # @param connection_type [Symbol, Zavudev::Models::InvitationCreateParams::ConnectionType] Which Meta channel the client connects, and how.
33
36
  #
34
37
  # @param expires_in_days [Integer] Number of days until the invitation expires.
35
38
  #
@@ -70,6 +73,9 @@ module Zavudev
70
73
  )
71
74
  end
72
75
 
76
+ # Some parameter documentations has been truncated, see
77
+ # {Zavudev::Models::InvitationListParams} for more details.
78
+ #
73
79
  # List partner invitations for this project.
74
80
  #
75
81
  # @overload list(cursor: nil, limit: nil, status: nil, request_options: {})
@@ -102,10 +102,30 @@ module Zavudev
102
102
  # - Window opens when the user messages you first
103
103
  # - Use template messages to initiate conversations outside the window
104
104
  #
105
- # **Daily limits:**
106
- #
107
- # - Unverified accounts: 200 messages per channel per day
108
- # - Complete KYC verification to increase limits to 10,000/day
105
+ # **Plan allowances and email billing:**
106
+ #
107
+ # - WhatsApp, Telegram, Instagram and Messenger share an allowance of 2,000
108
+ # messages per month on Free. Over it, sends return 429 with code
109
+ # `a2p_limit_exceeded` and upgrade details; the counter resets on the 1st of
110
+ # each month. Paid plans have no message caps
111
+ # - Email is billed from your prepaid balance in 1,000-message blocks: $0.40 per
112
+ # 1,000 transactional emails, $0.80 per 1,000 marketing (broadcast) emails. A
113
+ # block is charged when your monthly count crosses each 1,000 boundary, and at
114
+ # zero balance email sends return 402 with code `insufficient_balance`. Free
115
+ # teams start with $2 of credit and additionally cap at 3,000 emails/month and
116
+ # 100/day. Teams on earlier plans keep their original email quotas instead
117
+ # - SMS and voice are billed per message from your balance on every plan
118
+ #
119
+ # **Email recipient pre-flight:** Email messages are validated automatically
120
+ # before dispatch. Sends that would be a guaranteed hard bounce are failed instead
121
+ # of sent, protecting your bounce rate: the message transitions to `failed`
122
+ # (visible via `GET /v1/messages/{messageId}` and the `message.failed` webhook)
123
+ # with `errorCode` set to `EMAIL_INVALID_RECIPIENT` (malformed address),
124
+ # `EMAIL_DOMAIN_NOT_FOUND` (recipient domain has no MX or A records), or
125
+ # `EMAIL_RECIPIENT_SUPPRESSED` (address is on your suppression list after a
126
+ # previous bounce or complaint). Advisory signals (role addresses, disposable
127
+ # domains) do not block sends — check them beforehand with
128
+ # `POST /v1/introspect/email`.
109
129
  #
110
130
  # @overload send_(to:, attachments: nil, channel: nil, content: nil, fallback_enabled: nil, html_body: nil, idempotency_key: nil, message_type: nil, metadata: nil, reply_to: nil, subject: nil, text: nil, voice_language: nil, zavu_sender: nil, request_options: {})
111
131
  #
@@ -198,7 +198,11 @@ module Zavudev
198
198
  end
199
199
 
200
200
  # Submit a draft brand to The Campaign Registry (TCR) for vetting. The brand must
201
- # be in draft status. A $35 registration fee is charged from your balance.
201
+ # be in draft status. TCR's one-time $4 brand registration fee is charged from
202
+ # your balance at submission (passed through at cost) and refunded if the carrier
203
+ # rejects the registration. A team that already paid this fee through the
204
+ # compliance flow is not charged again. Campaign registration is billed separately
205
+ # when a campaign is submitted.
202
206
  #
203
207
  # @overload submit(brand_id, request_options: {})
204
208
  #
@@ -171,7 +171,12 @@ module Zavudev
171
171
  end
172
172
 
173
173
  # Submit a draft campaign for carrier review. The campaign must be in draft status
174
- # and its brand must be verified.
174
+ # and its brand must be verified. TCR's one-time registration fee is charged from
175
+ # your balance at submission ($15 for standard use cases, $2 for LOW_VOLUME),
176
+ # passed through at cost and refunded if the carrier rejects it. Once approved,
177
+ # the campaign's monthly TCR fee ($10 standard, $2 LOW_VOLUME) is charged from
178
+ # your balance while the campaign is active — see registrationCostCents and
179
+ # monthlyFeeCents on the campaign object.
175
180
  #
176
181
  # @overload submit(campaign_id, request_options: {})
177
182
  #