when visitor submits contact form ,and in that contact form there is field for mobile num.. after they enter no. in that field a third party sms api should trigger and another box should appear for them to enter the otp ,if they enter correct otp then only form should submit.
my goal is to just verify and force visitors of my site to enter correct mobile number , nothing else .
what to add , where to do write the code , please help me .
//this is the api of the third party sms service i will use//
Implementing OTP logic with 2Factor AUTOGEN endpoint
AUTOGEN endpoint generates OTP value at run time & sends it to the end user thereby eliminating need to Generate or Store OTP value at your end.
Sending OTP:
Display an input box ( so end user can provide his phone number )
User clicks on Signup / Login button
Your application invokes 2Factor's AUTOGEN API Endpoint
https:// 2factor . in/API/V1/{api_key}/SMS/+91{user's_phone_no}/AUTOGEN
Sample response:
{ "Status": "Success", "Details": "5D6EBEE6-EC04-4776-846D"}
Details value in above response corresponds to unique OTP session id.
Verifying OTP:
Ask user to input OTP received
Invoke 2Factor's VERIFY Endpoint to verify OTP entered by user
https:// 2factor .in/API/V1/{api_key}/SMS/VERIFY/{session_id}/{otp_entered_by_user}
Here session_id = Details value returned in SendOTP step
Sample Response:
{ "Status": "Success", "Details": "OTP Matched" }
If the response received from our API says 'OTP Matched', then you can mark the user as verified in your database Else ask user to Retry.
Implementing OTP logic with 2Factor MANUAL endpoint
MANUAL endpoint can be used if your application requires passing a custom OTP value ( OTP value generated locally ) & send it to the end. Your code may use RANDOM() function to generate a random string ( of 4-6 characters ) and pass it to the 2Factor's API
Sending OTP:
Display an input box ( so end user can provide his phone number )
User clicks on Signup / Login button
Your application invokes 2Factor's MANUAL API Endpoint
https:// 2factor .in/API/V1/{api_key}/SMS/+91{user's_phone_no}/{custom_otp_val}
Sample response:
{ "Status": "Success", "Details": "5D6EBEE6-EC04-4776-846D-3600422BD9EF"}
Details value in above response corresponds to a unique OTP session id.
You may store the OTP value in database or session variables locally for verification step performed later
Verifying OTP:
Ask user to input OTP received
As OTP was generated locally, you can verify it by comparing user's input value with the value stored in database / session variable in Send OTP Step OR Invoke 2Factor's VERIFY Endpoint to verify OTP entered by user
https:// 2factor .i n/API/V1/{api_key}/SMS/VERIFY/{session_id}/{otp_entered_by_user}
Here session_id = Details value returned in SendOTP step
Sample Response:
{ "Status": "Success", "Details": "OTP Matched" }
If the response received from our API says 'OTP Matched', then you can mark the user as verified in your database Else ask user to Retry.
this is the sms service i am using the link opens api docs
Thats great
How can we start?
I can help you guys out with the implementation @Junaid Ahmed Khan and @Ankush Singh .
Hello, I have built wix store website, looking to add otp and sms notifications feature. Can anyone guide me through this?
I'm late here. But I can help you guys. I've built a Wix app that helps stores with SMS - https://www.wix.com/app-market/abandoned-cart-order-updates
I could help you with the OTP verification piece. I can share my details here - if the problem still persists.
Have same problem. @Thrishti Labs can you help?
Hi @Ebrahim Siddiqui I like this OTP task using 2Factor. Read and try out yourself this week to use the links mentioned above and the API reference from 2Factor to implement it by yourself. If you are not able to do it, just let me know in DM. I don't guarantee anything but If you are not able to solve this by this weekend and don't have any deadlines for me I would like to try it out in my free time and implement it for you. Send me further details and a test account of 2Factor through DM if interested. 😀
Regards, Nithin
We are unable to provide full code solutions. Wix provides many resources to help users learn how to get the most out of Corvid.
Here is some information on how to interface with third party services:
https://www.wix.com/corvid/reference/wix-fetch.html
https://support.wix.com/en/article/corvid-accessing-third-party-services-with-the-fetch-api
https://support.wix.com/en/article/corvid-calling-server-side-code-from-the-front-end-with-web-modules
You will have to find out how to use the API from the tech support of the service provider.