Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

302
Views
Twilio Phone Calling - Fetch User's Keypad Input from a node.js application (not web server)
const args = message.content.split(' ')
const phNumber = args[1]
const ttsMessage = args.slice(2).join(' ')

            if (phNumber) {
                // Call phNumber and say ttsMessage and collect keypad input code
                const call = await TwilioClient.calls.create({
                    url: 'http://demo.twilio.com/docs/voice.xml',
                    to: phNumber,
                    from: process.env.TWILIO_PHONE_NUMBER,
                })
            }

           // somehow get the input the user entered and do something with it here. Maybe by using await or Promises etc...

I want to get the number the user entered and do some stuff with it!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

When you create a call resource in the Twilio API, it will initiate a phone call between the two numbers you specified, and also send a webhook request to the url you specified.

This url should point to your webserver where you can handle the webhook request and respond with TwiML instructions. These instructions are how you manage the phone call. One of the TwiML verbs is <Gather> where you can ask for input using DTMF (digits on the phone dialer) or voice.

The user response will be posted back to you with another webhook request, this time to the URL specified in the action attribute from the <Gather> verb.

You cannot provide TwiML instructions using the Twilio API or get the input back, you have to use webhooks.

It's not easy, but you technically could use a websocket connection (or some other way of communication) to connect your webhook server and your node.js app, so that your webhook server can stream the data to your node.js app, and your node.js app could send information back. This way you could exchange information from the call in realtime between the node.js app that created the call, and the webhook server that is managing the call.

I recommend checking out this tutorial on responding to phone calls using node.js.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!