Installing the dependencies:
yarn install
# or
npm installenv file
USERNAME=your_africastalking_username
API_KEY=your_africastalking_api_key
CALLER_ID=your_verified_caller_id
PORT=3000
Starting the server:
node index.js
or
yarn run dev # development with nodemon
or
yarn start # productionserver will run on http://localhost:3000 or the port specified in the .env file.
POST /api/flash-call/initiate: Initiates a flash call to the specified phone number. Expects a JSON body with aphoneNumberfield.POST /api/flash-call/verify: Verifies the code entered by the user. Expects a JSON body withsessionIdandcodefields.
- User initiates a flash call by providing their phone number.
- The server generates a random 4-digit verification code.
- The server modifies the caller ID to include the verification code in the last 4 digits.
- The server makes a flash call to the user's phone number using Africa's Talking Voice API.
- The user sees the modified caller ID and notes the verification code.
- The user enters the verification code into the application.