@botozap/sdk 0.5.0 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @botozap/sdk
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5ffc8f4: Cover the API additions of 2026-09-25:
8
+
9
+ - `Contact.display_name` (the name the business gives the contact, 1–200 characters; `null` when unset) and `display_name` on `CreateContactParams`/`UpdateContactParams` (`null` or `""` clears it). It is independent from `profile_name`, which comes from the channel.
10
+ - `phoneNumbers.update(id, { label })` is back: `PATCH /v1/phone_numbers/:id` now accepts the local `label` (up to 100 characters, no control characters; `null` or `""` clears). `PhoneNumber.label` is typed and `UpdatePhoneNumberParams` is exported.
11
+ - New `usage.metaCosts({ customer_id?, from?, to? })` for `GET /v1/usage/meta-costs` (scope `customers:read`), fully typed as `MetaCostReport` (per-currency `totals`, `by_day`, `by_category` with `cost`, `estimated_cost` and `cost_source`; `unavailable`/`unavailable_reason`, `estimate` and `sync`). Missing Meta cost stays `null`, never `0`.
12
+ - `Conversation` declares `entry_point` (`"ctwa" | "organic" | null`), `referral` (`ConversationReferral`: `source_id`, `source_url`, `headline`, `ctwa_clid`, `received_at`), `fep_expires_at` and `fep_reply_by`.
13
+
14
+ ## 0.6.0
15
+
16
+ ### Minor Changes
17
+
18
+ - 5e435ea: `Appointment.google_etag` and `Appointment.google_base_data` become optional and deprecated: they are internal Google Calendar sync data and the API stops sending them on 2026-10-26.
19
+
3
20
  ## 0.5.0
4
21
 
5
22
  ### Minor Changes
package/README.md CHANGED
@@ -231,12 +231,13 @@ O SDK cobre os recursos da API `/v1`:
231
231
  - `customers` — listar, buscar, criar, **atualizar**, **remover**, e **links de setup** (listar/criar/atualizar)
232
232
  - `templates` — listar, buscar, **criar**
233
233
  - `broadcasts` — criar, destinatários, agendar, enviar, cancelar
234
- - `contacts` — listar, buscar, criar, atualizar, remover
235
- - `conversations` — listar, buscar, atualizar, atribuições
234
+ - `contacts` — listar, buscar, criar, atualizar, remover; `display_name` é o nome que a empresa dá ao Contato (1–200 caracteres; `null` limpa), separado do `profile_name` que vem do canal
235
+ - `conversations` — listar, buscar, atualizar, atribuições; leituras trazem `entry_point` (`ctwa`/`organic`/`null`), `referral` do último clique em anúncio Click-to-WhatsApp, `fep_expires_at` (fim da janela grátis informado pela Meta) e `fep_reply_by` (estimativa do prazo para responder)
236
236
  - `webhooks` — CRUD e teste; `customer_id` opcional limita as entregas a um Cliente da Conta (`null` no update remove o filtro)
237
- - `phoneNumbers` — listar, buscar, remover, saúde (a rota de update não expõe campos editáveis, então o SDK não tem `phoneNumbers.update`)
237
+ - `phoneNumbers` — listar, buscar, **atualizar o `label`** (nome local, até 100 caracteres; `null` limpa), remover, saúde
238
238
  - `media` — subir arquivo (obter um media_id) e **buscar metadados + URL de download** de uma mídia recebida
239
239
  - `events` — reler inbound e mudanças de status pelo cursor durável da Conta/ambiente
240
+ - `usage` — `metaCosts`: custo aproximado da Meta por dia, categoria e moeda (Pricing Analytics), com estimativa por tarifa publicada onde a Meta não devolveu custo
240
241
  - `users`, `apiLogs`, `webhookDeliveries` — leitura
241
242
 
242
243
  Inbound e mudanças de status compartilham um stream crescente. Guarde
@@ -313,6 +314,11 @@ await boto.webhooks.create({
313
314
  customer_id, // opcional: só entregas deste Cliente (omitido = todos da Conta)
314
315
  });
315
316
  const { data: numeros } = await boto.phoneNumbers.list({ customer_id });
317
+ await boto.phoneNumbers.update(numeros[0]!.id, { label: "Recepção" });
318
+
319
+ // Custo da Meta (aproximado; a fatura da Meta é a autoridade). Custo ausente
320
+ // vem null, nunca 0 — veja `unavailable_reason` e `estimated_cost`.
321
+ const custos = await boto.usage.metaCosts({ customer_id, from: "2026-09-01", to: "2026-09-25" });
316
322
  ```
317
323
 
318
324
  ## Exemplos