How do you post multiple replies via webhook? [Facebook, DialogFlow]

Here is my json:

var messageData = {
    "recipient" : {
      "id": recipientId 
    },
    "message":  [
      {
          "text": 'Text 1'
      },
      {
          "text": 'Text2!'
     }
    ]
  }  

I send it through this function:

function callSendAPI(messageData) {
  request({
    uri: 'https://graph.facebook.com/v2.10/me/messages',
    qs: { access_token: my_PAGE_ACCESS_TOKEN },
    method: 'POST',
    json: messageData

  }, function (error, response, body) {
    if (!error && response.statusCode == 200) {
      var recipientId = body.recipient_id;
      var messageId = body.message_id;

      console.log("Successfully sent the message with id %s to recipient %s", 
        messageId, recipientId);
    } else {
      console.error("Unable to send message.");
      console.error(response);
      console.error(error);
    }
  });  
}

It shows me this error:

(#100) Must send either message or state'

Do you guys know what format for messageData should I use to send multiple messages? It works fine when I only send one that is not in an array.

Please help. :sob::sob: This works in Firebase webhook in DialogFlow, so I don’t know why it’s not working.

The messenger API docs don’t specify the ability to include multiple text entries in the message field: https://developers.facebook.com/docs/messenger-platform/reference/send-api/ I suggest using the success response from sending the first message to trigger sending the next message.

facebook does not allow multiple messages from bots.
You can only reply 1 message to 1 question from the user.
After 24 hrs, then you can post 1 message to a user without a user question.