javascriptfirebasegoogle-cloud-firestorefirebase-extensionsmessagebird

Firebase MessageBird extension not sending SMS


I am not able to successfully process the sending of an sms through the firebase extension. Attached is the code of my js code to generate the document in the firestore collection, as well as the document created by the extension, where you can see the parameters received and the error. I have talked to messagebird support and they do not handle this error. The problem must be with firebase.

firestoredb.collection('messages').add({
  channelId: 'mychannelID',
  originator : 'Testing',
  recipients : ['34689454416'],
  type: 'sms',
  body : 'This is a test',
});

Firestore Document data and error:

Firestore Document data and error


Solution

  • If I look at the documentation for the Send Messages with MessageBird extension, they show the following code sample for sending a message:

     db.collection('YOUR_DOCUMENT_COLLECTION').add({
      channelId: 'YOUR_CHANNEL_ID',
      type: 'text',
      content: {
        text: 'YOUR_MESSAGE_CONTENT'
      },
      to: 'RECIPIENT_OF_THE_MESSAGE',
    });
    

    Based on that, it seems you need to specify the recipient(s) in a field named to, while you have field named recipients.