I'm sending a message in twilio like so:
const client = require('twilio')(
process.env.TWILIO_ACCOUNT_SID,
process.env.TWILIO_AUTH_TOKEN,
);
app.post('/api/messages', (req, res) => {
res.header('Content-Type', 'application/json');
client.messages
.create({
from: process.env.TWILIO_PHONE_NUMBER,
to: '13105551212',
body: req.body.message,
mediaUrl: ['http://codesto.net/eadlapmesssaging.vcf'],
})
.then(() => {
res.send({ success: true });
})
.catch(err => {
console.log(err);
res.send({ success: false });
});
});
Since I'm sending a vcard I've read that I should set the "Content-Disposition". This is posted about here in the header. I can't find anywhere in the documentations where I would do that. I'm not even sure how to set the headers for a message. Any idea how I can do that?
the supported MIME types can be found here, Accepted Content Types for Media , you can set the MIME type returned by Express following along in this blog, Work with HTTP headers in Express and a similar process can be followed to set the Content-Disposition
header.
I personally found the representations of vcard's to be fiddly over MMS across different mobile devices.
Please share your experience once you get everything set-up.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.