export default (...input) => {
  if (_.isEmpty(input)) {
    return {};
  }

  const obj = {};

  _.each(input, (param) => {
    const decoded = decodeParams(param);

    if (_.isUndefined(decoded) === false) {
      if (_.has(obj, decoded.param)) {
        _.merge(obj[decoded.param], decoded.value);
      } else {
        obj[decoded.param] = decoded.value;
      }
    }
  });

  return obj;
};
  router.post('/webhook', (req, res) => {
    // If facebook sends us an empty body, we just ignore it.
    if (!req.body || _.isEmpty(req.body)) {
      return res.sendStatus(204);
    }

    const events = req.body.entry;
    _.forEach(events, (event) => {
      const pageId = event.id;
      const timestamp = event.time;

      const messages = event.messaging;
      _.forEach(messages, (message) => {
        const senderId = message.sender.id;

        const contents = message.message;
        if (contents && contents.text) {
          sendTextMessage(senderId, contents.text);
        }
      });
    });

    res.sendStatus(200);
  });