async function convertToSlackMessage()

in cx/slack/server.js [67:95]


async function convertToSlackMessage(responses, channel_id) {
  let replies = [];

  for (let response of responses.queryResult.responseMessages) {
    let reply;

    switch (true) {
      case response.hasOwnProperty('text'): {
        reply = {channel: channel_id, text: response.text.text.join()};
      } break;

      /**
       * For information on the layouts for rich messages on Slack,
       * please visit https://api.slack.com/messaging/composing/layouts
       */
      case response.hasOwnProperty('payload'): {
        reply = await structProtoToJson(response.payload);
        reply['channel'] = channel_id;
      } break;

      default:
    }
    if (reply) {
      replies.push(reply);
    }
  }

  return replies;
}