Sending 2 pics in Twilio API not working?...only single picture is coming across

114 views Asked by At

I am working with Twilio and their node.JS library. I am trying to send a message that includes 2 pics, ...shouldn't be very hard. Here is my code where message, from and recipient are defined earlier in the code.

To keep the example simple, I hard coded the array of images. There are images stored on Firebase storage. When I receive the message, only the first image is appearing...why aren't both images coming over??

 const messageSent = await client.messages.create({
            body: message,
            from: from,
            mediaUrl: [
              'https://firebasestorage.googleapis.com/v0/b/graceblocks-4efeb.appspot.com/o/customers%2Fschema_1%2Fmessages%2F196bb08c-c3f3-4b5f-aa69-45ea67961b17.png?alt=media&token=a7b37a8f-d1b5-4ed3-aa1f-60de206bcd16',
              'https://firebasestorage.googleapis.com/v0/b/graceblocks-4efeb.appspot.com/o/customers%2Fschema_1%2Fmessages%2F5fb598b6-62d9-4f5b-9d2c-dc5c7c958a01.png?alt=media&token=3bc0ca6e-5a54-4e00-b8a0-6fbd6ddc328b'
            ],
            to: recipient.number
          })
1

There are 1 answers

3
Alan On

it worked for me.

What version of the Twilio Node Helper Library are you using? I was using 3.54.0, https://github.com/twilio/twilio-node/blob/main/CHANGES.md/

My Code:


client.messages
  .create({
     body: 'This is the ship that made the Kessel Run in fourteen parsecs?',
     from: '+150930xxxxx',
     mediaUrl: ['https://firebasestorage.googleapis.com/v0/b/graceblocks-4efeb.appspot.com/o/customers%2Fschema_1%2Fmessages%2F196bb08c-c3f3-4b5f-aa69-45ea67961b17.png?alt=media&token=a7b37a8f-d1b5-4ed3-aa1f-60de206bcd16', 'https://firebasestorage.googleapis.com/v0/b/graceblocks-4efeb.appspot.com/o/customers%2Fschema_1%2Fmessages%2F5fb598b6-62d9-4f5b-9d2c-dc5c7c958a01.png?alt=media&token=3bc0ca6e-5a54-4e00-b8a0-6fbd6ddc328b'],
     to: '+147046xxxxx'
   })
  .then(message => console.log(message.sid))
  .catch(err => console.log(err.message));