adding sms ,one time password verifi.. of mobile number in wix contact form using third party https api

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:

  1. Display an input box ( so end user can provide his phone number )

  2. User clicks on Signup / Login button

  3. 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:

  4. Ask user to input OTP received

  5. 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:

  1. Display an input box ( so end user can provide his phone number )

  2. User clicks on Signup / Login button

  3. 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:

  4. Ask user to input OTP received

  5. 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

1 Like

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:

You will have to find out how to use the API from the tech support of the service provider.

Hi @thebigbookofwisdom

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. :grinning:

Regards,
Nithin

yeah i sure i will dm .

Did the 2Factor API Integration work?

Have same problem. @thrishtilabs can you help?

@thrishtilabs Hello, can you solve this. the fetch is not working in my project?

@thrishtilabs Hello, Can you please provide support for doing this API integration to our website. We want to add mobile number verification for login page as well.

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.

Hello, I have built wix store website, looking to add otp and sms notifications feature. Can anyone guide me through this?

I can help you guys out with the implementation @iamjakhan96 and @ankushilfs .

Thats great
How can we start?

Please note that according to the Forum Policies and Guidelines , it is not permitted to offer services for sale in the forum.

For those users who need coding assistance, it is possible to find expert developers on the Wix Marketplace an online marketplace with top Velo web developers from around the world.

@yisrael-wix : Sorry about that. Noted . Will adhere to the policy

@karthik666manjunath
I need help with this.
acharyagaur123 add at the rate Gmail dot com at the end.

Please do mail me. I cannot give you my contact details here.
I’ll give my contact details once you mail me.
acharyagaur123 at the rate Gmail dot com.