This is a Somleng demo written in Next.js. It takes an input for a recipient's phone number and uses the Somleng Node.js helper library to send a call to the recipient, executing the TwiML provided in the configuration.
First, copy the example configuration:
cp .env-example .env
Then configure the environment variables as described below:
| Variable | Description | Example | Required |
|---|---|---|---|
| SOMLENG_ACCOUNT_SID | Somleng Account SID | change-me | true |
| SOMLENG_AUTH_TOKEN | Somleng Auth Token | change-me | true |
| FROM_PHONE_NUMBER | A configured phone number from your Somleng account | +85512345678 | true |
| TWIML | A valid TwiML document to be executed when the recipient answers the call | <Response><Say>Ahoy, World!</Say></Response> |
true |
| RECAPTCHA_SECRET_KEY | A Google reCAPTCHA secret key | change-me | true |
| NEXT_PUBLIC_RECAPTCHA_SITE_KEY | A Google reCAPTCHA site key | change-me | true |
| NEXT_PUBLIC_DEFAULT_COUNTRY | Default country to be selected for the phone number input | CA | true |
| NEXT_PUBLIC_COUNTRIES | A comma separated list of supported countries for the phone number input | US,CA | false |
npm run dev
# or
yarn dev
# or
pnpm devOpen http://localhost:3000 with your browser to see the result.
