Commit 835e7d0f by softwhiskey8

добавил передачу json из dsl

1 parent 3846d45b
Showing with 10 additions and 7 deletions
...@@ -20,6 +20,7 @@ context { ...@@ -20,6 +20,7 @@ context {
output conversation_end: number = 0; output conversation_end: number = 0;
output channel_type: string = ""; output channel_type: string = "";
output mail: string = ""; output mail: string = "";
json: string[] = [];
} }
external function numbers_from_text(text: string): string; external function numbers_from_text(text: string): string;
...@@ -37,7 +38,7 @@ external function last_four(phone: string): string; ...@@ -37,7 +38,7 @@ external function last_four(phone: string): string;
external function hours_now(): number; external function hours_now(): number;
external function check_mobile_code(phone: string): boolean; external function check_mobile_code(phone: string): boolean;
external function countWords(message: string): number; external function countWords(message: string): number;
external function sendTelegram(): string; external function sendTelegram(phone: string, json: unknown): string;
external function sendTelegramChannel(channel_type: string, mail: string): string; external function sendTelegramChannel(channel_type: string, mail: string): string;
start node root start node root
...@@ -140,13 +141,13 @@ node tg ...@@ -140,13 +141,13 @@ node tg
set $channel_type = "Telegram"; set $channel_type = "Telegram";
external sendTelegramChannel($channel_type, ""); //отправка уведомления в канал external sendTelegramChannel($channel_type, ""); //отправка уведомления в канал
var message = { var message = {webinar: "Как продавать на маркетплейсах в 2022",
webinar: "Как продавать на маркетплейсах в 2022",
date: "11 июля", date: "11 июля",
promocode: "PROMO-CODE" promocode: "PROMO-CODE"
}; };
external sendTelegram(); //отправка личного сообщения //set $json = ["Как продавать на маркетплейсах в 2022","11 июля", "PROMO-CODE"];
external sendTelegram($caller, message); //отправка личного сообщения
} }
} }
} }
......
...@@ -140,9 +140,11 @@ async function main() { ...@@ -140,9 +140,11 @@ async function main() {
app.setExternal("sendTelegram", (args)=> { app.setExternal("sendTelegram", (args)=> {
var cmd = `cd /servers/constructor/htdocs/api/; php telegram-send.php `; var cmd = `cd /servers/constructor/htdocs/api/; php telegram-send.php `;
var tmp_json = `{webinar:\"Как продавать на маркетплейсах в 2022\",date:\"11 июля\",promocode:\"SAMLOH\"}`; //var tmp_json = `{webinar:\"Как продавать на маркетплейсах в 2022\",date:\"11 июля\",promocode:\"SAMLOH\"}`;
var tmp_json = args['json'];
var phone_number = args['phone'];
tmp_json = JSON.stringify(tmp_json); tmp_json = JSON.stringify(tmp_json);
cmd+= `${events_owner} ${preset_template_id} ${process.argv[2]} empty empty empty ${tmp_json}`; cmd+= `${events_owner} ${preset_template_id} ${phone_number} empty empty empty ${tmp_json}`;
exec(cmd); exec(cmd);
}); });
//функция отправки сообщений в канал //функция отправки сообщений в канал
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!