简体   繁体   English

我想在 twilio 中用短信发送语音,就像我们以前用普通电话发送一样

[英]I want to send voice in SMS in twilio just like we used to send in our regular phone

I want to send voice message by using twilio. I can send text sms by我想使用 twilio 发送语音消息。我可以通过以下方式发送短信

const messageResponse = await client.messages.create({
    body: req.body.message
      ? req.body.message
      : "This is auto generated message. Please do not reply.",
    from: "+16304XXXXXX",
    to: req.body.number ? req.body.number : "+91883XXXXXX",
  });
  console.log(`${messageResponse.to} : ${messageResponse.body}`);

this is for image in SMS这是用于 SMS 中的图像

const messageResponse = await client.messages.create({
    body: req.body.message
      ? req.body.message
      : "This is auto generated message. Please do not reply.",
      mediaUrl: "https://demo.twilio.com/owl.png",
    from: "+1630XXXXXXX",
    to: req.body.number ? req.body.number : "+918838XXXXXX",
  });
  console.log(`${messageResponse.to} : ${messageResponse.body}`);

but now I want to send voice in sms.但现在我想用短信发送语音。 Please help me Thank You请帮助我谢谢

All media types are sent the same way.所有媒体类型都以相同的方式发送。 They need to be hosted online, so they are publicly accessible without authentication.它们需要在线托管,因此无需身份验证即可公开访问。 The url is then passed in as one of the parameters to the API call, specifically MediaUrl.然后将 url 作为参数之一传递给 API 调用,特别是 MediaUrl。 Bare in mind the media needs to be of the accepted Mime types by Twilio https://www.twilio.com/docs/sms/accepted-mime-types#accepted-mime-types请记住,媒体需要是 Twilio https://www.twilio.com/docs/sms/accepted-mime-types#accepted-mime-types接受的 Mime 类型

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM