Quick Start

  1. Create a Twilio account, load it with money and rent a phone number
  2. Store an authentication token in environment variables:
    export TWILIO_ACCOUNT_SID=ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    export TWILIO_AUTH_TOKEN=your_auth_token
    
  3. Configure your environment for either Google or Amazon’s transcription service
  4. Install and start ngrok
    npm install ngrok -g
    ngrok http 8080
    
  5. Run the tests
    # Local port that IVR Tester will listen on
    export LOCAL_SERVER_PORT=8080
    # URL that ngrok exposes to the outside world
    export PUBLIC_SERVER_URL=$(curl -s localhost:4040/api/tunnels | jq -r .tunnels[0].public_url)
    
    node test.js
    
const config = { transcriber: googleSpeechToText({ languageCode: "en-GB" }) };

new IvrTester(config).run(
  { from: "0123 456 789", to: "0123 123 123" },
  {
    name: "Customer is provided a menu after their account number confirmed",
    steps: [
      {
        whenPrompt: similarTo("Please enter your account number"),
        then: press("184748"),
        silenceAfterPrompt: 3000,
        timeout: 6000,
      },
      {
        whenPrompt: similarTo(
          "press 1 for booking a repair or 2 for changing your address"
        ),
        then: hangUp(),
        silenceAfterPrompt: 3000,
        timeout: 6000,
        },
     ],
  }
);

Commands

When Overview
contains Prompt contains a piece of text
matches Prompt matches regular expression
similarTo Prompt is similar to a piece of text
isAnything Prompt can be anything
Then Overview
press Produces DTMF tones
hangUp Terminates the call
doNothing Doesn’t do anything

Copyright © 2023 Lucas Woodward