Twilio MMS Send Local File

时光毁灭记忆、已成空白 提交于 2019-11-28 02:22:32

问题


We can send MMS using Twilio api in Salesforce. As i know that using that code i can send MMS using Twilio in Salesforce.

Sending a MMS

properties.add(new TwilioNameValuePair('MediaUrl','https://www.twilio.com/packages/company/img/logos_downloadable_round.png'));

But it's seams that we have need to pass media file url. But how can we take a input of file form Local machine and send them using Twilio MMS?


回答1:


Rajendra, hello! Megan from Twilio here.

This sounds similar to what I ran into building an OpenCV MMS implementation in this blog post.

The example there is in Python specifically, after writing an image to my local filesystem and making the desired modifications on it, I send it through:

@app.route('/uploads/<filename>', methods=['GET', 'POST'])
def uploaded_file(filename):
    return send_from_directory(UPLOAD_FOLDER,
                               filename)

which handles the delivery of the following TwiML:

 message.media('http://YourNgrokURL/uploads/{}'.format(filename))

You'll be needing the equivalent of Flask's send_from_directory to handle this in your implementation.

Hope this helps!



来源:https://stackoverflow.com/questions/36629693/twilio-mms-send-local-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!