From 60ab9e898e7a7bdad34cd4cbe97bb75478c47188 Mon Sep 17 00:00:00 2001 From: Mike Gozzo Date: Thu, 9 Mar 2017 18:23:50 -0500 Subject: [PATCH] added linkToMessenger function --- lib/smoochApiBot.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/smoochApiBot.js b/lib/smoochApiBot.js index 105c020..5aae902 100644 --- a/lib/smoochApiBot.js +++ b/lib/smoochApiBot.js @@ -22,6 +22,21 @@ class SmoochApiBot extends Bot { }); return api.appUsers.sendMessage(this.userId, message); } + + linkToMessenger(text, page_id) { + const api = this.store.getApi(); + const linkUrl = 'https://m.me/' + page_id + '?ref=' + this.userId; + + let message = Object.assign({ + text, + actions: [{"type":'link', "text":'Send to Messenger', "uri":linkUrl}], + role: 'appMaker' + }, { + name: this.name, + avatarUrl: this.avatarUrl + }); + return api.appUsers.sendMessage(this.userId, message); + } } module.exports = SmoochApiBot;