0

I would like to explain a scenario. Our users can send voice note to our WhatsApp chatbot and we can grab the audio using the MediaUrl0 from the callback url. However, we want to be able to check if a previously submitted voice note is being forwarded again to our chatbot. Is there a way for us to determine if the voice note has been previously submitted?

From Twilio's callback, the MediaUrl0 is different for the same voice note.

For example, this is the url of original voicenote -

https://api.twilio.com/2010-04-01/Accounts/ACxxxxxxxxxxxx/Messages/MM3467ba9a036512d8afd474aaf7274d26/Media/MEfd990e8bbd8de74bc1dd63632f8a08fe

When this same voicenote is forwarded, the MediaUrl0 becomes -

https://api.twilio.com/2010-04-01/Accounts/ACxxxxxxxxxxxx/Messages/MMd5af70ae67c9971ec84ff45f4ba43a24/Media/MEa6f2534517236f810d19a49368e10671

As you can see, the URLs are different so its difficult for me to do a check.

shekwo
  • 1,411
  • 1
  • 20
  • 50
  • Is this question related with laravel tag? – STA Jun 17 '20 at 10:52
  • Curious if you run an MD5/SHA hash on the resulting media file, if they are the same. You could use that to determine if the file was the same. – Alan Jun 17 '20 at 11:17
  • @Alan any pointers on how to do this? – shekwo Jun 17 '20 at 13:37
  • I don't. There are different libraries for languages which can add hashing. Basically a hash takes in variable input and comes up with a fixed length output (hash). You can then compare the hash to see if the files are identical. If you have OS-X, you can take a look at this via terminal, running `shasum --help`. – Alan Jun 18 '20 at 11:34

0 Answers0