Twilio API: Can't download the jpeg file in an MMS





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I've built an SMS/MMS Lightning Component in Salesforce that uses Twilio. (You don't need to know anything about Salesforce to answer this question.) I'm able to display incoming MMS images using the MediaUrl provided. For that, I just put the MediaUrl in the img tag in the markup. From there, if I right-click the image, I can save to my computer, and it defaults to the filename used when the file was sent.



Now, I want to add a button to save the image to Salesforce Files (ContentVersion object). To do that, I'm making an HTTP GET call, expecting to get back the data in mime-type image/jpeg -- but instead, I'm getting back this XML response:



<TwilioResponse>
<Media>
<Sid/>
<AccountSid>[myAccountSid]</AccountSid>
<ParentSid/>
<ContentType/>
<DateCreated>Tue, 20 Nov 2018 01:11:04 +0000</DateCreated>
<DateUpdated>Tue, 20 Nov 201801:11:04 +0000</DateUpdated>
<Uri>/2010-04-01/Accounts/[myAccountSid]/Messages/MM96803e1b66cf37deb1bcf044799dbf8c/Media/ME46739a78eb197409a4a031896a22cab7</Uri>
</Media>
</TwilioResponse>


The Twilio docs here say you can get the media in the original mime-type by not including the .xml or .json extension on the URL. I'm not including an extension, and I'm even specifying the image/jpeg mime-type in the header. But still, I get the xml.



So, I can't get the actual media, just xml (or json) data about the media. I saw another thread saying I need to use the Uri to access the data -- but the Uri returned is exactly the same URL I'm calling originally -- the MediaUrl provided when the MMS is received.



Second issue is... how can I get that original file name. The browser knows the file name (it appears by default if I right-click and select Save As...), but I can't see any way to access it through the Twilio API.










share|improve this question































    1















    I've built an SMS/MMS Lightning Component in Salesforce that uses Twilio. (You don't need to know anything about Salesforce to answer this question.) I'm able to display incoming MMS images using the MediaUrl provided. For that, I just put the MediaUrl in the img tag in the markup. From there, if I right-click the image, I can save to my computer, and it defaults to the filename used when the file was sent.



    Now, I want to add a button to save the image to Salesforce Files (ContentVersion object). To do that, I'm making an HTTP GET call, expecting to get back the data in mime-type image/jpeg -- but instead, I'm getting back this XML response:



    <TwilioResponse>
    <Media>
    <Sid/>
    <AccountSid>[myAccountSid]</AccountSid>
    <ParentSid/>
    <ContentType/>
    <DateCreated>Tue, 20 Nov 2018 01:11:04 +0000</DateCreated>
    <DateUpdated>Tue, 20 Nov 201801:11:04 +0000</DateUpdated>
    <Uri>/2010-04-01/Accounts/[myAccountSid]/Messages/MM96803e1b66cf37deb1bcf044799dbf8c/Media/ME46739a78eb197409a4a031896a22cab7</Uri>
    </Media>
    </TwilioResponse>


    The Twilio docs here say you can get the media in the original mime-type by not including the .xml or .json extension on the URL. I'm not including an extension, and I'm even specifying the image/jpeg mime-type in the header. But still, I get the xml.



    So, I can't get the actual media, just xml (or json) data about the media. I saw another thread saying I need to use the Uri to access the data -- but the Uri returned is exactly the same URL I'm calling originally -- the MediaUrl provided when the MMS is received.



    Second issue is... how can I get that original file name. The browser knows the file name (it appears by default if I right-click and select Save As...), but I can't see any way to access it through the Twilio API.










    share|improve this question



























      1












      1








      1








      I've built an SMS/MMS Lightning Component in Salesforce that uses Twilio. (You don't need to know anything about Salesforce to answer this question.) I'm able to display incoming MMS images using the MediaUrl provided. For that, I just put the MediaUrl in the img tag in the markup. From there, if I right-click the image, I can save to my computer, and it defaults to the filename used when the file was sent.



      Now, I want to add a button to save the image to Salesforce Files (ContentVersion object). To do that, I'm making an HTTP GET call, expecting to get back the data in mime-type image/jpeg -- but instead, I'm getting back this XML response:



      <TwilioResponse>
      <Media>
      <Sid/>
      <AccountSid>[myAccountSid]</AccountSid>
      <ParentSid/>
      <ContentType/>
      <DateCreated>Tue, 20 Nov 2018 01:11:04 +0000</DateCreated>
      <DateUpdated>Tue, 20 Nov 201801:11:04 +0000</DateUpdated>
      <Uri>/2010-04-01/Accounts/[myAccountSid]/Messages/MM96803e1b66cf37deb1bcf044799dbf8c/Media/ME46739a78eb197409a4a031896a22cab7</Uri>
      </Media>
      </TwilioResponse>


      The Twilio docs here say you can get the media in the original mime-type by not including the .xml or .json extension on the URL. I'm not including an extension, and I'm even specifying the image/jpeg mime-type in the header. But still, I get the xml.



      So, I can't get the actual media, just xml (or json) data about the media. I saw another thread saying I need to use the Uri to access the data -- but the Uri returned is exactly the same URL I'm calling originally -- the MediaUrl provided when the MMS is received.



      Second issue is... how can I get that original file name. The browser knows the file name (it appears by default if I right-click and select Save As...), but I can't see any way to access it through the Twilio API.










      share|improve this question
















      I've built an SMS/MMS Lightning Component in Salesforce that uses Twilio. (You don't need to know anything about Salesforce to answer this question.) I'm able to display incoming MMS images using the MediaUrl provided. For that, I just put the MediaUrl in the img tag in the markup. From there, if I right-click the image, I can save to my computer, and it defaults to the filename used when the file was sent.



      Now, I want to add a button to save the image to Salesforce Files (ContentVersion object). To do that, I'm making an HTTP GET call, expecting to get back the data in mime-type image/jpeg -- but instead, I'm getting back this XML response:



      <TwilioResponse>
      <Media>
      <Sid/>
      <AccountSid>[myAccountSid]</AccountSid>
      <ParentSid/>
      <ContentType/>
      <DateCreated>Tue, 20 Nov 2018 01:11:04 +0000</DateCreated>
      <DateUpdated>Tue, 20 Nov 201801:11:04 +0000</DateUpdated>
      <Uri>/2010-04-01/Accounts/[myAccountSid]/Messages/MM96803e1b66cf37deb1bcf044799dbf8c/Media/ME46739a78eb197409a4a031896a22cab7</Uri>
      </Media>
      </TwilioResponse>


      The Twilio docs here say you can get the media in the original mime-type by not including the .xml or .json extension on the URL. I'm not including an extension, and I'm even specifying the image/jpeg mime-type in the header. But still, I get the xml.



      So, I can't get the actual media, just xml (or json) data about the media. I saw another thread saying I need to use the Uri to access the data -- but the Uri returned is exactly the same URL I'm calling originally -- the MediaUrl provided when the MMS is received.



      Second issue is... how can I get that original file name. The browser knows the file name (it appears by default if I right-click and select Save As...), but I can't see any way to access it through the Twilio API.







      twilio twilio-api mms






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 26 '18 at 19:18







      PatMcClellan__c

















      asked Nov 25 '18 at 0:05









      PatMcClellan__cPatMcClellan__c

      1064




      1064
























          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53463518%2ftwilio-api-cant-download-the-jpeg-file-in-an-mms%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53463518%2ftwilio-api-cant-download-the-jpeg-file-in-an-mms%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Tangent Lines Diagram Along Smooth Curve

          Yusuf al-Mu'taman ibn Hud

          Zucchini