Twilio 彩信发送本地文件 [英] Twilio MMS Send Local File

查看:50
本文介绍了Twilio 彩信发送本地文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以在 Salesforce 中使用 Twilio api 发送彩信.据我所知,使用该代码我可以在 Salesforce 中使用 Twilio 发送彩信.

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

发送彩信

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

但是我们需要传递媒体文件url是接缝.但是我们如何从本地机器上输入文件并使用 Twilio MMS 发送它们?

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?

推荐答案

Rajendra,你好!来自 Twilio 的 Megan 在这里.

Rajendra, hello! Megan from Twilio here.

这听起来类似于我在构建 这篇博文中的 OpenCV MMS 实现.

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

Python 中的示例,在将图像写入本地文件系统并对其进行所需修改后,我通过以下方式发送:

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)

处理以下 TwiML 的交付:

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

您将需要等效于 Flask 的 send_from_directory 来在您的实现中处理此问题.

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

希望这会有所帮助!

这篇关于Twilio 彩信发送本地文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆