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;