# Sending Code via WhatsApp

By default, when the user enters a phone number, we'll send a verification code using SMS. You can add the option for your users to receive the verification code as a WhatsApp message.

## How to Add the WhatsApp Option

![PhoneChannels options](https://107069962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0QGDMRD8y_Kd-BpOvT%2F-M4XUhBJ5Fe71GJEyBy4%2F-M4XUkbnSGjPvQe9Z5Us%2Fimage.png?alt=media\&token=b4c02e9e-0ebb-43fc-a9f8-042ed38b2d16)

### 1) Using **`verify.openAuth('PHONE')`**

If you choose to [open the in-app browser with **no predefined input**](https://docs.cotter.app/sdk-reference/react-native-sdk-verify-email-phone#step-2-call-cotters-verify-function) using where the user can enter email or phone in the in-app browser), update your code like below:

```javascript
class Register extends PureComponent {
  ...
  openCotterAuth = async () => {
    var verify = new Verify(...);
    
    await verify.openAuth(
      'PHONE', 
      ['SMS', 'WHATSAPP'], // 👈 Add ['SMS', 'WHATSAPP'] as a parameter
    );
  };
};
```

Possible options are:

* `['SMS']` (default, sms only)
* `['SMS', 'WHATSAPP']` (allow both)
* `['WHATSAPP']` (WhatsApp only)

### 2) Using **`verify.openAuthWithInput('PHONE', this.state.phone)`**

If you choose to [open the web browser **after the user entered their email or phone number in your app**'s](https://docs.cotter.app/sdk-reference/react-native-sdk-verify-email-phone#step-2-call-cotters-verify-function) input field, you can set it to **automatically send the verification code via WhatsApp:**

```javascript
class Register extends PureComponent {
  ...
  openCotterAuth = async () => {
    var verify = new Verify(...);
    await verify.openAuthWithInput(
      'PHONE', 
      this.state.phone, 
      'WHATSAPP', // 👈 'WHATSAPP' as a parameter to automatically send code via WhatsApp
    );
  };
  
  
  // Possible options are:
  // - 'SMS'                (default, send code via SMS)
  // - 'WHATSAPP'           (send code via WHATSAPP)
  ...
}
```

Possible options are:

* `'SMS'` (default, send code via SMS)
* `'WHATSAPP'` (send code via WhatsApp)

#### WhatsApp Opt-In Requirements

WhatsApp requires that your application implement explicit user opt-ins to deliver messages over WhatsApp.&#x20;

{% hint style="info" %}
⚠️[**Read WhatsApp Opt-In Requirements**](https://developers.facebook.com/docs/whatsapp/guides/opt-in/)
{% endhint %}

Since the in-app browser will *automatically send the code via WhatsApp*, **you need to** **inform your users that we will send a message to their WhatsApp account.** Make sure you make the following things clear:

* The phone number that will receive the message
* That the user does an action (press a button or a checkbox) to acknowledge that the code is sent via WhatsApp (show the WhatsApp logo, using assets and color from <https://whatsappbrand.com/>)
* If necessary, add a text explaining what message you'll be sending, for example:*"If you choose to login with WhatsApp, we will send a WhatsApp message to this number with a verification code".*

{% hint style="danger" %}
Please make sure that **your customer is informed that they will be receiving a WhatsApp message**, otherwise your application may be **suspended**. This includes using the appropriate language that your users can understand.
{% endhint %}
