> ## Documentation Index
> Fetch the complete documentation index at: https://docs.authsignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# WhatsApp OTP

> Implement WhatsApp OTP in your mobile apps using the Authsignal SDKs for iOS, Android, React Native, and Flutter.

<Info>
  All WhatsApp OTP SDK methods require you to [initiate an action
  first](/sdks/client/mobile/actions). Check out our [guide on WhatsApp
  authentication](/authentication-methods/whatsapp-otp) for more details.
</Info>

## Challenge

Start a WhatsApp OTP challenge by sending the user a WhatsApp message containing an OTP code.

<CodeGroup>
  ```swift iOS theme={null}
  await authsignal.whatsapp.challenge()
  ```

  ```kotlin Android theme={null}
  authsignal.whatsapp.challenge()
  ```

  ```ts React Native theme={null}
  await authsignal.whatsapp.challenge();
  ```

  ```dart Flutter theme={null}
  await authsignal.whatsapp.challenge();
  ```
</CodeGroup>

### Response

<ResponseField name="response" type="AuthsignalResponse<void>">
  <Expandable title="properties">
    <ResponseField name="error" type="string">
      An unstructured error description present if the SDK call encountered an error.
    </ResponseField>
  </Expandable>
</ResponseField>

## Verify

Finish re-authenticating a WhatsApp OTP authenticator by verifying the code submitted by the user.

<CodeGroup>
  ```swift iOS theme={null}
  let response = await authsignal.whatsapp.verify(code: "123456")

  let isVerified = response.isVerified
  ```

  ```kotlin Android theme={null}
  val response = authsignal.whatsapp.verify(code = "123456")

  val isVerified = response.isVerified
  ```

  ```ts React Native theme={null}
  const response = await authsignal.whatsapp.verify({ code: "123456" });

  const isVerified = response.isVerified;
  ```

  ```dart Flutter theme={null}
  final response = await authsignal.whatsapp.verify("123456");

  final isVerified = response.isVerified;
  ```
</CodeGroup>

### Parameters

<ResponseField name="code" type="string">
  The OTP code inputted by the user.
</ResponseField>

#### Response

<ResponseField name="response" type="AuthsignalResponse<VerifyResponse>">
  <Expandable title="properties">
    <ResponseField name="error" type="string">
      An unstructured error description present if the SDK call encountered an error.
    </ResponseField>
  </Expandable>

  <ResponseField name="data" type="VerifyResponse">
    <Expandable title="properties">
      <ResponseField name="isVerified" type="boolean" required>
        True if the verification was successful.
      </ResponseField>

      <ResponseField name="token" type="string">
        A token which can be used for [server-side
        validation](/sdks/server/challenges#validate-challenge).
      </ResponseField>

      <ResponseField name="failureReason" type="string">
        A structured code present if the verification failed due to user error. Possible values are:
        `CODE_INVALID_OR_EXPIRED` or `MAX_ATTEMPTS_EXCEEDED`.
      </ResponseField>
    </Expandable>
  </ResponseField>
</ResponseField>
