A simple way to send and verify verification code with SMS, Email, Telegram and etc.
- Send verify code.
- Verify a code.
- VerifyBotAuth.
- Telegram / VerifyBot (
telegram
orverifybot
) - SMS (Twilio,
sms
) - Email (
email
)
- Create a verify message and send it to the target.
const API_KEY = 'vm_gX9WwSdKatMNdpUClLU0IfCx575tvdoeQ';
const sdk = Verifyme.create(VerifymeOptions.builder().apiKey(API_KEY).build());
const request = CreateVerifyRequest.builder()
.provider(Provider.VerifyBot)
.target('YOUR-CHAT-ID')
.template('Your verification code is {{code}}')
.build();
const response = await sdk.send(request);
console.log('Request: ', request);
console.log('Response: ', response);
- Verify the message.
const request = VerifyMessageRequest.builder()
.token('5914b15eca02f53d5c0ae8f04a221c98c0813271346c2092021df56de9aa9fd4')
.code('1234')
.build();
const response = await sdk.verify(request);
console.log('Request: ', request);
console.log('Response: ', response);
- Create an auth state request with the target.
const API_KEY = 'vm_gX9WwSdKatMNdpUClLU0IfCx575tvdoeQ';
const sdk = Verifyme.create(VerifymeOptions.builder().apiKey(API_KEY).build());
const request: VerifyBotAuthCreate = {
target: '+855769995149',
type: 'telegram_bot',
};
const response = await sdk.botAuth().auth(request);
console.log('Request: ', request);
console.log('Response: ', response);
- Get the auth state.
const result = await sdk.botAuth().state(response.state!);
console.log('State: ', state);
console.log('Result: ', result);
- Sambo Chea [email protected]