Embedded Wallets
How to
Login

Telegram API

Using the telegram login does not require you to interact with any register endpoint, because it automatically registers the user when they login with their telegram 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 telegram phone number.

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

Request Body Parameters

  • phoneNumber (required): User’s chosen phone number for their telegram 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-telegram

JavaScript Fetch

fetch("<BASE_URL>/api/<VERSION>/auth/login-telegram", {
	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 telegramBindingUrl if the user is not created wallet yet. telegramBindingUrl is the URL that user can click to bind their telegram account with the wallet for the first time

Example Response

{
    "status": 200,
    "message": "ok",
    "data": {
        "verifyToken": "eysjsfhsfh..",
        "isWalletCreated": false,
        "telegramBindingUrl": "https://t.me/bot_id?text=/start"
    }
}