# Aiuto automatico nella schermata di attivazione

`PUT /v1/branding`

Quando l'attivazione del tuo cliente fallisce con un codice di Meta che il nostro catalogo conosce —o il tuo cliente lo incolla sulla schermata—, la pagina stessa del link può dirgli subito **cosa è successo e cosa fare**: fino a 3 passi, con i link di Meta verificati, e un pulsante: **«Fatto, riprova»** se il link funziona ancora, o **«Chiedi un link nuovo a {il tuo marchio}»** se no.

**Tre modalità.** `off` (come sempre: la casella per raccontare cosa è successo), `brand` (con il tuo logo e il tuo nome) o `neutral` (senza marchio). Predefinita: `off`.

**Dove si sceglie.** Per tutti i tuoi link, `signupHelp` in `PUT /v1/branding` o nel pannello: **Impostazioni › Marchio › Aiuto automatico nella schermata di attivazione**. Per link, `signupHelp` in `POST /v1/onboarding-links` o `PATCH /v1/onboarding-links/{id}` (`null` = quella dell'account). Vince il link; se non dice niente, l'account; altrimenti `off`.

**Cosa ti arriva.** `onboarding.help_requested` porta `shownToClient` e `shownHelp` (modalità, titolo, passi): sai cosa ha visto il tuo cliente. `GET /v1/onboarding-links/{id}` porta `signupHelpShown` con `connectedAfter`: se si è collegato dopo averlo visto.

## Esempi

### cURL

```bash
# 1) for every link of the account (default "off")
curl -X PUT https://api.waiaconnect.com/v1/branding \
  -H "Authorization: Bearer wc_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"signupHelp": "brand"}'

# 2) or per link ("neutral" = no brand; null = the account's)
curl -X POST https://api.waiaconnect.com/v1/onboarding-links \
  -H "Authorization: Bearer wc_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"externalId": "pharmacy-42", "signupHelp": "neutral", "historyDelivery": false}'

# 3) did your customer see it, and did they connect after?
curl https://api.waiaconnect.com/v1/onboarding-links/onb_… -H "Authorization: Bearer wc_live_YOUR_API_KEY"
# → { "link": { "signupHelpEffective": "neutral",
#       "signupHelpShown": { "count": 1, "mode": "neutral", "connectedAfter": true, … } } }
```

### Node.js

```javascript
const H = { "Authorization": "Bearer wc_live_YOUR_API_KEY", "Content-Type": "application/json" };

// the account default (a link that sets "signupHelp" wins)
await fetch("https://api.waiaconnect.com/v1/branding", { method: "PUT", headers: H, body: JSON.stringify({ signupHelp: "brand" }) });

// or per link
const link = await (await fetch("https://api.waiaconnect.com/v1/onboarding-links", {
  method: "POST", headers: H,
  body: JSON.stringify({ externalId: "pharmacy-42", signupHelp: "neutral", historyDelivery: false })
})).json();

// later: what your customer saw
const { link: view } = await (await fetch(`https://api.waiaconnect.com/v1/onboarding-links/${link.publicId}`, { headers: H })).json();
console.log(view.signupHelpShown?.connectedAfter);
```

### PHP

```php
<?php
$h = ["Authorization: Bearer wc_live_YOUR_API_KEY", "Content-Type: application/json"];
$ch = curl_init("https://api.waiaconnect.com/v1/branding");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_HTTPHEADER => $h,
  CURLOPT_POSTFIELDS => json_encode(["signupHelp" => "brand"]),
]);
echo curl_exec($ch);
```

### Python

```python
import requests
H = {"Authorization": "Bearer wc_live_YOUR_API_KEY"}

# the account default (a link that sets "signupHelp" wins)
requests.put("https://api.waiaconnect.com/v1/branding", headers=H, json={"signupHelp": "brand"})

# or per link
link = requests.post("https://api.waiaconnect.com/v1/onboarding-links", headers=H,
                     json={"externalId": "pharmacy-42", "signupHelp": "neutral", "historyDelivery": False}).json()

# later: what your customer saw
view = requests.get(f"https://api.waiaconnect.com/v1/onboarding-links/{link['publicId']}", headers=H).json()["link"]
print((view["signupHelpShown"] or {}).get("connectedAfter"))
```

## Note

- Non si mostra mai una diagnosi dell'IA né un codice che il catalogo non conosce: per quelli resta la casella di sempre, e il caso ti arriva comunque.
- Se il problema è il limite dei codici di verifica, la schermata non offre di riprovare: ogni tentativo peggiora.
- Un valore diverso da `off`, `brand`, `neutral` o `null` dà `400 ONBOARDING_SIGNUP_HELP_INVALID`.
