English
English
Appearance
English
English
Appearance
/public/account/telegram/sessionStarts a new Telegram login session and returns a session token. Use the token to poll Get Session Telegram for the QR code the user scans with their phone.
Authorization: Basic Base64(AccessKey:SecretKey))This endpoint takes no parameters and no request body.
curl -X POST "https://api.repliz.com/public/account/telegram/session" \
-H "Authorization: Basic $(echo -n 'YOUR_ACCESS_KEY:YOUR_SECRET_KEY' | base64)"import axios from 'axios';
const response = await axios.post(
'https://api.repliz.com/public/account/telegram/session',
null,
{
auth: {
username: 'YOUR_ACCESS_KEY',
password: 'YOUR_SECRET_KEY',
},
},
);
console.log(response.data);const credentials = btoa('YOUR_ACCESS_KEY:YOUR_SECRET_KEY');
const response = await fetch(
'https://api.repliz.com/public/account/telegram/session',
{
method: 'POST',
headers: {
Authorization: `Basic ${credentials}`,
},
},
);
const data = await response.json();
console.log(data);{
"token": "a2ee814b0a49d6a55d07a73db97578387e1cb226e16f88715459c4935d0a0edfb5ead48bf964931758db4f476738766fc98bf0181672039791e2b92e1e77347c86fc5cab9f8051a3a8ebbdde7db3dee9"
}{
"code": 401,
"message": "unauthorized"
}The session expires if nobody scans the QR code within about three minutes. After that, every call with this token returns 404 session not found, so create a new session and start again.