title: Passing array or nested objects in body of request npm
body: <p>I have to send some parameters of String type along with one array in my body.
  But it throws me an error message:</p>
  
  <blockquote>
    <p>First argument must be String or buffer</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>var tokenList = JSON.parse(req.body.tokenList);
      var mobParams = {
          "tokens": tokenList,
          "profile": "&lt;myprofile&gt;",
          "notification": {
              "title": req.body.title,
              "message": req.body.text
          }
      };
  
       request({
          method: "POST",
          url: 'https://api.ionic.io/push/notifications',
          headers: {
              "content-type": "application/json",
              "authorization": "Bearer ********"
          },
  
          body: (mobParams)
  
       }, function(error, response, body){
          console.log('Ionic push error', error);
          console.log('IOnic push res', response);
          console.log('IOnic push body', body);
          if(!error){
              return res.send({
                  code: 1,
                  message: "success"
              });
          }else{
              return res.send({
                 code: 0,
                  message: error
              });
          }
  </code></pre>
  
  <p>How can I pass my array inside this object to request npm?</p>
  
  <p>Also, I would like to add that this implementation works pretty fine through front-end but I have separate codebase which requires me to hit multiple FCM requests i.e. in a loop. So I would be happy to have a solution as neither ionic push nor FCM push works </p>
  
  <p>For the FCM push I am trying the code below :</p>
  
  <pre><code>let desktopParams = {
                                          "notification": {
                                              "title": 'Merchant Portal Notifications',
                                              "body": req.body.text
                                              // "click_action" : action
                                          },
                                          "to": '/topics/' + topic
                                      };
                                       request({
                                          method: "POST",
                                          json: true,
                                          url: 'https://fcm.googleapis.com/fcm/send',
                                          headers: {
                                              "content-type": "application/json",
                                              "authorization": "key=****"
                                          },
                                          body: desktopParams
                                      }, function(error, response, body){
                      console.log('error', error);
                      console.log('response', response);
                      console.log('body', body);
  
  
                                          //return body;
                                      });
  </code></pre>