Integrate Twilio with Node.js - Send SMS and MMS, make phone calls and implement text-to-speech

Поделиться
HTML-код
  • Опубликовано: 18 окт 2024
  • In this video, we're gonna learn how to integrate Twilio with Node.js.
    We're gonna learn how to send SMS and MMS, make phone calls playing an audio file (.mp3) with a recorded message, send instructions using TwiML file (.xml) and implement text-to-speech in different languages.
    🔗 GitHub Repository:
    github.com/man...

Комментарии • 24

  • @mobiedit4848
    @mobiedit4848 Месяц назад +1

    Sir your content just ❤

  • @محمدبلفلاح
    @محمدبلفلاح 14 дней назад

    thanks, bro you save me time

  • @ishimweisaac1019
    @ishimweisaac1019 Месяц назад

    These bro's contents is on another level 🙌🏾. I subscribed and hit the bell to receive every video you uploaded since the day I found you on YT. Keep it up, we are here to support you. Bless.

    • @manfraio
      @manfraio  Месяц назад +1

      Thank you very much my friend.🤜🏻🤛🏻

  • @snacksports8188
    @snacksports8188 Месяц назад

    sir you are back 😇

    • @snacksports8188
      @snacksports8188 Месяц назад

      sir do you run a business, work a job, or do freelancing?

    • @manfraio
      @manfraio  Месяц назад

      @snacksports8188 I actually do all 3 lol. But I’m more focused on my job, which is backend with ai, and a little of frontend as well.

  • @motivationcolonel
    @motivationcolonel Месяц назад

    Love from Pakistan

  • @YTCFacts
    @YTCFacts Месяц назад

    TOP TOP TOP Thanks

  • @developersdiary1995
    @developersdiary1995 Месяц назад

    Nice content bro! I see that you always type Brazil, are you Brazilian as well?

    • @manfraio
      @manfraio  Месяц назад +1

      Obrigado meu amigo. Sou sim rsrs

    • @developersdiary1995
      @developersdiary1995 Месяц назад

      @@manfraio tem linkedin irmao??

    • @developersdiary1995
      @developersdiary1995 Месяц назад

      @@manfraio sou muito grato para esse video, vou precisar integrar o Twilio no meu micro-saas esse mes.

  • @blank_bow
    @blank_bow Месяц назад

    great

  • @blank_bow
    @blank_bow 26 дней назад

    can you please make videos on zustand, react-query, zod, react router and lastly how can we use them all together efficiently?

    • @manfraio
      @manfraio  25 дней назад

      Yes we have plans to add react, react native and next.js videos. We’re focusing more on backend for now but soon we’ll have full stack projects. Stay tuned!

  • @kirillbaryba746
    @kirillbaryba746 Месяц назад

    Thanks man, do you have experience how to send to WhatsApp or viber messages with twilio or maybe another service?

    • @manfraio
      @manfraio  Месяц назад +1

      For WhatsApp I recommend using their official API. There’s a video here o the channel explaining how to use WhatsApp API with Node.js.
      Integrate Whatsapp API with Node.js:
      ruclips.net/video/4cvQxqFZTIQ/видео.html

    • @kirillbaryba746
      @kirillbaryba746 Месяц назад

      @@manfraio 🤝 thanks a lot, bro

  • @SathishM-n8i
    @SathishM-n8i 26 дней назад

    can i give that say or play URL of audio as dynamically in between the call , I mean I want play URL of audio or say as Multiple Times with different data in single call

    • @manfraio
      @manfraio  26 дней назад

      Yes, you can use the say and play properties together multiple times on the call.

    • @SathishM-n8i
      @SathishM-n8i 26 дней назад

      @@manfraio i mean if user says 'hi' in call I want to play some relevant audio on ongoing call , is it possible ?

    • @manfraio
      @manfraio  26 дней назад

      Here is an example of how to make an outbound call using Twilio, wait for the user to say something, and then respond accordingly by either playing an audio file or saying something:
      1. Create an endpoint to make the call and when the user answer, pass another endpoint to the url property to handle the answering:
      app.post('/make-call', async (req, res) => {
      const toNumber = req.body.to; // Get the user's number from the request
      try {
      const call = await client.calls.create({
      url: 'your_app_url/voice', // This won't work on localhost. To test locally you would have to use something like ngrok
      to: toNumber,
      from: 'YOUR_TWILIO_PHONE_NUMBER' // Your Twilio number
      });
      res.send(`Calling ${toNumber}...`);
      } catch (err) {
      console.error(err);
      res.status(500).send('Error making the call.');
      }
      });
      2. Create the endpoint to handle the response (the same endpoint you passed on the URL parameter on the make-call endpoint) :
      app.post('/voice', (req, res) => {
      const twimlResponse = new twilio.twiml.VoiceResponse();
      const gather = twimlResponse.gather({
      input: 'speech',
      speechTimeout: '3s', // Wait 3s for the user to say something
      action: '/process-speech', // This won't work locally as well. Use something like ngrok
      method: 'POST', // Method from the /process-speech endpoint passed above on the action attribute
      });
      gather.say('Please say something to continue.');
      // If no speech is detected, re-prompt
      twimlResponse.say('I did not hear anything. Please try again.');
      twimlResponse.redirect('/voice');
      res.type('text/xml');
      res.send(twimlResponse.toString());
      });
      3. Create the third endpoint to process the speech, that means handle whatever the user said:
      app.post('/process-speech', (req, res) => {
      const twimlResponse = new twilio.twiml.VoiceResponse();
      const speechResult = req.body.SpeechResult;
      // Check what the user said
      if (speechResult) {
      twimlResponse.say(`You said: ${speechResult}. Now playing audio.`);
      twimlResponse.play('www.example.com/path/to/your/audio.mp3'); // Replace with your audio file URL
      } else {
      twimlResponse.say('I did not recognize that. Please try again.');
      twimlResponse.redirect('/voice');
      }
      res.type('text/xml');
      res.send(twimlResponse.toString());
      });

    • @SathishM-n8i
      @SathishM-n8i 24 дня назад

      @@manfraio can you make a separate video about that