Embedded Wallets
How to
Login

Whatsapp Login API

Using whatsapp login does not require you to interact with any register endpoint, because it automatically registers the user when they login with their whatsapp number.

⚠️

This endpoint is rate limited, you can only send 1 request per minute before you can send another request.

Overview

This API endpoint allows you to login to your Xellar Embedded wallet account using User’s whatsapp number.

  • HTTP Method: POST
  • Endpoint: /api/<VERSION>/auth/login-whatsapp

Request Body Parameters

  • phoneNumber (required): User’s chosen phone number for their whatsapp number.

Example Request Body

{
    "phoneNumber" : "65212232422"
}

Request

Request Headers

  • x-client-secret (required): Client secret which was generated when register in Xellar Embedded Wallet API Service Dashboard.

Example Request Syntax

cURL

curl -X POST -H "Content-Type: application/json" -H "x-client-secret: $YOUR_CLIENT_SECRET" -d '{
    "phoneNumber" : "65212232422"
}' <BASE_URL>/api/<VERSION>/auth/login-whatsapp

JavaScript Fetch

fetch("<BASE_URL>/api/<VERSION>/auth/login-whatsapp", {
	method: 'POST',
  headers: {
    'Content-Type': 'application/json',
		'x-client-secret': `${$YOUR_CLIENT_SECRET}`
  },
  body: JSON.stringify({
    "phoneNumber" : "65212232422"
	}),
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error));

Response

The response will include a JSON object with the following properties:

  • status (number): The HTTP status code of the response (e.g., 200 for success).
  • message (string): A message providing additional information about the operation.
  • data (object): An object containing the verifyToken and isWalletCreated indicating whether the user has created a wallet or not.

Example Response

{
    "status": 200,
    "message": "ok",
    "data": {
        "verifyToken": "eysjsfhsfh..",
        "isWalletCreated": false
    }
}