bzapper 0.15.0 → 0.15.1
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 +3 -3
- data/lib/bzapper/resources/contacts.rb +25 -8
- 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: 18ae11339f76e3c6d9f321c25afa3ec4010d4d8da7bdfe73f304f0480291988d
|
|
4
|
+
data.tar.gz: 16cfc74032ba4d425e50de9377f8dc5002a5600b3b409d270bdc0fc361b79acb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b11c1f25b4d64990782786a8b9e8a2ced755113c1b73e6052fc23bb00986b9afda21f4c04f2eaca1b2934281c2d786f6a5420824f5fdd5d4014dbf96bcf71315
|
|
7
|
+
data.tar.gz: db8baaabaf935f779f76ef8ff9d9e9c0f692f6d909966a96a2d6c505e4b360cbad2af16ae2bd2b661411cf4169c8f1bc3f8c87029e78c34a96b036d77b7da65b
|
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.1
|
|
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.1"
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## Hello world
|
|
@@ -190,7 +190,7 @@ O vínculo contato ↔ projeto/número é mantido **automaticamente** pela API.
|
|
|
190
190
|
### Importar em lote
|
|
191
191
|
|
|
192
192
|
Até **1000** contatos por chamada, upsert por telefone: o novo entra como
|
|
193
|
-
`pending_validation` (
|
|
193
|
+
`pending_validation` (já pode receber campanha e vira ativo quando a pessoa responde), o que já existe só recebe os campos
|
|
194
194
|
informados — valor em branco não apaga o que está lá. Linha ruim vai para `errors` e **não**
|
|
195
195
|
derruba o resto; contato suprimido/opt-out/bloqueado aparece em `skipped_rows` e nunca
|
|
196
196
|
ressuscita. Tags e grupos são criados na hora. `dry_run: true` valida tudo e não grava nada.
|
|
@@ -78,7 +78,10 @@ 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)
|
|
81
|
+
# @param phone [String] (corpo) +DDIdigits (E.164 without spaces), or the WhatsApp LID
|
|
82
|
+
# (`<digits>@lid`).
|
|
83
|
+
# @param lid [String, nil] (corpo) WhatsApp LID (`<digits>@lid`). With a phone too, the LID-only
|
|
84
|
+
# contact merges into the phone one.
|
|
82
85
|
# @param name [String, nil] (corpo)
|
|
83
86
|
# @param email [String, nil] (corpo)
|
|
84
87
|
# @param document [String, nil] (corpo)
|
|
@@ -88,10 +91,11 @@ module Bzapper
|
|
|
88
91
|
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
89
92
|
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
90
93
|
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
91
|
-
def create_contact(phone:,
|
|
92
|
-
address: UNSET, idempotency_key: nil, timeout: nil)
|
|
94
|
+
def create_contact(phone:, lid: UNSET, name: UNSET, email: UNSET, document: UNSET,
|
|
95
|
+
document_type: UNSET, address: UNSET, idempotency_key: nil, timeout: nil)
|
|
93
96
|
payload = compact(
|
|
94
97
|
"phone" => phone,
|
|
98
|
+
"lid" => lid,
|
|
95
99
|
"name" => name,
|
|
96
100
|
"email" => email,
|
|
97
101
|
"document" => document,
|
|
@@ -107,23 +111,36 @@ module Bzapper
|
|
|
107
111
|
|
|
108
112
|
# Import contacts in bulk. `POST /contacts/import`
|
|
109
113
|
#
|
|
110
|
-
# Upserts up to 1000 contacts by phone in one call.
|
|
111
|
-
#
|
|
112
|
-
#
|
|
114
|
+
# Upserts up to 1000 contacts by phone — or by WhatsApp LID — in one call. Each row's `phone`
|
|
115
|
+
# takes the number with country code OR the LID (`123456789012345@lid`): the API tells which one
|
|
116
|
+
# it is and stores it in the right place. A LID-only contact is addressed by the LID until its
|
|
117
|
+
# phone becomes known (on the first send, or when the person replies), when it gets the phone —
|
|
118
|
+
# or merges into the contact that already had it. A list of just numbers/LIDs with no name
|
|
119
|
+
# works: name and the rest fill in when the person replies. Top-level `tags` and `groups` apply
|
|
120
|
+
# to every row. A new contact is created with `source: import` and `status: pending_validation`;
|
|
121
|
+
# it can already receive campaigns, and becomes `active` when the person replies. An existing
|
|
122
|
+
# one has only its informed fields updated — a blank value never erases what is there. A
|
|
113
123
|
# suppressed/opted-out/blocked contact is reported in `skipped_rows` and never resurrected. Tags
|
|
114
124
|
# and groups are created on demand. A bad row is reported in `errors` and does NOT fail the rest
|
|
115
125
|
# of the call. `dry_run` validates everything and writes nothing.
|
|
116
126
|
#
|
|
117
127
|
# @param contacts [Array<Hash>] (corpo)
|
|
118
128
|
# @param dry_run [Boolean, nil] (corpo) Validates and reports without writing anything.
|
|
129
|
+
# @param tags [Array<String>, nil] (corpo) Tags applied to EVERY row (added to each row's own
|
|
130
|
+
# tags).
|
|
131
|
+
# @param groups [Array<String>, nil] (corpo) Groups applied to EVERY row (added to each row's
|
|
132
|
+
# own groups).
|
|
119
133
|
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
120
134
|
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
121
135
|
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
122
136
|
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
123
|
-
def import_contacts(contacts:, dry_run: UNSET,
|
|
137
|
+
def import_contacts(contacts:, dry_run: UNSET, tags: UNSET, groups: UNSET,
|
|
138
|
+
idempotency_key: nil, timeout: nil)
|
|
124
139
|
payload = compact(
|
|
125
140
|
"contacts" => contacts,
|
|
126
|
-
"dry_run" => dry_run
|
|
141
|
+
"dry_run" => dry_run,
|
|
142
|
+
"tags" => tags,
|
|
143
|
+
"groups" => groups
|
|
127
144
|
)
|
|
128
145
|
request("POST",
|
|
129
146
|
"/contacts/import",
|
data/lib/bzapper/version.rb
CHANGED