Receive whatsapp voice message in Twilio - audio

I want to receive voice messages from whatsapp with Twilio. The native voice message you can record with the mic next to the text input.
When I send that message, I get the message in the webhook but it is empty and with no media.
I took a look at Twilio log of that message and it says that:
Twilio is unable to process the Content-Type of the provided URL. Please see the Twilio Markup XML Documentation for more information on valid Content-Types.
So it seems that Twilio for WhatsApp does not support Whatsapp native audio encoding.
Can anyone help me with this?
Thank you!

I received this answer from Twilio
Hi Gustavoā€¨ ,
Thanks for reaching out. Audio files are currently supported through WhatsApp, but
we discovered an issue with the way WhatsApp is passing the audio file
to us that is preventing these voice recordings from coming through.
WhatsApp has let us know this is something they will be addressing so
look for that to be addressed in the coming months.
Thanks,
Hope this helps everybody

It seems that native WhatsApp audio now works on Twilio. The parameter 'MediaUrl0' has the link to the audio, it is working for me

Related

How can I receive inbound text trough Twilio on monday?

I'm trying to use Twilio for Automated messages through Monday. unfortunately, I cannot figure out how to receive the inbound responses from customers, Can someone guide me if you've figured this out.
You can forward SMS messages from a Twilio number to your personal mobile number:
Forwarding SMS messages to another phone number
A more full featured blog to be able to send/receive is found here.
SMS Forwarding and Responding Using Twilio and JavaScript
You can also use Twilio Studio to drag/drop widgets on the Studio Canvas to easily do this.
All Studio Tutorials
-> https://www.twilio.com/docs/studio/tutorials/how-to-set-up-auto-responder

Playing an audio file when using Fulfillment with DialogueFlow

I'm editing the Cloud Functions for Firebase on the Fulfillment page on DialogFlow. I'm trying to respond to an Intent with an audio file playback. Specifically I'm targeting the Telephony integration.
I understand that a text message like
<speak><audio src="https://actions.google.com/sounds/v1/alarms/bugle_tune.ogg"></audio></speak>
Should play the audio.
But what is the interface to send it back so it would work?
Just using agent.add() doesn't seem to work (it reads the SSML string outloud)
You cannot use the client API library to do this at this time. You'll need to craft the JSON response yourself. Please see my answer here which should be helpful: DIalogflow Telephony integration is interpreting SSML response from webhook as normal text
Basically do the same but use TelephonyPlayAudio instead of TelephonySynthesizeSpeech.

sending direct messages from nodejs script to telegram

Is it possible to send a message from a node.js server to someone's mobile number or telegram Id directly?
is it possible without using a telegram bot?
I need an API like below:
function sendMessage(senderTelegramId, receiverTelegramId, messageText)
In short: No, without a bot no way for now.
Detailed explanation:
In order for you to send users messages on telegram you would need to create your own telegram bot. They have a well documented API which you can read and play around with.
There are 2 things you should know about sending messages to users using telegram bot:
You can't just send random people messages on telegram even if you know their phone number, to send them messages you need to have their chat_id. See how in the docs
To get the chat_id the user must first click the start button that comes up when they open your bot for the first time. Telegram will send you the chat id of that user and you save it for later when you would want to send messages to that user.
There are tons of libraries that makes working telegram bots very easy, it wouldn't take you more than an hour to get started.
I hope this answers the question, feel free to ask further questions, I have made some bots and you can also play around with them to see how it works.
Cheers )
There is actually one more easiest way to send a message to chat
just fetch the URL
https://api.telegram.org/bot[BOT_API_KEY]/sendMessage?chat_id=[MY_CHANNEL_NAME]&text=[MY_MESSAGE_TEXT]
you can find more details here
https://xabaras.medium.com/sending-a-message-to-a-telegram-channel-the-easy-way-eb0a0b32968

How to detect bot message/user message?

My FB-NodeJS-API prototype is not working correctly because my webhook is receiving the bot respond which is then sent to API.AI.
I need to set a condition where only a user's message should be received on the webhook request or only user's message should be sent to API.AI.
Can anyone advise me on this?
Can you explain the problem better? Please add the relevant code.
The bot response should go the user, not the webhook. The user input will come to the webhook.
I would suggest getting the bot to work without API.AI first and then adding support. My bot is in node.js so you may just want to jump to the source code.
For more information on setting up a bot see my article Facebook Bots for Fun and Profit
The example bot is DMS Software Bot
The source code is Github fb-robot

Twilio SMS reply in node.js

I'm writing a mobile notification system using twilio in node.js and I am currently able to send SMS messages to users. But I would like users to reply back with a response. I would need to gather the phone number the user sent the text from as well as the contents of the message (to query my mongoosedb)
I couldn't find much info on this so any help is appreciated.
Twilio evangelist here.
Check out this blog post which introduces you to our Node helper. If you scroll down to the section titled "Generating TwiML to handle inbound calls and SMS", it will walk you through receiving an SMS message from Twilio.
The basic idea is that when your user replies to your message, Twilio is going to tell you that by making an HTTP request to some URL that you have configured for your Twilio phone number. That URL is some endpoint that you have created in your Node app.
As part of that request, Twilio is going to pass some form parameters to you. In your going to use the request object that is passed into the POST function to get the parameters that Twilio passes you:
console.log(request.body.from);
console.log(request.body.to);
Heave over to this page on our website to see all of the parameters Twilio will send you when we
Hope that helps.

Resources