BTW here is the code suggested by chatgpt that I cannot get to work:
const accountSid = 'your_account_sid';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);
const fs = require('fs');
// Read the image file into a buffer
const imageBuffer = fs.readFileSync('/path/to/image.jpg');
// Encode the image buffer as base64
const base64Image = Buffer.from(imageBuffer).toString('base64');
// Create a data URI from the base64-encoded image
const dataUri = `data:image/jpeg;base64,${base64Image}`;
// Send an MMS message with the data URI as the media
client.messages
.create({
body: 'Check out this image!',
to: 'recipient_phone_number',
from: 'your_twilio_phone_number',
mediaUrl: dataUri,
})
.then(message => console.log(message.sid))
.catch(err => console.error(err));