nOTP APIs
Overview
Using the nOTP (no-tee-pee) APIs requires two phases. The first phase involves calling the API endpoint to initiate the process (sign-up, sign-in, etc.), and the second phase involves passing the user the QR Code received from the first step.
When successfully executed, the first phase API endpoint will result in a QR Code image and a redirect URL in the response. Either display the QR Code to the user or redirect him to the URL. Once the user scans the code or is redirected, he will be prompt with WhatsaApp and an auto-filled message with a token will be populated. Once the user sends the message, the pending ref from the initial API call can be used to retrive the session.
Use Cases
- Sign up a new user
- Sign in an existing user
- Sign in with auto sign-up a new user if not exists
Examples
Example - user sign-up with QR Code
- Trigger the process with Sign-Up endpoint Once successfully completed - the QR Code will be returned in the response body under the "image" property and a "pendingRef" property.
- Display this image to the user. Once he scans it, and sends out the pre-filled message, he will be authenticated.
- Verify the state of the user with Get NoTP Pending Session endpoint, using the "pendingRef" from the first step.
Example - user sign-in with Redirect URL
- Trigger the process with the Sign-In endpoint Once successfully executed - the redirect url will be returned in the response body under the "redirectUrl" and a "pendingRef" property.
- Redirect the user to the redirect url provided from the first step. Once he sends out the pre-filled message, he will be authenticated.
- Verify the state of the user with Get NoTP Pending Session endpoint, using the "pendingRef" from the first step.
Note
This examples apply for all "Sign Up", "Sign in an existing user" and "Sign in with auto sign-up a new user if not exists" use cases, when using the relevant API endpoints.