bzapper 0.15.1 → 0.15.2
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 +4 -4
- data/README.md +2 -2
- data/lib/bzapper/resources/contacts.rb +8 -4
- data/lib/bzapper/resources/messages.rb +42 -14
- data/lib/bzapper/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 697a35b6c63dfce682d817591acce81e85db056e0c6df02a6516f58937e658b6
|
|
4
|
+
data.tar.gz: 200eeea0422240ad4576b18f849240210ef5393177f98e93bb1dbf5d28697f58
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b72e5ac34cba530268ff666fb4d3628b6fef1c66bce331b1b379c467866d4029ed1bd24c6cc36f0c43c2b384887b8d0e53cadccd3ec9b2000caab220bc8519a7
|
|
7
|
+
data.tar.gz: dd99f005da6f3a7ce1a0331becb3a1f6516e61110aa0ec5c7ea515b919e67ad60cc0cde2770027716e719338fe1d5468bee35a240639e1523b6d9230735d8636
|
data/README.md
CHANGED
|
@@ -10,13 +10,13 @@ Zero dependências de runtime (só biblioteca padrão: `net/http`, `json`, `open
|
|
|
10
10
|
## Instalação
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
gem install bzapper -v 0.15.
|
|
13
|
+
gem install bzapper -v 0.15.2
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Ou no `Gemfile` — **fixe a versão exata** (cada release declara se muda a superfície pública):
|
|
17
17
|
|
|
18
18
|
```ruby
|
|
19
|
-
gem "bzapper", "0.15.
|
|
19
|
+
gem "bzapper", "0.15.2"
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## Hello world
|
|
@@ -78,10 +78,12 @@ module Bzapper
|
|
|
78
78
|
# Name/email/document/address are optional. Idempotent by phone: if the contact already exists,
|
|
79
79
|
# only its empty fields are filled (never overwritten) and it is returned with 201.
|
|
80
80
|
#
|
|
81
|
-
# @param phone [String] (corpo) +DDIdigits (E.164 without spaces),
|
|
82
|
-
# (`<digits>@lid`).
|
|
81
|
+
# @param phone [String] (corpo) +DDIdigits (E.164 without spaces), the WhatsApp LID
|
|
82
|
+
# (`<digits>@lid`) or the Meta BSUID (`BR.1349…`).
|
|
83
83
|
# @param lid [String, nil] (corpo) WhatsApp LID (`<digits>@lid`). With a phone too, the LID-only
|
|
84
84
|
# contact merges into the phone one.
|
|
85
|
+
# @param bsuid [String, nil] (corpo) Meta business-scoped user ID (official rail). With a phone
|
|
86
|
+
# too, it is stored on the phone contact.
|
|
85
87
|
# @param name [String, nil] (corpo)
|
|
86
88
|
# @param email [String, nil] (corpo)
|
|
87
89
|
# @param document [String, nil] (corpo)
|
|
@@ -91,11 +93,13 @@ module Bzapper
|
|
|
91
93
|
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
92
94
|
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
93
95
|
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
94
|
-
def create_contact(phone:, lid: UNSET,
|
|
95
|
-
|
|
96
|
+
def create_contact(phone:, lid: UNSET, bsuid: UNSET, name: UNSET, email: UNSET,
|
|
97
|
+
document: UNSET, document_type: UNSET, address: UNSET,
|
|
98
|
+
idempotency_key: nil, timeout: nil)
|
|
96
99
|
payload = compact(
|
|
97
100
|
"phone" => phone,
|
|
98
101
|
"lid" => lid,
|
|
102
|
+
"bsuid" => bsuid,
|
|
99
103
|
"name" => name,
|
|
100
104
|
"email" => email,
|
|
101
105
|
"document" => document,
|
|
@@ -19,7 +19,9 @@ module Bzapper
|
|
|
19
19
|
# rotation (e.g. campaign/broadcast).
|
|
20
20
|
# @param to [String] (corpo) Destination: E.164 phone (+DDIdigits), contact JID
|
|
21
21
|
# (…@s.whatsapp.net), group JID (…@g.us) or the contact's @lid. A @lid is translated to the
|
|
22
|
-
# phone when the connected number knows it
|
|
22
|
+
# phone when the connected number knows it. Official rail: phone or the Meta BSUID (`BR.1349…`)
|
|
23
|
+
# — a known phone is preferred; authentication templates need a phone (422
|
|
24
|
+
# official_otp_needs_phone); a BSUID on the unofficial rail is 400 bsuid_official_only.
|
|
23
25
|
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
24
26
|
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
25
27
|
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
@@ -84,7 +86,9 @@ module Bzapper
|
|
|
84
86
|
# rotation (e.g. campaign/broadcast).
|
|
85
87
|
# @param to [String] (corpo) Destination: E.164 phone (+DDIdigits), contact JID
|
|
86
88
|
# (…@s.whatsapp.net), group JID (…@g.us) or the contact's @lid. A @lid is translated to the
|
|
87
|
-
# phone when the connected number knows it
|
|
89
|
+
# phone when the connected number knows it. Official rail: phone or the Meta BSUID (`BR.1349…`)
|
|
90
|
+
# — a known phone is preferred; authentication templates need a phone (422
|
|
91
|
+
# official_otp_needs_phone); a BSUID on the unofficial rail is 400 bsuid_official_only.
|
|
88
92
|
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
89
93
|
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
90
94
|
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
@@ -150,7 +154,9 @@ module Bzapper
|
|
|
150
154
|
# rotation (e.g. campaign/broadcast).
|
|
151
155
|
# @param to [String] (corpo) Destination: E.164 phone (+DDIdigits), contact JID
|
|
152
156
|
# (…@s.whatsapp.net), group JID (…@g.us) or the contact's @lid. A @lid is translated to the
|
|
153
|
-
# phone when the connected number knows it
|
|
157
|
+
# phone when the connected number knows it. Official rail: phone or the Meta BSUID (`BR.1349…`)
|
|
158
|
+
# — a known phone is preferred; authentication templates need a phone (422
|
|
159
|
+
# official_otp_needs_phone); a BSUID on the unofficial rail is 400 bsuid_official_only.
|
|
154
160
|
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
155
161
|
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
156
162
|
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
@@ -216,7 +222,9 @@ module Bzapper
|
|
|
216
222
|
# rotation (e.g. campaign/broadcast).
|
|
217
223
|
# @param to [String] (corpo) Destination: E.164 phone (+DDIdigits), contact JID
|
|
218
224
|
# (…@s.whatsapp.net), group JID (…@g.us) or the contact's @lid. A @lid is translated to the
|
|
219
|
-
# phone when the connected number knows it
|
|
225
|
+
# phone when the connected number knows it. Official rail: phone or the Meta BSUID (`BR.1349…`)
|
|
226
|
+
# — a known phone is preferred; authentication templates need a phone (422
|
|
227
|
+
# official_otp_needs_phone); a BSUID on the unofficial rail is 400 bsuid_official_only.
|
|
220
228
|
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
221
229
|
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
222
230
|
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
@@ -283,7 +291,9 @@ module Bzapper
|
|
|
283
291
|
# rotation (e.g. campaign/broadcast).
|
|
284
292
|
# @param to [String] (corpo) Destination: E.164 phone (+DDIdigits), contact JID
|
|
285
293
|
# (…@s.whatsapp.net), group JID (…@g.us) or the contact's @lid. A @lid is translated to the
|
|
286
|
-
# phone when the connected number knows it
|
|
294
|
+
# phone when the connected number knows it. Official rail: phone or the Meta BSUID (`BR.1349…`)
|
|
295
|
+
# — a known phone is preferred; authentication templates need a phone (422
|
|
296
|
+
# official_otp_needs_phone); a BSUID on the unofficial rail is 400 bsuid_official_only.
|
|
287
297
|
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
288
298
|
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
289
299
|
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
@@ -349,7 +359,9 @@ module Bzapper
|
|
|
349
359
|
# rotation (e.g. campaign/broadcast).
|
|
350
360
|
# @param to [String] (corpo) Destination: E.164 phone (+DDIdigits), contact JID
|
|
351
361
|
# (…@s.whatsapp.net), group JID (…@g.us) or the contact's @lid. A @lid is translated to the
|
|
352
|
-
# phone when the connected number knows it
|
|
362
|
+
# phone when the connected number knows it. Official rail: phone or the Meta BSUID (`BR.1349…`)
|
|
363
|
+
# — a known phone is preferred; authentication templates need a phone (422
|
|
364
|
+
# official_otp_needs_phone); a BSUID on the unofficial rail is 400 bsuid_official_only.
|
|
353
365
|
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
354
366
|
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
355
367
|
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
@@ -416,7 +428,9 @@ module Bzapper
|
|
|
416
428
|
# rotation (e.g. campaign/broadcast).
|
|
417
429
|
# @param to [String] (corpo) Destination: E.164 phone (+DDIdigits), contact JID
|
|
418
430
|
# (…@s.whatsapp.net), group JID (…@g.us) or the contact's @lid. A @lid is translated to the
|
|
419
|
-
# phone when the connected number knows it
|
|
431
|
+
# phone when the connected number knows it. Official rail: phone or the Meta BSUID (`BR.1349…`)
|
|
432
|
+
# — a known phone is preferred; authentication templates need a phone (422
|
|
433
|
+
# official_otp_needs_phone); a BSUID on the unofficial rail is 400 bsuid_official_only.
|
|
420
434
|
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
421
435
|
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
422
436
|
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
@@ -488,7 +502,9 @@ module Bzapper
|
|
|
488
502
|
# rotation (e.g. campaign/broadcast).
|
|
489
503
|
# @param to [String] (corpo) Destination: E.164 phone (+DDIdigits), contact JID
|
|
490
504
|
# (…@s.whatsapp.net), group JID (…@g.us) or the contact's @lid. A @lid is translated to the
|
|
491
|
-
# phone when the connected number knows it
|
|
505
|
+
# phone when the connected number knows it. Official rail: phone or the Meta BSUID (`BR.1349…`)
|
|
506
|
+
# — a known phone is preferred; authentication templates need a phone (422
|
|
507
|
+
# official_otp_needs_phone); a BSUID on the unofficial rail is 400 bsuid_official_only.
|
|
492
508
|
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
493
509
|
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
494
510
|
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
@@ -562,7 +578,9 @@ module Bzapper
|
|
|
562
578
|
# rotation (e.g. campaign/broadcast).
|
|
563
579
|
# @param to [String] (corpo) Destination: E.164 phone (+DDIdigits), contact JID
|
|
564
580
|
# (…@s.whatsapp.net), group JID (…@g.us) or the contact's @lid. A @lid is translated to the
|
|
565
|
-
# phone when the connected number knows it
|
|
581
|
+
# phone when the connected number knows it. Official rail: phone or the Meta BSUID (`BR.1349…`)
|
|
582
|
+
# — a known phone is preferred; authentication templates need a phone (422
|
|
583
|
+
# official_otp_needs_phone); a BSUID on the unofficial rail is 400 bsuid_official_only.
|
|
566
584
|
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
567
585
|
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
568
586
|
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
@@ -631,7 +649,9 @@ module Bzapper
|
|
|
631
649
|
# rotation (e.g. campaign/broadcast).
|
|
632
650
|
# @param to [String] (corpo) Destination: E.164 phone (+DDIdigits), contact JID
|
|
633
651
|
# (…@s.whatsapp.net), group JID (…@g.us) or the contact's @lid. A @lid is translated to the
|
|
634
|
-
# phone when the connected number knows it
|
|
652
|
+
# phone when the connected number knows it. Official rail: phone or the Meta BSUID (`BR.1349…`)
|
|
653
|
+
# — a known phone is preferred; authentication templates need a phone (422
|
|
654
|
+
# official_otp_needs_phone); a BSUID on the unofficial rail is 400 bsuid_official_only.
|
|
635
655
|
# @param quoted_message_id [String] (corpo) Quoted wa_message_id (reply).
|
|
636
656
|
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
637
657
|
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
@@ -699,7 +719,9 @@ module Bzapper
|
|
|
699
719
|
# rotation (e.g. campaign/broadcast).
|
|
700
720
|
# @param to [String] (corpo) Destination: E.164 phone (+DDIdigits), contact JID
|
|
701
721
|
# (…@s.whatsapp.net), group JID (…@g.us) or the contact's @lid. A @lid is translated to the
|
|
702
|
-
# phone when the connected number knows it
|
|
722
|
+
# phone when the connected number knows it. Official rail: phone or the Meta BSUID (`BR.1349…`)
|
|
723
|
+
# — a known phone is preferred; authentication templates need a phone (422
|
|
724
|
+
# official_otp_needs_phone); a BSUID on the unofficial rail is 400 bsuid_official_only.
|
|
703
725
|
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
704
726
|
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
705
727
|
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
@@ -769,7 +791,9 @@ module Bzapper
|
|
|
769
791
|
# rotation (e.g. campaign/broadcast).
|
|
770
792
|
# @param to [String] (corpo) Destination: E.164 phone (+DDIdigits), contact JID
|
|
771
793
|
# (…@s.whatsapp.net), group JID (…@g.us) or the contact's @lid. A @lid is translated to the
|
|
772
|
-
# phone when the connected number knows it
|
|
794
|
+
# phone when the connected number knows it. Official rail: phone or the Meta BSUID (`BR.1349…`)
|
|
795
|
+
# — a known phone is preferred; authentication templates need a phone (422
|
|
796
|
+
# official_otp_needs_phone); a BSUID on the unofficial rail is 400 bsuid_official_only.
|
|
773
797
|
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
774
798
|
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
775
799
|
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
@@ -845,7 +869,9 @@ module Bzapper
|
|
|
845
869
|
# rotation (e.g. campaign/broadcast).
|
|
846
870
|
# @param to [String] (corpo) Destination: E.164 phone (+DDIdigits), contact JID
|
|
847
871
|
# (…@s.whatsapp.net), group JID (…@g.us) or the contact's @lid. A @lid is translated to the
|
|
848
|
-
# phone when the connected number knows it
|
|
872
|
+
# phone when the connected number knows it. Official rail: phone or the Meta BSUID (`BR.1349…`)
|
|
873
|
+
# — a known phone is preferred; authentication templates need a phone (422
|
|
874
|
+
# official_otp_needs_phone); a BSUID on the unofficial rail is 400 bsuid_official_only.
|
|
849
875
|
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
850
876
|
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
851
877
|
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
|
@@ -935,7 +961,9 @@ module Bzapper
|
|
|
935
961
|
# rotation (e.g. campaign/broadcast).
|
|
936
962
|
# @param to [String] (corpo) Destination: E.164 phone (+DDIdigits), contact JID
|
|
937
963
|
# (…@s.whatsapp.net), group JID (…@g.us) or the contact's @lid. A @lid is translated to the
|
|
938
|
-
# phone when the connected number knows it
|
|
964
|
+
# phone when the connected number knows it. Official rail: phone or the Meta BSUID (`BR.1349…`)
|
|
965
|
+
# — a known phone is preferred; authentication templates need a phone (422
|
|
966
|
+
# official_otp_needs_phone); a BSUID on the unofficial rail is 400 bsuid_official_only.
|
|
939
967
|
# @param quoted_message_id [String, nil] (corpo) Quoted wa_message_id (reply).
|
|
940
968
|
# @param quoted_participant [String, nil] (corpo) Author (phone or JID) of the quoted/reacted
|
|
941
969
|
# message. Only needed in groups when the quoted message is not in bZapper history — otherwise
|
data/lib/bzapper/version.rb
CHANGED