# 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](/files/-M4XUkbnSGjPvQe9Z5Us)

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

If you choose to [open the in-app browser with **no predefined input**](/sdk-reference/react-native/react-native-sdk-verify-email-phone.md#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](/sdk-reference/react-native/react-native-sdk-verify-email-phone.md#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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cotter.app/sdk-reference/react-native/older-sdk-versions/sending-code-via-whatsapp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
