如何在 WordPress PHP Twilio 中使用彩信回复入站短信

How to Reply to Inbound SMS with MMS in WordPress PHP Twilio

使用 WordPress PHP 和 Twilio,如何使用包含媒体的消息回复入站短信。具体来说,我想用图片回复入站消息。我找不到将媒体添加到响应的方法。如何将图像添加到下面使用的格式?

function trigger_receive_sms($request) {
  echo header('content-type: text/xml');
  echo ('<?xml version="1.0" encoding="UTF-8"?>');
  echo ('<Response>');
  echo ('<Message>Hello there, did you get the image?</Message>');
  echo ('</Response>');
}

将本指南用于整体基础:https://www.twilio.com/blog/2017/09/receive-sms-wordpress-php-plugin.html

此处为 Twilio 开发人员布道师。

要通过媒体做出回应,您需要 nest <Media> and <Body> elements in your <Message><Media> 应该 URL 给您要回复的媒体。

function trigger_receive_sms($request) {
  echo header('content-type: text/xml');
  echo ('<?xml version="1.0" encoding="UTF-8"?>');
  echo ('<Response>');
  echo ('  <Message>');
  echo ('    <Body>Hello there, did you get the image?</Body>');
  echo ('    <Media>https://demo.twilio.com/owl.png</Media>');
  echo ('  </Message>');
  echo ('</Response>');
}

如果有帮助请告诉我。