in cx/telegram/server.js [54:86]
async function convertToTelegramMessage(responses, chatId) {
let replies = [];
for (let response of responses.queryResult.responseMessages) {
let reply;
switch (true) {
case response.hasOwnProperty('text'): {
reply = {chat_id: chatId, text: response.text.text.join()};
break;
};
/**
* The layout for the custom payload responses can be found in these
* sites: Buttons: https://core.telegram.org/bots/api#inlinekeyboardmarkup
* Photos: https://core.telegram.org/bots/api#sendphoto
* Voice Audios: https://core.telegram.org/bots/api#sendvoice
*/
case response.hasOwnProperty('payload'): {
reply = await structProtoToJson(response.payload);
reply['chat_id'] = chatId;
break;
};
default:
};
if (reply) {
replies.push(reply);
};
}
return replies;
}