API: Authorization
go back to the main page
For the Authorization module to work correctly, the site must send confirmation codes to the API URL, individually for each phone.
For example, your new user has decided to register on the site. After entering the phone number, the site should send the following data to the API URL:
- The client's phone number, in the format:
- 70000000000 (Russia);
- 994000000000 (Azerbaijan);
- 37400000000 (Armenia);
- 3750000000 (Belarus);
- 995000000000 (Georgia);
- 70000000000 (Kazakhstan);
- 996000000000 (Kyrgyzstan);
- 37300000000 (Moldova);
- 992000000000 (Tajikistan);
- 998000000000 (Uzbekistan);
- 380000000000 (Ukraine).
- Confirmation code, in the format: 9999 (4 digits);
- The bot's ID.
After receiving a positive response from the API, the site informs the user that he would receive a confirmation code in the Telegram bot, and then enter it in the field on the site.
The confirmation code for each number is saved for 24 hours and then deleted.
Variables in the API URL:
{api_key} - your API key from the Personal Data section;
{phone} - the client's phone number;
{code} - customer confirmation code;
{bot_id} - Bot ID.
Example of a successful response (JSON):
{“status”:1}
Example of an error response (JSON):
{“status”:0, “code”:24, “error":”API key specified incorrectly"}
Example of a PHP request:
$key = '9536b5ba8ad6c038209948d8c6b9ec47632d535e8b2457039b21582d4bae1fbd';
$phone = '79000000001';
$code = '1234';
$bot_id = 'S1-4321';
$r = file_get_contents('https://ityman.ru/api/activation?key='.$key.'&phone='.$phone.'&code='.$code.'&bot_id='.$bot_id);
$result = json_decode($r, true);
if($result['status'] != 1){
print 'Error: '.$result['error'];
}