# How to enroll a disposable with an OTP by WhatsApp

To enroll a lean disposable and send an OTP via WhatsApp you have to:

* specify the required **mobile** property in the [`DisposableContacts`](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/data-objects#disposablecontacts) object (E.164 format with `+` prefix)
* specify **`otpType=WHATSAPP`** in the [`DisposableCertificate`](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/data-objects#disposablecertificate) object


To use WHATSAPP as OTP the LRA has to be authorized. Verify with [`getLraCapabilities`](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/lean-otherapi/lean-lracapabilities-method) that `WHATSAPP` is present in `otp.allowed`.

Then use these methods:

* [`checkData`](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/lean-checkdata/lean-checkdata-method)/[`checkDataWitheIDAssertion`](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/lean-checkdata/lean-checkdata-eid-assertion-method) (optional) : check the validity of the objects passed to the enroll methods
* [`getDisposableContract`](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/lean-documents/lean-getdisposablecontract-method)/[`getDisposableContractWitheIDAssertion`](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/lean-documents/lean-getdisposablecontractwitheidassertion-method) (optional)
* an [**enroll** method](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/lean-enroll) : enroll the certificate
* [`sendOtp`](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/lean-send-otp/lean-sendotp-method) : send the OTP via WhatsApp
* `signPKCS1WithSHA256` in the FRA service or use SWS: sign the document
* [`uploadDoc`](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/lean-documents/lean-uploaddoc-method) to upload the evidence of the OTP or the authentication flow (optional)


## WhatsApp template configuration

The `templateId` and `language` must reference a pre-configured WhatsApp template.

The `whatsappOptions` object in [`sendOtp`](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/lean-send-otp/lean-sendotp-method) requires:

| Parameter | Type | Required | Description |
|  --- | --- | --- | --- |
| `templateId` | integer | Yes | Identifier of a pre-configured WhatsApp template. |
| `language` | string | Yes | ISO 3166-1 alpha-2 language code (`IT`, `EN`, `RO`, `DE`, `ES`). |
| `parameters` | array | Yes | List of template parameters. Must contain at least one element with key `text` and value `$OTP$` as placeholder for the OTP code. |


#### Request example


```json
{
  "certIdOtp": 123456,
  "deviceCode": "RHIDP123456",
  "whatsappOptions": {
    "templateId": 1,
    "language": "IT",
    "parameters": [{"text": "$OTP$"}]
  }
}
```

#### Validation rules

- `parameters` must not be empty or null
- `parameters` must contain at least one element with `$OTP$` placeholder
- If `templateId` does not match a configured template, the API returns error code 99 ("OTP was not sent")