How to Send Pdf as MMS by Twilo Using Nodejs?

白昼怎懂夜的黑 提交于 2019-12-23 05:09:27

问题


I have a Test Twilio Number which is capable to send SMS,MMS,Voice Call . I am Successful in sending SMS and Voice call .

I am facing a challenge to send PDF as MMS .. As per the TwilioDocs Accepted-mime-types PDF is a Supported Type.

While am trying to Send by using the Syntax :-

var accountSid = '<accountSid >';   
var authToken = '<authToken>';       
var client = require('twilio')(accountSid, authToken);
         client.messages.create({
            to: "<validnum>",
            from: "<validFrom>",  
            body: "Test Message ",
            mediaUrl: "http://docdro.id/GAak2pV"
            mediaContentType:"pdf"
        }, function(err, message) {
            if(err){
                console.log('Error Alert For Message '+JSON.stringify(err));
            }else{
                console.log(message.sid);
            }
        });

With the Above Code i can able to send JPG/PNG but PDF is being Failed by an Error:-

(Error: 30008) Unknown error. None

I have no clue Totally !! Somebody help me with a Saving Suggestion Thanks, Prasad.


回答1:


Twilio developer evangelist here.

As Andy is pointing out in the comments, the URL to DropBox that you are using is actually pointing towards an HTML page that contains your PDF. You need the direct link to the PDF file itself, Twilio does not do any work to discover the PDF file within pages.

If you can host the file on S3, or anywhere else publicly, yourself then you will have more luck with this.



来源:https://stackoverflow.com/questions/43640496/how-to-send-pdf-as-mms-by-twilo-using-nodejs

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