This repo sets up a simple nexmo application that will answer phone calls and accept user input, and respond according to the input
├── index.ts: defines the cdk stack
└── lambda: contains the lambda functions along with any dependencies.
│ This dir will be zipped and deployed to different lambdas with different handlers
├── answer.ts: called when a phone call is received to return the ncco
├── input.ts: called when a user makes an input, returns a new ncco based on input
└── voice-event.ts: called for generic events which don't have a specific handler
-
AWS CLI installed and configured with your account credentials
-
CDK & Typescript global install
npm i -g aws-cdk typescript
-
nexmo account, application credentials, and phone number https://dashboard.nexmo.com/voice/create-application
yarn
Copy the file .env-template
to .env
and replace variables with your nexmo credentials. Leave the variable ENDPOINT
for now, we'll get it from yarn deploy
output.
yarn watch
starts typescript compiler and watch for changesyarn deploy
deploys the CDK stack to your AWS account, this will output the gateway endpoint likeyou'll then copy this url (without the trailing slash) to yourOutputs: VAPIStack.VAPIGatewayEndpointXXXXX = https://{some-id}.execute-api.{region}.amazonaws.com/prod/
.env
file underENDPOINT
yarn setup
configures your nexmo app to use the AWS stack endpoint for webhooks