问题
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