Cloudkibo / KiboPush

0 stars 1 forks source link

Investigate Twilio MMS APIs #10015

Closed ImranBinShoukat closed 4 years ago

ImranBinShoukat commented 4 years ago

This task is to investigate Twilio MMS APIs to send attachments.

ImranBinShoukat commented 4 years ago

I have looked into Twilio APIs. We can send the attachments in an SMS message using the mediaUrl field. We just need to set mediaUrl=[url of the attachment] and it will send the media.

List of supported mime types can be found here: https://www.twilio.com/docs/sms/accepted-mime-types

I tried testing this with some of the attachments and results were as follows:

  1. Image - sent successfully
  2. Audio - tried 1.1MB and 700Kb files but got error "size exceeds the limit". However in their documentation the limit is 5MB for MMS
  3. Video - tried 1.1MB and 168Kb files. Got the error "size exceeds limit" for 1.1MB file. 168Kb file was sent successfully.
  4. File - tried 199Kb pdf file and sent successfully

Conclusion: We can send attachments through Twilio API but I was not able to understand their "size exceeds limit" error.

jekram commented 4 years ago

Please go ahead and ask on the support channel.

Maybe the trail account has diff limit.

Let's go ahead and implement it.

What is the next step

ImranBinShoukat commented 4 years ago

Next step is to implement it and ask about the error from Twilio support

ImranBinShoukat commented 4 years ago

I have opened the ticket: https://www.twilio.com/console/support/tickets/5174562

Credentials: baqar@cloudkibo.com kibo123456789!

ImranBinShoukat commented 4 years ago

I have written the logic to send attachments as well through SMS chatbot. Assigning @AnishaChhatwani to test

ImranBinShoukat commented 4 years ago

Regarding the size limit exceeds issue, I got the following response from Twilio support:

Thank you for reaching out to Twilio support. My apologies for the delay getting back to you.

For sending files which are not image files - on top of the 5MB message size (Media+Text) there is also the file-size-limit imposed by the mobile provider to which you are sending the media message.

Please see this knowledge article for additional information on this size limit: https://support.twilio.com/hc/en-us/articles/360018832773-Twilio-Programmable-SMS-Supported-File-Types-and-Size-Limits-for-MMS-Media-Messages The recommendation is not to exceed 600KB when sending files which are not images)

I hope I was able to provide a bit more clarity. Please let me know if there is anything else I may be of assistance with

All the best Dana Schwartz The Twilio Support team

ImranBinShoukat commented 4 years ago

Task update:

jekram commented 4 years ago

Thanks for the update.

On point #2. We should inform the user about the limitations of MMS and encourage them to create separate Chatbot if the limitations do not work for them. or alternately we can two instances of this one for Whatsapp and MMS. Either way would work.

ImranBinShoukat commented 4 years ago

Currently, we are creating one chatbot record in the database. From the UI if a user creates a chatbot for platform SMS it creates a record in the database and same chatbot can be used for WhatsApp as well. This way user can use the one chatbot on both SMS and WhatsApp platform. But I am having issues putting the attachment limittations based on providers (e.g Twilio, FlockSend etc) for this.

One solution is to create different chatbot record for each platform. It means if a user creates a chatbot for SMS then he won't be able to use the same chatbot on WhatsApp. He can only use this chatbot on SMS. This way I will be able to put attachment limitations based on providers. But drawback will be that if user wants to use one chatbot on both SMS and WhatsApp, he won't be able to do it.

jekram commented 4 years ago

This is fine. Please go ahead.

ImranBinShoukat commented 4 years ago

Work on this task has been completed. Assigning @AnishaChhatwani to test

AnishaChhatwani commented 4 years ago

Working fine on staging

ImranBinShoukat commented 4 years ago

Please test on production as well

AnishaChhatwani commented 4 years ago

working fine on production