bzapper 0.7.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.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +323 -0
- data/lib/bzapper/client.rb +122 -0
- data/lib/bzapper/codec.rb +112 -0
- data/lib/bzapper/errors.rb +126 -0
- data/lib/bzapper/resources/accounts.rb +394 -0
- data/lib/bzapper/resources/advanced.rb +388 -0
- data/lib/bzapper/resources/advisories.rb +39 -0
- data/lib/bzapper/resources/base.rb +56 -0
- data/lib/bzapper/resources/billing.rb +177 -0
- data/lib/bzapper/resources/campaigns.rb +273 -0
- data/lib/bzapper/resources/connect.rb +35 -0
- data/lib/bzapper/resources/contacts.rb +481 -0
- data/lib/bzapper/resources/conversations.rb +47 -0
- data/lib/bzapper/resources/groups.rb +252 -0
- data/lib/bzapper/resources/instances.rb +287 -0
- data/lib/bzapper/resources/messages.rb +920 -0
- data/lib/bzapper/resources/partner.rb +134 -0
- data/lib/bzapper/resources/pools.rb +69 -0
- data/lib/bzapper/resources/scheduling.rb +38 -0
- data/lib/bzapper/resources/system.rb +21 -0
- data/lib/bzapper/resources/usage.rb +42 -0
- data/lib/bzapper/resources/webhooks.rb +147 -0
- data/lib/bzapper/resources.rb +100 -0
- data/lib/bzapper/transport.rb +248 -0
- data/lib/bzapper/unset.rb +27 -0
- data/lib/bzapper/upload.rb +61 -0
- data/lib/bzapper/version.rb +7 -0
- data/lib/bzapper/webhook.rb +194 -0
- data/lib/bzapper.rb +30 -0
- metadata +74 -0
|
@@ -0,0 +1,920 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# GERADO por script/generate.rb a partir de packages/sdk/openapi.yaml — não edite à mão.
|
|
4
|
+
|
|
5
|
+
module Bzapper
|
|
6
|
+
module Resources
|
|
7
|
+
# Envio de mensagens (todos os tipos, OTP), presença e confirmação de leitura — `client.messages`.
|
|
8
|
+
class Messages < Base
|
|
9
|
+
# Send a text message. `POST /messages/text`
|
|
10
|
+
#
|
|
11
|
+
# @param instance_id [String, nil] (corpo) OPTIONAL. Only `to` is required. Omit `instance_id`
|
|
12
|
+
# to let the gateway auto-pick a number from your pool (rotation + conversation affinity) — the
|
|
13
|
+
# recommended path. Provide it ONLY to FORCE the send from a specific number. Get ids from `GET
|
|
14
|
+
# /instances`.
|
|
15
|
+
# @param pool_id [String, nil] (corpo) Rotates within this pool (when instance_id is omitted).
|
|
16
|
+
# @param sticky [Boolean, nil] (corpo) Conversation affinity (support): without
|
|
17
|
+
# instance_id/pool_id, it AUTOMATICALLY reuses the number that already talks to `to`, ensuring
|
|
18
|
+
# the whole interaction stays on the same number. Default **true**; send **false** to force
|
|
19
|
+
# rotation (e.g. campaign/broadcast).
|
|
20
|
+
# @param to [String] (corpo) Destination E.164 phone or JID.
|
|
21
|
+
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
22
|
+
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
23
|
+
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
24
|
+
# it is resolved automatically.
|
|
25
|
+
# @param client_reference [String, nil] (corpo) Client end-to-end correlation.
|
|
26
|
+
# @param mentions [Array<String>, nil] (corpo) Mentioned people (group): phones ("5511…", "+55
|
|
27
|
+
# 11 9…") or JIDs. The body must contain "@<digits>" for the mention to be highlighted.
|
|
28
|
+
# @param scheduled_at [Time, String, nil] (corpo) OPTIONAL. Schedule the send for a future
|
|
29
|
+
# RFC3339 timestamp. The gateway holds the message and dispatches it at that exact time (the
|
|
30
|
+
# number is picked at send time). Max lead time by plan: Free 24h, Pro 30 days, and up to 1 year
|
|
31
|
+
# with the "Extended scheduling" add-on. Returns status `scheduled` with a `scheduled_id`. OTP
|
|
32
|
+
# cannot be scheduled.
|
|
33
|
+
# @param groups [Array<String>, nil] (corpo) OPTIONAL. Contact-group keys to correlate/stamp
|
|
34
|
+
# onto the recipient contact when this send resolves (see `GET /contact-groups`). Does not send
|
|
35
|
+
# the message to a WhatsApp group.
|
|
36
|
+
# @param tags [Array<String>, nil] (corpo) OPTIONAL. Tag keys to correlate/stamp onto the
|
|
37
|
+
# recipient contact when this send resolves (see `GET /tags`).
|
|
38
|
+
# @param force [Boolean, nil] (corpo) OPTIONAL. When true, bypasses an inferred suppression
|
|
39
|
+
# (e.g. opt-out inferred from behaviour) for this send. Does NOT override an explicit
|
|
40
|
+
# suppression entry (`/suppressions`) — use with care and only with a lawful basis.
|
|
41
|
+
# @param body [String] (corpo)
|
|
42
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
43
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
44
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
45
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
46
|
+
def send_text(to:, body:, instance_id: UNSET, pool_id: UNSET, sticky: UNSET,
|
|
47
|
+
quoted_message_id: UNSET, quoted_participant: UNSET, client_reference: UNSET,
|
|
48
|
+
mentions: UNSET, scheduled_at: UNSET, groups: UNSET, tags: UNSET, force: UNSET,
|
|
49
|
+
idempotency_key: nil, timeout: nil)
|
|
50
|
+
payload = compact(
|
|
51
|
+
"instance_id" => instance_id,
|
|
52
|
+
"pool_id" => pool_id,
|
|
53
|
+
"sticky" => sticky,
|
|
54
|
+
"to" => to,
|
|
55
|
+
"quoted_message_id" => quoted_message_id,
|
|
56
|
+
"quoted_participant" => quoted_participant,
|
|
57
|
+
"client_reference" => client_reference,
|
|
58
|
+
"mentions" => mentions,
|
|
59
|
+
"scheduled_at" => scheduled_at,
|
|
60
|
+
"groups" => groups,
|
|
61
|
+
"tags" => tags,
|
|
62
|
+
"force" => force,
|
|
63
|
+
"body" => body
|
|
64
|
+
)
|
|
65
|
+
request("POST",
|
|
66
|
+
"/messages/text",
|
|
67
|
+
body: payload,
|
|
68
|
+
idempotency_key: idempotency_key,
|
|
69
|
+
timeout: timeout)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Send an image (url or base64). `POST /messages/image`
|
|
73
|
+
#
|
|
74
|
+
# @param instance_id [String, nil] (corpo) OPTIONAL. Only `to` is required. Omit `instance_id`
|
|
75
|
+
# to let the gateway auto-pick a number from your pool (rotation + conversation affinity) — the
|
|
76
|
+
# recommended path. Provide it ONLY to FORCE the send from a specific number. Get ids from `GET
|
|
77
|
+
# /instances`.
|
|
78
|
+
# @param pool_id [String, nil] (corpo) Rotates within this pool (when instance_id is omitted).
|
|
79
|
+
# @param sticky [Boolean, nil] (corpo) Conversation affinity (support): without
|
|
80
|
+
# instance_id/pool_id, it AUTOMATICALLY reuses the number that already talks to `to`, ensuring
|
|
81
|
+
# the whole interaction stays on the same number. Default **true**; send **false** to force
|
|
82
|
+
# rotation (e.g. campaign/broadcast).
|
|
83
|
+
# @param to [String] (corpo) Destination E.164 phone or JID.
|
|
84
|
+
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
85
|
+
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
86
|
+
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
87
|
+
# it is resolved automatically.
|
|
88
|
+
# @param client_reference [String, nil] (corpo) Client end-to-end correlation.
|
|
89
|
+
# @param mentions [Array<String>, nil] (corpo) Mentioned people (group): phones ("5511…", "+55
|
|
90
|
+
# 11 9…") or JIDs. The body must contain "@<digits>" for the mention to be highlighted.
|
|
91
|
+
# @param scheduled_at [Time, String, nil] (corpo) OPTIONAL. Schedule the send for a future
|
|
92
|
+
# RFC3339 timestamp. The gateway holds the message and dispatches it at that exact time (the
|
|
93
|
+
# number is picked at send time). Max lead time by plan: Free 24h, Pro 30 days, and up to 1 year
|
|
94
|
+
# with the "Extended scheduling" add-on. Returns status `scheduled` with a `scheduled_id`. OTP
|
|
95
|
+
# cannot be scheduled.
|
|
96
|
+
# @param groups [Array<String>, nil] (corpo) OPTIONAL. Contact-group keys to correlate/stamp
|
|
97
|
+
# onto the recipient contact when this send resolves (see `GET /contact-groups`). Does not send
|
|
98
|
+
# the message to a WhatsApp group.
|
|
99
|
+
# @param tags [Array<String>, nil] (corpo) OPTIONAL. Tag keys to correlate/stamp onto the
|
|
100
|
+
# recipient contact when this send resolves (see `GET /tags`).
|
|
101
|
+
# @param force [Boolean, nil] (corpo) OPTIONAL. When true, bypasses an inferred suppression
|
|
102
|
+
# (e.g. opt-out inferred from behaviour) for this send. Does NOT override an explicit
|
|
103
|
+
# suppression entry (`/suppressions`) — use with care and only with a lawful basis.
|
|
104
|
+
# @param media [Hash] (corpo) Media by URL **or** base64 (never both).
|
|
105
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
106
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
107
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
108
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
109
|
+
def send_image(to:, media:, instance_id: UNSET, pool_id: UNSET, sticky: UNSET,
|
|
110
|
+
quoted_message_id: UNSET, quoted_participant: UNSET, client_reference: UNSET,
|
|
111
|
+
mentions: UNSET, scheduled_at: UNSET, groups: UNSET, tags: UNSET,
|
|
112
|
+
force: UNSET, idempotency_key: nil, timeout: nil)
|
|
113
|
+
payload = compact(
|
|
114
|
+
"instance_id" => instance_id,
|
|
115
|
+
"pool_id" => pool_id,
|
|
116
|
+
"sticky" => sticky,
|
|
117
|
+
"to" => to,
|
|
118
|
+
"quoted_message_id" => quoted_message_id,
|
|
119
|
+
"quoted_participant" => quoted_participant,
|
|
120
|
+
"client_reference" => client_reference,
|
|
121
|
+
"mentions" => mentions,
|
|
122
|
+
"scheduled_at" => scheduled_at,
|
|
123
|
+
"groups" => groups,
|
|
124
|
+
"tags" => tags,
|
|
125
|
+
"force" => force,
|
|
126
|
+
"media" => media
|
|
127
|
+
)
|
|
128
|
+
request("POST",
|
|
129
|
+
"/messages/image",
|
|
130
|
+
body: payload,
|
|
131
|
+
idempotency_key: idempotency_key,
|
|
132
|
+
timeout: timeout)
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Send a video. `POST /messages/video`
|
|
136
|
+
#
|
|
137
|
+
# @param instance_id [String, nil] (corpo) OPTIONAL. Only `to` is required. Omit `instance_id`
|
|
138
|
+
# to let the gateway auto-pick a number from your pool (rotation + conversation affinity) — the
|
|
139
|
+
# recommended path. Provide it ONLY to FORCE the send from a specific number. Get ids from `GET
|
|
140
|
+
# /instances`.
|
|
141
|
+
# @param pool_id [String, nil] (corpo) Rotates within this pool (when instance_id is omitted).
|
|
142
|
+
# @param sticky [Boolean, nil] (corpo) Conversation affinity (support): without
|
|
143
|
+
# instance_id/pool_id, it AUTOMATICALLY reuses the number that already talks to `to`, ensuring
|
|
144
|
+
# the whole interaction stays on the same number. Default **true**; send **false** to force
|
|
145
|
+
# rotation (e.g. campaign/broadcast).
|
|
146
|
+
# @param to [String] (corpo) Destination E.164 phone or JID.
|
|
147
|
+
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
148
|
+
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
149
|
+
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
150
|
+
# it is resolved automatically.
|
|
151
|
+
# @param client_reference [String, nil] (corpo) Client end-to-end correlation.
|
|
152
|
+
# @param mentions [Array<String>, nil] (corpo) Mentioned people (group): phones ("5511…", "+55
|
|
153
|
+
# 11 9…") or JIDs. The body must contain "@<digits>" for the mention to be highlighted.
|
|
154
|
+
# @param scheduled_at [Time, String, nil] (corpo) OPTIONAL. Schedule the send for a future
|
|
155
|
+
# RFC3339 timestamp. The gateway holds the message and dispatches it at that exact time (the
|
|
156
|
+
# number is picked at send time). Max lead time by plan: Free 24h, Pro 30 days, and up to 1 year
|
|
157
|
+
# with the "Extended scheduling" add-on. Returns status `scheduled` with a `scheduled_id`. OTP
|
|
158
|
+
# cannot be scheduled.
|
|
159
|
+
# @param groups [Array<String>, nil] (corpo) OPTIONAL. Contact-group keys to correlate/stamp
|
|
160
|
+
# onto the recipient contact when this send resolves (see `GET /contact-groups`). Does not send
|
|
161
|
+
# the message to a WhatsApp group.
|
|
162
|
+
# @param tags [Array<String>, nil] (corpo) OPTIONAL. Tag keys to correlate/stamp onto the
|
|
163
|
+
# recipient contact when this send resolves (see `GET /tags`).
|
|
164
|
+
# @param force [Boolean, nil] (corpo) OPTIONAL. When true, bypasses an inferred suppression
|
|
165
|
+
# (e.g. opt-out inferred from behaviour) for this send. Does NOT override an explicit
|
|
166
|
+
# suppression entry (`/suppressions`) — use with care and only with a lawful basis.
|
|
167
|
+
# @param media [Hash] (corpo) Media by URL **or** base64 (never both).
|
|
168
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
169
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
170
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
171
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
172
|
+
def send_video(to:, media:, instance_id: UNSET, pool_id: UNSET, sticky: UNSET,
|
|
173
|
+
quoted_message_id: UNSET, quoted_participant: UNSET, client_reference: UNSET,
|
|
174
|
+
mentions: UNSET, scheduled_at: UNSET, groups: UNSET, tags: UNSET,
|
|
175
|
+
force: UNSET, idempotency_key: nil, timeout: nil)
|
|
176
|
+
payload = compact(
|
|
177
|
+
"instance_id" => instance_id,
|
|
178
|
+
"pool_id" => pool_id,
|
|
179
|
+
"sticky" => sticky,
|
|
180
|
+
"to" => to,
|
|
181
|
+
"quoted_message_id" => quoted_message_id,
|
|
182
|
+
"quoted_participant" => quoted_participant,
|
|
183
|
+
"client_reference" => client_reference,
|
|
184
|
+
"mentions" => mentions,
|
|
185
|
+
"scheduled_at" => scheduled_at,
|
|
186
|
+
"groups" => groups,
|
|
187
|
+
"tags" => tags,
|
|
188
|
+
"force" => force,
|
|
189
|
+
"media" => media
|
|
190
|
+
)
|
|
191
|
+
request("POST",
|
|
192
|
+
"/messages/video",
|
|
193
|
+
body: payload,
|
|
194
|
+
idempotency_key: idempotency_key,
|
|
195
|
+
timeout: timeout)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Send a document. `POST /messages/document`
|
|
199
|
+
#
|
|
200
|
+
# @param instance_id [String, nil] (corpo) OPTIONAL. Only `to` is required. Omit `instance_id`
|
|
201
|
+
# to let the gateway auto-pick a number from your pool (rotation + conversation affinity) — the
|
|
202
|
+
# recommended path. Provide it ONLY to FORCE the send from a specific number. Get ids from `GET
|
|
203
|
+
# /instances`.
|
|
204
|
+
# @param pool_id [String, nil] (corpo) Rotates within this pool (when instance_id is omitted).
|
|
205
|
+
# @param sticky [Boolean, nil] (corpo) Conversation affinity (support): without
|
|
206
|
+
# instance_id/pool_id, it AUTOMATICALLY reuses the number that already talks to `to`, ensuring
|
|
207
|
+
# the whole interaction stays on the same number. Default **true**; send **false** to force
|
|
208
|
+
# rotation (e.g. campaign/broadcast).
|
|
209
|
+
# @param to [String] (corpo) Destination E.164 phone or JID.
|
|
210
|
+
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
211
|
+
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
212
|
+
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
213
|
+
# it is resolved automatically.
|
|
214
|
+
# @param client_reference [String, nil] (corpo) Client end-to-end correlation.
|
|
215
|
+
# @param mentions [Array<String>, nil] (corpo) Mentioned people (group): phones ("5511…", "+55
|
|
216
|
+
# 11 9…") or JIDs. The body must contain "@<digits>" for the mention to be highlighted.
|
|
217
|
+
# @param scheduled_at [Time, String, nil] (corpo) OPTIONAL. Schedule the send for a future
|
|
218
|
+
# RFC3339 timestamp. The gateway holds the message and dispatches it at that exact time (the
|
|
219
|
+
# number is picked at send time). Max lead time by plan: Free 24h, Pro 30 days, and up to 1 year
|
|
220
|
+
# with the "Extended scheduling" add-on. Returns status `scheduled` with a `scheduled_id`. OTP
|
|
221
|
+
# cannot be scheduled.
|
|
222
|
+
# @param groups [Array<String>, nil] (corpo) OPTIONAL. Contact-group keys to correlate/stamp
|
|
223
|
+
# onto the recipient contact when this send resolves (see `GET /contact-groups`). Does not send
|
|
224
|
+
# the message to a WhatsApp group.
|
|
225
|
+
# @param tags [Array<String>, nil] (corpo) OPTIONAL. Tag keys to correlate/stamp onto the
|
|
226
|
+
# recipient contact when this send resolves (see `GET /tags`).
|
|
227
|
+
# @param force [Boolean, nil] (corpo) OPTIONAL. When true, bypasses an inferred suppression
|
|
228
|
+
# (e.g. opt-out inferred from behaviour) for this send. Does NOT override an explicit
|
|
229
|
+
# suppression entry (`/suppressions`) — use with care and only with a lawful basis.
|
|
230
|
+
# @param media [Hash] (corpo) Media by URL **or** base64 (never both).
|
|
231
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
232
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
233
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
234
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
235
|
+
def send_document(to:, media:, instance_id: UNSET, pool_id: UNSET, sticky: UNSET,
|
|
236
|
+
quoted_message_id: UNSET, quoted_participant: UNSET,
|
|
237
|
+
client_reference: UNSET, mentions: UNSET, scheduled_at: UNSET,
|
|
238
|
+
groups: UNSET, tags: UNSET, force: UNSET, idempotency_key: nil,
|
|
239
|
+
timeout: nil)
|
|
240
|
+
payload = compact(
|
|
241
|
+
"instance_id" => instance_id,
|
|
242
|
+
"pool_id" => pool_id,
|
|
243
|
+
"sticky" => sticky,
|
|
244
|
+
"to" => to,
|
|
245
|
+
"quoted_message_id" => quoted_message_id,
|
|
246
|
+
"quoted_participant" => quoted_participant,
|
|
247
|
+
"client_reference" => client_reference,
|
|
248
|
+
"mentions" => mentions,
|
|
249
|
+
"scheduled_at" => scheduled_at,
|
|
250
|
+
"groups" => groups,
|
|
251
|
+
"tags" => tags,
|
|
252
|
+
"force" => force,
|
|
253
|
+
"media" => media
|
|
254
|
+
)
|
|
255
|
+
request("POST",
|
|
256
|
+
"/messages/document",
|
|
257
|
+
body: payload,
|
|
258
|
+
idempotency_key: idempotency_key,
|
|
259
|
+
timeout: timeout)
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
# Send audio (optional ptt = voice note). `POST /messages/audio`
|
|
263
|
+
#
|
|
264
|
+
# @param instance_id [String, nil] (corpo) OPTIONAL. Only `to` is required. Omit `instance_id`
|
|
265
|
+
# to let the gateway auto-pick a number from your pool (rotation + conversation affinity) — the
|
|
266
|
+
# recommended path. Provide it ONLY to FORCE the send from a specific number. Get ids from `GET
|
|
267
|
+
# /instances`.
|
|
268
|
+
# @param pool_id [String, nil] (corpo) Rotates within this pool (when instance_id is omitted).
|
|
269
|
+
# @param sticky [Boolean, nil] (corpo) Conversation affinity (support): without
|
|
270
|
+
# instance_id/pool_id, it AUTOMATICALLY reuses the number that already talks to `to`, ensuring
|
|
271
|
+
# the whole interaction stays on the same number. Default **true**; send **false** to force
|
|
272
|
+
# rotation (e.g. campaign/broadcast).
|
|
273
|
+
# @param to [String] (corpo) Destination E.164 phone or JID.
|
|
274
|
+
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
275
|
+
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
276
|
+
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
277
|
+
# it is resolved automatically.
|
|
278
|
+
# @param client_reference [String, nil] (corpo) Client end-to-end correlation.
|
|
279
|
+
# @param mentions [Array<String>, nil] (corpo) Mentioned people (group): phones ("5511…", "+55
|
|
280
|
+
# 11 9…") or JIDs. The body must contain "@<digits>" for the mention to be highlighted.
|
|
281
|
+
# @param scheduled_at [Time, String, nil] (corpo) OPTIONAL. Schedule the send for a future
|
|
282
|
+
# RFC3339 timestamp. The gateway holds the message and dispatches it at that exact time (the
|
|
283
|
+
# number is picked at send time). Max lead time by plan: Free 24h, Pro 30 days, and up to 1 year
|
|
284
|
+
# with the "Extended scheduling" add-on. Returns status `scheduled` with a `scheduled_id`. OTP
|
|
285
|
+
# cannot be scheduled.
|
|
286
|
+
# @param groups [Array<String>, nil] (corpo) OPTIONAL. Contact-group keys to correlate/stamp
|
|
287
|
+
# onto the recipient contact when this send resolves (see `GET /contact-groups`). Does not send
|
|
288
|
+
# the message to a WhatsApp group.
|
|
289
|
+
# @param tags [Array<String>, nil] (corpo) OPTIONAL. Tag keys to correlate/stamp onto the
|
|
290
|
+
# recipient contact when this send resolves (see `GET /tags`).
|
|
291
|
+
# @param force [Boolean, nil] (corpo) OPTIONAL. When true, bypasses an inferred suppression
|
|
292
|
+
# (e.g. opt-out inferred from behaviour) for this send. Does NOT override an explicit
|
|
293
|
+
# suppression entry (`/suppressions`) — use with care and only with a lawful basis.
|
|
294
|
+
# @param media [Hash] (corpo) Media by URL **or** base64 (never both).
|
|
295
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
296
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
297
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
298
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
299
|
+
def send_audio(to:, media:, instance_id: UNSET, pool_id: UNSET, sticky: UNSET,
|
|
300
|
+
quoted_message_id: UNSET, quoted_participant: UNSET, client_reference: UNSET,
|
|
301
|
+
mentions: UNSET, scheduled_at: UNSET, groups: UNSET, tags: UNSET,
|
|
302
|
+
force: UNSET, idempotency_key: nil, timeout: nil)
|
|
303
|
+
payload = compact(
|
|
304
|
+
"instance_id" => instance_id,
|
|
305
|
+
"pool_id" => pool_id,
|
|
306
|
+
"sticky" => sticky,
|
|
307
|
+
"to" => to,
|
|
308
|
+
"quoted_message_id" => quoted_message_id,
|
|
309
|
+
"quoted_participant" => quoted_participant,
|
|
310
|
+
"client_reference" => client_reference,
|
|
311
|
+
"mentions" => mentions,
|
|
312
|
+
"scheduled_at" => scheduled_at,
|
|
313
|
+
"groups" => groups,
|
|
314
|
+
"tags" => tags,
|
|
315
|
+
"force" => force,
|
|
316
|
+
"media" => media
|
|
317
|
+
)
|
|
318
|
+
request("POST",
|
|
319
|
+
"/messages/audio",
|
|
320
|
+
body: payload,
|
|
321
|
+
idempotency_key: idempotency_key,
|
|
322
|
+
timeout: timeout)
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
# Send a sticker. `POST /messages/sticker`
|
|
326
|
+
#
|
|
327
|
+
# @param instance_id [String, nil] (corpo) OPTIONAL. Only `to` is required. Omit `instance_id`
|
|
328
|
+
# to let the gateway auto-pick a number from your pool (rotation + conversation affinity) — the
|
|
329
|
+
# recommended path. Provide it ONLY to FORCE the send from a specific number. Get ids from `GET
|
|
330
|
+
# /instances`.
|
|
331
|
+
# @param pool_id [String, nil] (corpo) Rotates within this pool (when instance_id is omitted).
|
|
332
|
+
# @param sticky [Boolean, nil] (corpo) Conversation affinity (support): without
|
|
333
|
+
# instance_id/pool_id, it AUTOMATICALLY reuses the number that already talks to `to`, ensuring
|
|
334
|
+
# the whole interaction stays on the same number. Default **true**; send **false** to force
|
|
335
|
+
# rotation (e.g. campaign/broadcast).
|
|
336
|
+
# @param to [String] (corpo) Destination E.164 phone or JID.
|
|
337
|
+
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
338
|
+
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
339
|
+
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
340
|
+
# it is resolved automatically.
|
|
341
|
+
# @param client_reference [String, nil] (corpo) Client end-to-end correlation.
|
|
342
|
+
# @param mentions [Array<String>, nil] (corpo) Mentioned people (group): phones ("5511…", "+55
|
|
343
|
+
# 11 9…") or JIDs. The body must contain "@<digits>" for the mention to be highlighted.
|
|
344
|
+
# @param scheduled_at [Time, String, nil] (corpo) OPTIONAL. Schedule the send for a future
|
|
345
|
+
# RFC3339 timestamp. The gateway holds the message and dispatches it at that exact time (the
|
|
346
|
+
# number is picked at send time). Max lead time by plan: Free 24h, Pro 30 days, and up to 1 year
|
|
347
|
+
# with the "Extended scheduling" add-on. Returns status `scheduled` with a `scheduled_id`. OTP
|
|
348
|
+
# cannot be scheduled.
|
|
349
|
+
# @param groups [Array<String>, nil] (corpo) OPTIONAL. Contact-group keys to correlate/stamp
|
|
350
|
+
# onto the recipient contact when this send resolves (see `GET /contact-groups`). Does not send
|
|
351
|
+
# the message to a WhatsApp group.
|
|
352
|
+
# @param tags [Array<String>, nil] (corpo) OPTIONAL. Tag keys to correlate/stamp onto the
|
|
353
|
+
# recipient contact when this send resolves (see `GET /tags`).
|
|
354
|
+
# @param force [Boolean, nil] (corpo) OPTIONAL. When true, bypasses an inferred suppression
|
|
355
|
+
# (e.g. opt-out inferred from behaviour) for this send. Does NOT override an explicit
|
|
356
|
+
# suppression entry (`/suppressions`) — use with care and only with a lawful basis.
|
|
357
|
+
# @param media [Hash] (corpo) Media by URL **or** base64 (never both).
|
|
358
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
359
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
360
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
361
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
362
|
+
def send_sticker(to:, media:, instance_id: UNSET, pool_id: UNSET, sticky: UNSET,
|
|
363
|
+
quoted_message_id: UNSET, quoted_participant: UNSET,
|
|
364
|
+
client_reference: UNSET, mentions: UNSET, scheduled_at: UNSET,
|
|
365
|
+
groups: UNSET, tags: UNSET, force: UNSET, idempotency_key: nil,
|
|
366
|
+
timeout: nil)
|
|
367
|
+
payload = compact(
|
|
368
|
+
"instance_id" => instance_id,
|
|
369
|
+
"pool_id" => pool_id,
|
|
370
|
+
"sticky" => sticky,
|
|
371
|
+
"to" => to,
|
|
372
|
+
"quoted_message_id" => quoted_message_id,
|
|
373
|
+
"quoted_participant" => quoted_participant,
|
|
374
|
+
"client_reference" => client_reference,
|
|
375
|
+
"mentions" => mentions,
|
|
376
|
+
"scheduled_at" => scheduled_at,
|
|
377
|
+
"groups" => groups,
|
|
378
|
+
"tags" => tags,
|
|
379
|
+
"force" => force,
|
|
380
|
+
"media" => media
|
|
381
|
+
)
|
|
382
|
+
request("POST",
|
|
383
|
+
"/messages/sticker",
|
|
384
|
+
body: payload,
|
|
385
|
+
idempotency_key: idempotency_key,
|
|
386
|
+
timeout: timeout)
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
# Send a location. `POST /messages/location`
|
|
390
|
+
#
|
|
391
|
+
# @param instance_id [String, nil] (corpo) OPTIONAL. Only `to` is required. Omit `instance_id`
|
|
392
|
+
# to let the gateway auto-pick a number from your pool (rotation + conversation affinity) — the
|
|
393
|
+
# recommended path. Provide it ONLY to FORCE the send from a specific number. Get ids from `GET
|
|
394
|
+
# /instances`.
|
|
395
|
+
# @param pool_id [String, nil] (corpo) Rotates within this pool (when instance_id is omitted).
|
|
396
|
+
# @param sticky [Boolean, nil] (corpo) Conversation affinity (support): without
|
|
397
|
+
# instance_id/pool_id, it AUTOMATICALLY reuses the number that already talks to `to`, ensuring
|
|
398
|
+
# the whole interaction stays on the same number. Default **true**; send **false** to force
|
|
399
|
+
# rotation (e.g. campaign/broadcast).
|
|
400
|
+
# @param to [String] (corpo) Destination E.164 phone or JID.
|
|
401
|
+
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
402
|
+
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
403
|
+
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
404
|
+
# it is resolved automatically.
|
|
405
|
+
# @param client_reference [String, nil] (corpo) Client end-to-end correlation.
|
|
406
|
+
# @param mentions [Array<String>, nil] (corpo) Mentioned people (group): phones ("5511…", "+55
|
|
407
|
+
# 11 9…") or JIDs. The body must contain "@<digits>" for the mention to be highlighted.
|
|
408
|
+
# @param scheduled_at [Time, String, nil] (corpo) OPTIONAL. Schedule the send for a future
|
|
409
|
+
# RFC3339 timestamp. The gateway holds the message and dispatches it at that exact time (the
|
|
410
|
+
# number is picked at send time). Max lead time by plan: Free 24h, Pro 30 days, and up to 1 year
|
|
411
|
+
# with the "Extended scheduling" add-on. Returns status `scheduled` with a `scheduled_id`. OTP
|
|
412
|
+
# cannot be scheduled.
|
|
413
|
+
# @param groups [Array<String>, nil] (corpo) OPTIONAL. Contact-group keys to correlate/stamp
|
|
414
|
+
# onto the recipient contact when this send resolves (see `GET /contact-groups`). Does not send
|
|
415
|
+
# the message to a WhatsApp group.
|
|
416
|
+
# @param tags [Array<String>, nil] (corpo) OPTIONAL. Tag keys to correlate/stamp onto the
|
|
417
|
+
# recipient contact when this send resolves (see `GET /tags`).
|
|
418
|
+
# @param force [Boolean, nil] (corpo) OPTIONAL. When true, bypasses an inferred suppression
|
|
419
|
+
# (e.g. opt-out inferred from behaviour) for this send. Does NOT override an explicit
|
|
420
|
+
# suppression entry (`/suppressions`) — use with care and only with a lawful basis.
|
|
421
|
+
# @param latitude [Numeric] (corpo)
|
|
422
|
+
# @param longitude [Numeric] (corpo)
|
|
423
|
+
# @param name [String, nil] (corpo)
|
|
424
|
+
# @param address [String, nil] (corpo)
|
|
425
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
426
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
427
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
428
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
429
|
+
def send_location(to:, latitude:, longitude:, instance_id: UNSET, pool_id: UNSET,
|
|
430
|
+
sticky: UNSET, quoted_message_id: UNSET, quoted_participant: UNSET,
|
|
431
|
+
client_reference: UNSET, mentions: UNSET, scheduled_at: UNSET,
|
|
432
|
+
groups: UNSET, tags: UNSET, force: UNSET, name: UNSET, address: UNSET,
|
|
433
|
+
idempotency_key: nil, timeout: nil)
|
|
434
|
+
payload = compact(
|
|
435
|
+
"instance_id" => instance_id,
|
|
436
|
+
"pool_id" => pool_id,
|
|
437
|
+
"sticky" => sticky,
|
|
438
|
+
"to" => to,
|
|
439
|
+
"quoted_message_id" => quoted_message_id,
|
|
440
|
+
"quoted_participant" => quoted_participant,
|
|
441
|
+
"client_reference" => client_reference,
|
|
442
|
+
"mentions" => mentions,
|
|
443
|
+
"scheduled_at" => scheduled_at,
|
|
444
|
+
"groups" => groups,
|
|
445
|
+
"tags" => tags,
|
|
446
|
+
"force" => force,
|
|
447
|
+
"latitude" => latitude,
|
|
448
|
+
"longitude" => longitude,
|
|
449
|
+
"name" => name,
|
|
450
|
+
"address" => address
|
|
451
|
+
)
|
|
452
|
+
request("POST",
|
|
453
|
+
"/messages/location",
|
|
454
|
+
body: payload,
|
|
455
|
+
idempotency_key: idempotency_key,
|
|
456
|
+
timeout: timeout)
|
|
457
|
+
end
|
|
458
|
+
|
|
459
|
+
# Send a contact (vCard). `POST /messages/contact`
|
|
460
|
+
#
|
|
461
|
+
# @param instance_id [String, nil] (corpo) OPTIONAL. Only `to` is required. Omit `instance_id`
|
|
462
|
+
# to let the gateway auto-pick a number from your pool (rotation + conversation affinity) — the
|
|
463
|
+
# recommended path. Provide it ONLY to FORCE the send from a specific number. Get ids from `GET
|
|
464
|
+
# /instances`.
|
|
465
|
+
# @param pool_id [String, nil] (corpo) Rotates within this pool (when instance_id is omitted).
|
|
466
|
+
# @param sticky [Boolean, nil] (corpo) Conversation affinity (support): without
|
|
467
|
+
# instance_id/pool_id, it AUTOMATICALLY reuses the number that already talks to `to`, ensuring
|
|
468
|
+
# the whole interaction stays on the same number. Default **true**; send **false** to force
|
|
469
|
+
# rotation (e.g. campaign/broadcast).
|
|
470
|
+
# @param to [String] (corpo) Destination E.164 phone or JID.
|
|
471
|
+
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
472
|
+
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
473
|
+
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
474
|
+
# it is resolved automatically.
|
|
475
|
+
# @param client_reference [String, nil] (corpo) Client end-to-end correlation.
|
|
476
|
+
# @param mentions [Array<String>, nil] (corpo) Mentioned people (group): phones ("5511…", "+55
|
|
477
|
+
# 11 9…") or JIDs. The body must contain "@<digits>" for the mention to be highlighted.
|
|
478
|
+
# @param scheduled_at [Time, String, nil] (corpo) OPTIONAL. Schedule the send for a future
|
|
479
|
+
# RFC3339 timestamp. The gateway holds the message and dispatches it at that exact time (the
|
|
480
|
+
# number is picked at send time). Max lead time by plan: Free 24h, Pro 30 days, and up to 1 year
|
|
481
|
+
# with the "Extended scheduling" add-on. Returns status `scheduled` with a `scheduled_id`. OTP
|
|
482
|
+
# cannot be scheduled.
|
|
483
|
+
# @param groups [Array<String>, nil] (corpo) OPTIONAL. Contact-group keys to correlate/stamp
|
|
484
|
+
# onto the recipient contact when this send resolves (see `GET /contact-groups`). Does not send
|
|
485
|
+
# the message to a WhatsApp group.
|
|
486
|
+
# @param tags [Array<String>, nil] (corpo) OPTIONAL. Tag keys to correlate/stamp onto the
|
|
487
|
+
# recipient contact when this send resolves (see `GET /tags`).
|
|
488
|
+
# @param force [Boolean, nil] (corpo) OPTIONAL. When true, bypasses an inferred suppression
|
|
489
|
+
# (e.g. opt-out inferred from behaviour) for this send. Does NOT override an explicit
|
|
490
|
+
# suppression entry (`/suppressions`) — use with care and only with a lawful basis.
|
|
491
|
+
# @param contact_name [String, nil] (corpo)
|
|
492
|
+
# @param contact_vcard [String, nil] (corpo)
|
|
493
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
494
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
495
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
496
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
497
|
+
def send_contact(to:, instance_id: UNSET, pool_id: UNSET, sticky: UNSET,
|
|
498
|
+
quoted_message_id: UNSET, quoted_participant: UNSET,
|
|
499
|
+
client_reference: UNSET, mentions: UNSET, scheduled_at: UNSET,
|
|
500
|
+
groups: UNSET, tags: UNSET, force: UNSET, contact_name: UNSET,
|
|
501
|
+
contact_vcard: UNSET, idempotency_key: nil, timeout: nil)
|
|
502
|
+
payload = compact(
|
|
503
|
+
"instance_id" => instance_id,
|
|
504
|
+
"pool_id" => pool_id,
|
|
505
|
+
"sticky" => sticky,
|
|
506
|
+
"to" => to,
|
|
507
|
+
"quoted_message_id" => quoted_message_id,
|
|
508
|
+
"quoted_participant" => quoted_participant,
|
|
509
|
+
"client_reference" => client_reference,
|
|
510
|
+
"mentions" => mentions,
|
|
511
|
+
"scheduled_at" => scheduled_at,
|
|
512
|
+
"groups" => groups,
|
|
513
|
+
"tags" => tags,
|
|
514
|
+
"force" => force,
|
|
515
|
+
"contact_name" => contact_name,
|
|
516
|
+
"contact_vcard" => contact_vcard
|
|
517
|
+
)
|
|
518
|
+
request("POST",
|
|
519
|
+
"/messages/contact",
|
|
520
|
+
body: payload,
|
|
521
|
+
idempotency_key: idempotency_key,
|
|
522
|
+
timeout: timeout)
|
|
523
|
+
end
|
|
524
|
+
|
|
525
|
+
# Send a poll. `POST /messages/poll`
|
|
526
|
+
#
|
|
527
|
+
# @param instance_id [String, nil] (corpo) OPTIONAL. Only `to` is required. Omit `instance_id`
|
|
528
|
+
# to let the gateway auto-pick a number from your pool (rotation + conversation affinity) — the
|
|
529
|
+
# recommended path. Provide it ONLY to FORCE the send from a specific number. Get ids from `GET
|
|
530
|
+
# /instances`.
|
|
531
|
+
# @param pool_id [String, nil] (corpo) Rotates within this pool (when instance_id is omitted).
|
|
532
|
+
# @param sticky [Boolean, nil] (corpo) Conversation affinity (support): without
|
|
533
|
+
# instance_id/pool_id, it AUTOMATICALLY reuses the number that already talks to `to`, ensuring
|
|
534
|
+
# the whole interaction stays on the same number. Default **true**; send **false** to force
|
|
535
|
+
# rotation (e.g. campaign/broadcast).
|
|
536
|
+
# @param to [String] (corpo) Destination E.164 phone or JID.
|
|
537
|
+
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
538
|
+
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
539
|
+
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
540
|
+
# it is resolved automatically.
|
|
541
|
+
# @param client_reference [String, nil] (corpo) Client end-to-end correlation.
|
|
542
|
+
# @param mentions [Array<String>, nil] (corpo) Mentioned people (group): phones ("5511…", "+55
|
|
543
|
+
# 11 9…") or JIDs. The body must contain "@<digits>" for the mention to be highlighted.
|
|
544
|
+
# @param scheduled_at [Time, String, nil] (corpo) OPTIONAL. Schedule the send for a future
|
|
545
|
+
# RFC3339 timestamp. The gateway holds the message and dispatches it at that exact time (the
|
|
546
|
+
# number is picked at send time). Max lead time by plan: Free 24h, Pro 30 days, and up to 1 year
|
|
547
|
+
# with the "Extended scheduling" add-on. Returns status `scheduled` with a `scheduled_id`. OTP
|
|
548
|
+
# cannot be scheduled.
|
|
549
|
+
# @param groups [Array<String>, nil] (corpo) OPTIONAL. Contact-group keys to correlate/stamp
|
|
550
|
+
# onto the recipient contact when this send resolves (see `GET /contact-groups`). Does not send
|
|
551
|
+
# the message to a WhatsApp group.
|
|
552
|
+
# @param tags [Array<String>, nil] (corpo) OPTIONAL. Tag keys to correlate/stamp onto the
|
|
553
|
+
# recipient contact when this send resolves (see `GET /tags`).
|
|
554
|
+
# @param force [Boolean, nil] (corpo) OPTIONAL. When true, bypasses an inferred suppression
|
|
555
|
+
# (e.g. opt-out inferred from behaviour) for this send. Does NOT override an explicit
|
|
556
|
+
# suppression entry (`/suppressions`) — use with care and only with a lawful basis.
|
|
557
|
+
# @param name [String] (corpo)
|
|
558
|
+
# @param options [Array<String>] (corpo)
|
|
559
|
+
# @param selectable_count [Integer, nil] (corpo)
|
|
560
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
561
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
562
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
563
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
564
|
+
def send_poll(to:, name:, options:, instance_id: UNSET, pool_id: UNSET, sticky: UNSET,
|
|
565
|
+
quoted_message_id: UNSET, quoted_participant: UNSET, client_reference: UNSET,
|
|
566
|
+
mentions: UNSET, scheduled_at: UNSET, groups: UNSET, tags: UNSET, force: UNSET,
|
|
567
|
+
selectable_count: UNSET, idempotency_key: nil, timeout: nil)
|
|
568
|
+
payload = compact(
|
|
569
|
+
"instance_id" => instance_id,
|
|
570
|
+
"pool_id" => pool_id,
|
|
571
|
+
"sticky" => sticky,
|
|
572
|
+
"to" => to,
|
|
573
|
+
"quoted_message_id" => quoted_message_id,
|
|
574
|
+
"quoted_participant" => quoted_participant,
|
|
575
|
+
"client_reference" => client_reference,
|
|
576
|
+
"mentions" => mentions,
|
|
577
|
+
"scheduled_at" => scheduled_at,
|
|
578
|
+
"groups" => groups,
|
|
579
|
+
"tags" => tags,
|
|
580
|
+
"force" => force,
|
|
581
|
+
"name" => name,
|
|
582
|
+
"options" => options,
|
|
583
|
+
"selectable_count" => selectable_count
|
|
584
|
+
)
|
|
585
|
+
request("POST",
|
|
586
|
+
"/messages/poll",
|
|
587
|
+
body: payload,
|
|
588
|
+
idempotency_key: idempotency_key,
|
|
589
|
+
timeout: timeout)
|
|
590
|
+
end
|
|
591
|
+
|
|
592
|
+
# React to a message. `POST /messages/reaction`
|
|
593
|
+
#
|
|
594
|
+
# @param instance_id [String, nil] (corpo) OPTIONAL. Only `to` is required. Omit `instance_id`
|
|
595
|
+
# to let the gateway auto-pick a number from your pool (rotation + conversation affinity) — the
|
|
596
|
+
# recommended path. Provide it ONLY to FORCE the send from a specific number. Get ids from `GET
|
|
597
|
+
# /instances`.
|
|
598
|
+
# @param pool_id [String, nil] (corpo) Rotates within this pool (when instance_id is omitted).
|
|
599
|
+
# @param sticky [Boolean, nil] (corpo) Conversation affinity (support): without
|
|
600
|
+
# instance_id/pool_id, it AUTOMATICALLY reuses the number that already talks to `to`, ensuring
|
|
601
|
+
# the whole interaction stays on the same number. Default **true**; send **false** to force
|
|
602
|
+
# rotation (e.g. campaign/broadcast).
|
|
603
|
+
# @param to [String] (corpo) Destination E.164 phone or JID.
|
|
604
|
+
# @param quoted_message_id [String] (corpo) Quoted wa_message_id (reply).
|
|
605
|
+
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
606
|
+
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
607
|
+
# it is resolved automatically.
|
|
608
|
+
# @param client_reference [String, nil] (corpo) Client end-to-end correlation.
|
|
609
|
+
# @param mentions [Array<String>, nil] (corpo) Mentioned people (group): phones ("5511…", "+55
|
|
610
|
+
# 11 9…") or JIDs. The body must contain "@<digits>" for the mention to be highlighted.
|
|
611
|
+
# @param scheduled_at [Time, String, nil] (corpo) OPTIONAL. Schedule the send for a future
|
|
612
|
+
# RFC3339 timestamp. The gateway holds the message and dispatches it at that exact time (the
|
|
613
|
+
# number is picked at send time). Max lead time by plan: Free 24h, Pro 30 days, and up to 1 year
|
|
614
|
+
# with the "Extended scheduling" add-on. Returns status `scheduled` with a `scheduled_id`. OTP
|
|
615
|
+
# cannot be scheduled.
|
|
616
|
+
# @param groups [Array<String>, nil] (corpo) OPTIONAL. Contact-group keys to correlate/stamp
|
|
617
|
+
# onto the recipient contact when this send resolves (see `GET /contact-groups`). Does not send
|
|
618
|
+
# the message to a WhatsApp group.
|
|
619
|
+
# @param tags [Array<String>, nil] (corpo) OPTIONAL. Tag keys to correlate/stamp onto the
|
|
620
|
+
# recipient contact when this send resolves (see `GET /tags`).
|
|
621
|
+
# @param force [Boolean, nil] (corpo) OPTIONAL. When true, bypasses an inferred suppression
|
|
622
|
+
# (e.g. opt-out inferred from behaviour) for this send. Does NOT override an explicit
|
|
623
|
+
# suppression entry (`/suppressions`) — use with care and only with a lawful basis.
|
|
624
|
+
# @param emoji [String, nil] (corpo) Reaction emoji. Empty string removes a previous reaction.
|
|
625
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
626
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
627
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
628
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
629
|
+
def send_reaction(to:, quoted_message_id:, instance_id: UNSET, pool_id: UNSET, sticky: UNSET,
|
|
630
|
+
quoted_participant: UNSET, client_reference: UNSET, mentions: UNSET,
|
|
631
|
+
scheduled_at: UNSET, groups: UNSET, tags: UNSET, force: UNSET,
|
|
632
|
+
emoji: UNSET, idempotency_key: nil, timeout: nil)
|
|
633
|
+
payload = compact(
|
|
634
|
+
"instance_id" => instance_id,
|
|
635
|
+
"pool_id" => pool_id,
|
|
636
|
+
"sticky" => sticky,
|
|
637
|
+
"to" => to,
|
|
638
|
+
"quoted_message_id" => quoted_message_id,
|
|
639
|
+
"quoted_participant" => quoted_participant,
|
|
640
|
+
"client_reference" => client_reference,
|
|
641
|
+
"mentions" => mentions,
|
|
642
|
+
"scheduled_at" => scheduled_at,
|
|
643
|
+
"groups" => groups,
|
|
644
|
+
"tags" => tags,
|
|
645
|
+
"force" => force,
|
|
646
|
+
"emoji" => emoji
|
|
647
|
+
)
|
|
648
|
+
request("POST",
|
|
649
|
+
"/messages/reaction",
|
|
650
|
+
body: payload,
|
|
651
|
+
idempotency_key: idempotency_key,
|
|
652
|
+
timeout: timeout)
|
|
653
|
+
end
|
|
654
|
+
|
|
655
|
+
# Send buttons (automatic fallback to a text menu). `POST /messages/buttons`
|
|
656
|
+
#
|
|
657
|
+
# Buttons are not reliable on WhatsApp (worse in groups). The API **always** sends an equivalent
|
|
658
|
+
# **numbered text menu** as a fallback.
|
|
659
|
+
#
|
|
660
|
+
# @param instance_id [String, nil] (corpo) OPTIONAL. Only `to` is required. Omit `instance_id`
|
|
661
|
+
# to let the gateway auto-pick a number from your pool (rotation + conversation affinity) — the
|
|
662
|
+
# recommended path. Provide it ONLY to FORCE the send from a specific number. Get ids from `GET
|
|
663
|
+
# /instances`.
|
|
664
|
+
# @param pool_id [String, nil] (corpo) Rotates within this pool (when instance_id is omitted).
|
|
665
|
+
# @param sticky [Boolean, nil] (corpo) Conversation affinity (support): without
|
|
666
|
+
# instance_id/pool_id, it AUTOMATICALLY reuses the number that already talks to `to`, ensuring
|
|
667
|
+
# the whole interaction stays on the same number. Default **true**; send **false** to force
|
|
668
|
+
# rotation (e.g. campaign/broadcast).
|
|
669
|
+
# @param to [String] (corpo) Destination E.164 phone or JID.
|
|
670
|
+
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
671
|
+
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
672
|
+
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
673
|
+
# it is resolved automatically.
|
|
674
|
+
# @param client_reference [String, nil] (corpo) Client end-to-end correlation.
|
|
675
|
+
# @param mentions [Array<String>, nil] (corpo) Mentioned people (group): phones ("5511…", "+55
|
|
676
|
+
# 11 9…") or JIDs. The body must contain "@<digits>" for the mention to be highlighted.
|
|
677
|
+
# @param scheduled_at [Time, String, nil] (corpo) OPTIONAL. Schedule the send for a future
|
|
678
|
+
# RFC3339 timestamp. The gateway holds the message and dispatches it at that exact time (the
|
|
679
|
+
# number is picked at send time). Max lead time by plan: Free 24h, Pro 30 days, and up to 1 year
|
|
680
|
+
# with the "Extended scheduling" add-on. Returns status `scheduled` with a `scheduled_id`. OTP
|
|
681
|
+
# cannot be scheduled.
|
|
682
|
+
# @param groups [Array<String>, nil] (corpo) OPTIONAL. Contact-group keys to correlate/stamp
|
|
683
|
+
# onto the recipient contact when this send resolves (see `GET /contact-groups`). Does not send
|
|
684
|
+
# the message to a WhatsApp group.
|
|
685
|
+
# @param tags [Array<String>, nil] (corpo) OPTIONAL. Tag keys to correlate/stamp onto the
|
|
686
|
+
# recipient contact when this send resolves (see `GET /tags`).
|
|
687
|
+
# @param force [Boolean, nil] (corpo) OPTIONAL. When true, bypasses an inferred suppression
|
|
688
|
+
# (e.g. opt-out inferred from behaviour) for this send. Does NOT override an explicit
|
|
689
|
+
# suppression entry (`/suppressions`) — use with care and only with a lawful basis.
|
|
690
|
+
# @param body [String] (corpo)
|
|
691
|
+
# @param footer [String, nil] (corpo)
|
|
692
|
+
# @param buttons [Array<Hash>] (corpo)
|
|
693
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
694
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
695
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
696
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
697
|
+
def send_buttons(to:, body:, buttons:, instance_id: UNSET, pool_id: UNSET, sticky: UNSET,
|
|
698
|
+
quoted_message_id: UNSET, quoted_participant: UNSET,
|
|
699
|
+
client_reference: UNSET, mentions: UNSET, scheduled_at: UNSET,
|
|
700
|
+
groups: UNSET, tags: UNSET, force: UNSET, footer: UNSET,
|
|
701
|
+
idempotency_key: nil, timeout: nil)
|
|
702
|
+
payload = compact(
|
|
703
|
+
"instance_id" => instance_id,
|
|
704
|
+
"pool_id" => pool_id,
|
|
705
|
+
"sticky" => sticky,
|
|
706
|
+
"to" => to,
|
|
707
|
+
"quoted_message_id" => quoted_message_id,
|
|
708
|
+
"quoted_participant" => quoted_participant,
|
|
709
|
+
"client_reference" => client_reference,
|
|
710
|
+
"mentions" => mentions,
|
|
711
|
+
"scheduled_at" => scheduled_at,
|
|
712
|
+
"groups" => groups,
|
|
713
|
+
"tags" => tags,
|
|
714
|
+
"force" => force,
|
|
715
|
+
"body" => body,
|
|
716
|
+
"footer" => footer,
|
|
717
|
+
"buttons" => buttons
|
|
718
|
+
)
|
|
719
|
+
request("POST",
|
|
720
|
+
"/messages/buttons",
|
|
721
|
+
body: payload,
|
|
722
|
+
idempotency_key: idempotency_key,
|
|
723
|
+
timeout: timeout)
|
|
724
|
+
end
|
|
725
|
+
|
|
726
|
+
# Send a list (automatic fallback to a text menu). `POST /messages/list`
|
|
727
|
+
#
|
|
728
|
+
# @param instance_id [String, nil] (corpo) OPTIONAL. Only `to` is required. Omit `instance_id`
|
|
729
|
+
# to let the gateway auto-pick a number from your pool (rotation + conversation affinity) — the
|
|
730
|
+
# recommended path. Provide it ONLY to FORCE the send from a specific number. Get ids from `GET
|
|
731
|
+
# /instances`.
|
|
732
|
+
# @param pool_id [String, nil] (corpo) Rotates within this pool (when instance_id is omitted).
|
|
733
|
+
# @param sticky [Boolean, nil] (corpo) Conversation affinity (support): without
|
|
734
|
+
# instance_id/pool_id, it AUTOMATICALLY reuses the number that already talks to `to`, ensuring
|
|
735
|
+
# the whole interaction stays on the same number. Default **true**; send **false** to force
|
|
736
|
+
# rotation (e.g. campaign/broadcast).
|
|
737
|
+
# @param to [String] (corpo) Destination E.164 phone or JID.
|
|
738
|
+
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
739
|
+
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
740
|
+
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
741
|
+
# it is resolved automatically.
|
|
742
|
+
# @param client_reference [String, nil] (corpo) Client end-to-end correlation.
|
|
743
|
+
# @param mentions [Array<String>, nil] (corpo) Mentioned people (group): phones ("5511…", "+55
|
|
744
|
+
# 11 9…") or JIDs. The body must contain "@<digits>" for the mention to be highlighted.
|
|
745
|
+
# @param scheduled_at [Time, String, nil] (corpo) OPTIONAL. Schedule the send for a future
|
|
746
|
+
# RFC3339 timestamp. The gateway holds the message and dispatches it at that exact time (the
|
|
747
|
+
# number is picked at send time). Max lead time by plan: Free 24h, Pro 30 days, and up to 1 year
|
|
748
|
+
# with the "Extended scheduling" add-on. Returns status `scheduled` with a `scheduled_id`. OTP
|
|
749
|
+
# cannot be scheduled.
|
|
750
|
+
# @param groups [Array<String>, nil] (corpo) OPTIONAL. Contact-group keys to correlate/stamp
|
|
751
|
+
# onto the recipient contact when this send resolves (see `GET /contact-groups`). Does not send
|
|
752
|
+
# the message to a WhatsApp group.
|
|
753
|
+
# @param tags [Array<String>, nil] (corpo) OPTIONAL. Tag keys to correlate/stamp onto the
|
|
754
|
+
# recipient contact when this send resolves (see `GET /tags`).
|
|
755
|
+
# @param force [Boolean, nil] (corpo) OPTIONAL. When true, bypasses an inferred suppression
|
|
756
|
+
# (e.g. opt-out inferred from behaviour) for this send. Does NOT override an explicit
|
|
757
|
+
# suppression entry (`/suppressions`) — use with care and only with a lawful basis.
|
|
758
|
+
# @param body [String] (corpo)
|
|
759
|
+
# @param footer [String, nil] (corpo)
|
|
760
|
+
# @param button_text [String, nil] (corpo)
|
|
761
|
+
# @param sections [Array<Hash>] (corpo)
|
|
762
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
763
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
764
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
765
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
766
|
+
def send_list(to:, body:, sections:, instance_id: UNSET, pool_id: UNSET, sticky: UNSET,
|
|
767
|
+
quoted_message_id: UNSET, quoted_participant: UNSET, client_reference: UNSET,
|
|
768
|
+
mentions: UNSET, scheduled_at: UNSET, groups: UNSET, tags: UNSET, force: UNSET,
|
|
769
|
+
footer: UNSET, button_text: UNSET, idempotency_key: nil, timeout: nil)
|
|
770
|
+
payload = compact(
|
|
771
|
+
"instance_id" => instance_id,
|
|
772
|
+
"pool_id" => pool_id,
|
|
773
|
+
"sticky" => sticky,
|
|
774
|
+
"to" => to,
|
|
775
|
+
"quoted_message_id" => quoted_message_id,
|
|
776
|
+
"quoted_participant" => quoted_participant,
|
|
777
|
+
"client_reference" => client_reference,
|
|
778
|
+
"mentions" => mentions,
|
|
779
|
+
"scheduled_at" => scheduled_at,
|
|
780
|
+
"groups" => groups,
|
|
781
|
+
"tags" => tags,
|
|
782
|
+
"force" => force,
|
|
783
|
+
"body" => body,
|
|
784
|
+
"footer" => footer,
|
|
785
|
+
"button_text" => button_text,
|
|
786
|
+
"sections" => sections
|
|
787
|
+
)
|
|
788
|
+
request("POST",
|
|
789
|
+
"/messages/list",
|
|
790
|
+
body: payload,
|
|
791
|
+
idempotency_key: idempotency_key,
|
|
792
|
+
timeout: timeout)
|
|
793
|
+
end
|
|
794
|
+
|
|
795
|
+
# Send an OTP code (text + code in separate messages). `POST /messages/otp`
|
|
796
|
+
#
|
|
797
|
+
# Sends a verification code as TWO messages — the context text and the code alone in a bubble —
|
|
798
|
+
# so the recipient can copy the code on any device (long-press the bubble). Counts as ONE send
|
|
799
|
+
# (type=otp). If `body` is omitted, the API generates the text in the account language with
|
|
800
|
+
# variations (reduces the block risk). The code is never persisted nor shown in the inbox.
|
|
801
|
+
#
|
|
802
|
+
# @param instance_id [String, nil] (corpo) OPTIONAL. Only `to` is required. Omit `instance_id`
|
|
803
|
+
# to let the gateway auto-pick a number from your pool (rotation + conversation affinity) — the
|
|
804
|
+
# recommended path. Provide it ONLY to FORCE the send from a specific number. Get ids from `GET
|
|
805
|
+
# /instances`.
|
|
806
|
+
# @param pool_id [String, nil] (corpo) Rotates within this pool (when instance_id is omitted).
|
|
807
|
+
# @param sticky [Boolean, nil] (corpo) Conversation affinity (support): without
|
|
808
|
+
# instance_id/pool_id, it AUTOMATICALLY reuses the number that already talks to `to`, ensuring
|
|
809
|
+
# the whole interaction stays on the same number. Default **true**; send **false** to force
|
|
810
|
+
# rotation (e.g. campaign/broadcast).
|
|
811
|
+
# @param to [String] (corpo) Destination E.164 phone or JID.
|
|
812
|
+
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
813
|
+
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
814
|
+
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
815
|
+
# it is resolved automatically.
|
|
816
|
+
# @param client_reference [String, nil] (corpo) Client end-to-end correlation.
|
|
817
|
+
# @param mentions [Array<String>, nil] (corpo) Mentioned people (group): phones ("5511…", "+55
|
|
818
|
+
# 11 9…") or JIDs. The body must contain "@<digits>" for the mention to be highlighted.
|
|
819
|
+
# @param scheduled_at [Time, String, nil] (corpo) OPTIONAL. Schedule the send for a future
|
|
820
|
+
# RFC3339 timestamp. The gateway holds the message and dispatches it at that exact time (the
|
|
821
|
+
# number is picked at send time). Max lead time by plan: Free 24h, Pro 30 days, and up to 1 year
|
|
822
|
+
# with the "Extended scheduling" add-on. Returns status `scheduled` with a `scheduled_id`. OTP
|
|
823
|
+
# cannot be scheduled.
|
|
824
|
+
# @param groups [Array<String>, nil] (corpo) OPTIONAL. Contact-group keys to correlate/stamp
|
|
825
|
+
# onto the recipient contact when this send resolves (see `GET /contact-groups`). Does not send
|
|
826
|
+
# the message to a WhatsApp group.
|
|
827
|
+
# @param tags [Array<String>, nil] (corpo) OPTIONAL. Tag keys to correlate/stamp onto the
|
|
828
|
+
# recipient contact when this send resolves (see `GET /tags`).
|
|
829
|
+
# @param force [Boolean, nil] (corpo) OPTIONAL. When true, bypasses an inferred suppression
|
|
830
|
+
# (e.g. opt-out inferred from behaviour) for this send. Does NOT override an explicit
|
|
831
|
+
# suppression entry (`/suppressions`) — use with care and only with a lawful basis.
|
|
832
|
+
# @param code [String] (corpo) The verification code. Goes alone in a bubble (copyable).
|
|
833
|
+
# @param body [String, nil] (corpo) Context text (optional). Empty → generated in the account
|
|
834
|
+
# language, with variations.
|
|
835
|
+
# @param expiry_minutes [Integer, nil] (corpo) Optional — mentions the expiry in the generated
|
|
836
|
+
# text.
|
|
837
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
838
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
839
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
840
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
841
|
+
def send_otp(to:, code:, instance_id: UNSET, pool_id: UNSET, sticky: UNSET,
|
|
842
|
+
quoted_message_id: UNSET, quoted_participant: UNSET, client_reference: UNSET,
|
|
843
|
+
mentions: UNSET, scheduled_at: UNSET, groups: UNSET, tags: UNSET, force: UNSET,
|
|
844
|
+
body: UNSET, expiry_minutes: UNSET, idempotency_key: nil, timeout: nil)
|
|
845
|
+
payload = compact(
|
|
846
|
+
"instance_id" => instance_id,
|
|
847
|
+
"pool_id" => pool_id,
|
|
848
|
+
"sticky" => sticky,
|
|
849
|
+
"to" => to,
|
|
850
|
+
"quoted_message_id" => quoted_message_id,
|
|
851
|
+
"quoted_participant" => quoted_participant,
|
|
852
|
+
"client_reference" => client_reference,
|
|
853
|
+
"mentions" => mentions,
|
|
854
|
+
"scheduled_at" => scheduled_at,
|
|
855
|
+
"groups" => groups,
|
|
856
|
+
"tags" => tags,
|
|
857
|
+
"force" => force,
|
|
858
|
+
"code" => code,
|
|
859
|
+
"body" => body,
|
|
860
|
+
"expiry_minutes" => expiry_minutes
|
|
861
|
+
)
|
|
862
|
+
request("POST",
|
|
863
|
+
"/messages/otp",
|
|
864
|
+
body: payload,
|
|
865
|
+
idempotency_key: idempotency_key,
|
|
866
|
+
timeout: timeout)
|
|
867
|
+
end
|
|
868
|
+
|
|
869
|
+
# Mark messages as read. `POST /messages/{id}/read`
|
|
870
|
+
#
|
|
871
|
+
# @param id [String] WhatsApp message id to mark read (used when the body has no `message_ids`).
|
|
872
|
+
# @param instance_id [String] (corpo)
|
|
873
|
+
# @param chat [String] (corpo) Chat JID.
|
|
874
|
+
# @param wa_message_ids [Array<String>, nil] (corpo)
|
|
875
|
+
# @param sender [String, nil] (corpo) Author (phone or JID) of the messages. Groups only; when
|
|
876
|
+
# omitted, each message's stored author is used (400 `sender_required` if none is known).
|
|
877
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
878
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
879
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
880
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
881
|
+
# @raise [ArgumentError] parâmetro de caminho vazio, "." ou "..".
|
|
882
|
+
def mark_read(id, instance_id:, chat:, wa_message_ids: UNSET, sender: UNSET,
|
|
883
|
+
idempotency_key: nil, timeout: nil)
|
|
884
|
+
payload = compact(
|
|
885
|
+
"instance_id" => instance_id,
|
|
886
|
+
"chat" => chat,
|
|
887
|
+
"wa_message_ids" => wa_message_ids,
|
|
888
|
+
"sender" => sender
|
|
889
|
+
)
|
|
890
|
+
request("POST",
|
|
891
|
+
"/messages/#{segment(id, "id")}/read",
|
|
892
|
+
body: payload,
|
|
893
|
+
idempotency_key: idempotency_key,
|
|
894
|
+
timeout: timeout)
|
|
895
|
+
end
|
|
896
|
+
|
|
897
|
+
# Update presence in a chat (typing/recording/paused). `POST /presence/chat`
|
|
898
|
+
#
|
|
899
|
+
# @param instance_id [String] (corpo)
|
|
900
|
+
# @param to [String] (corpo)
|
|
901
|
+
# @param state [String, nil] (corpo)
|
|
902
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
903
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
904
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
905
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
906
|
+
def presence_chat(instance_id:, to:, state: UNSET, idempotency_key: nil, timeout: nil)
|
|
907
|
+
payload = compact(
|
|
908
|
+
"instance_id" => instance_id,
|
|
909
|
+
"to" => to,
|
|
910
|
+
"state" => state
|
|
911
|
+
)
|
|
912
|
+
request("POST",
|
|
913
|
+
"/presence/chat",
|
|
914
|
+
body: payload,
|
|
915
|
+
idempotency_key: idempotency_key,
|
|
916
|
+
timeout: timeout)
|
|
917
|
+
end
|
|
918
|
+
end
|
|
919
|
+
end
|
|
920
|
+
end
|