botframework
Advanced tools
Comparing version 0.11.0 to 0.12.0
@@ -9,2 +9,3 @@ import { FacebookServer, FacebookBot } from './facebook'; | ||
constructor(settings: IBotSettings, botController: IBotController); | ||
setWelcomeMessage(text: string): void; | ||
} |
@@ -14,2 +14,7 @@ "use strict"; | ||
} | ||
Bot.prototype.setWelcomeMessage = function (text) { | ||
if (!this.facebookServer) | ||
return; | ||
this.facebookServer.setWelcomeMessage(text); | ||
}; | ||
return Bot; | ||
@@ -16,0 +21,0 @@ }()); |
@@ -7,2 +7,3 @@ import { IBotSettings } from '../interfaces'; | ||
constructor(settings: IBotSettings, facebookBot: FacebookBot); | ||
setWelcomeMessage(text: string): void; | ||
private startWebServer(); | ||
@@ -9,0 +10,0 @@ private receiveMessage(request, reply); |
@@ -18,2 +18,28 @@ "use strict"; | ||
} | ||
FacebookServer.prototype.setWelcomeMessage = function (text) { | ||
request.post({ | ||
url: BASE_API + "/" + this.settings.fb.page_id + "/thread_settings?access_token=" + this.settings.fb.access_token, | ||
body: { | ||
setting_type: "call_to_actions", | ||
thread_state: "new_thread", | ||
call_to_actions: [ | ||
{ | ||
message: { | ||
text: text | ||
} | ||
} | ||
] | ||
}, | ||
json: true | ||
}, function (err, res, body) { | ||
if (err) { | ||
console.log('could not change fb new thread settings', JSON.stringify(err, null, 2)); | ||
throw err; | ||
} | ||
if (res.statusCode >= 400) { | ||
throw new Error("Error connecting to fb " + JSON.stringify(res)); | ||
} | ||
console.log('changed fb new thread settings'); | ||
}); | ||
}; | ||
FacebookServer.prototype.startWebServer = function () { | ||
@@ -20,0 +46,0 @@ var server = new hapi_1.Server(); |
{ | ||
"name": "botframework", | ||
"version": "0.11.0", | ||
"version": "0.12.0", | ||
"description": "Framework for messaging bots", | ||
@@ -5,0 +5,0 @@ "main": "./dist/es5/src/bot.js", |
@@ -90,2 +90,3 @@ [![Build Status](https://travis-ci.org/amitevski/botframework.svg?branch=master)](https://travis-ci.org/amitevski/botframework) | ||
var bot = new Bot(botSettings, new BotController()); | ||
bot.setWelcomeMessage(' | ||
``` | ||
@@ -92,0 +93,0 @@ |
@@ -13,2 +13,7 @@ import {FacebookServer, FacebookBot} from './facebook'; | ||
} | ||
setWelcomeMessage(text: string) { | ||
if (!this.facebookServer) return; | ||
this.facebookServer.setWelcomeMessage(text); | ||
} | ||
} |
@@ -26,2 +26,30 @@ import {IBotSettings} from '../interfaces'; | ||
public setWelcomeMessage(text: string) { | ||
request.post( | ||
{ | ||
url: `${BASE_API}/${this.settings.fb.page_id}/thread_settings?access_token=${this.settings.fb.access_token}`, | ||
body: { | ||
setting_type:"call_to_actions", | ||
thread_state:"new_thread", | ||
call_to_actions:[ | ||
{ | ||
message:{ | ||
text | ||
} | ||
} | ||
] | ||
}, | ||
json: true | ||
}, (err, res, body) => { | ||
if (err) { | ||
console.log('could not change fb new thread settings', JSON.stringify(err, null, 2)); | ||
throw err; | ||
} | ||
if (res.statusCode >= 400) { | ||
throw new Error(`Error connecting to fb ${JSON.stringify(res)}`); | ||
} | ||
console.log('changed fb new thread settings'); | ||
}); | ||
} | ||
private startWebServer() { | ||
@@ -28,0 +56,0 @@ let server = new Server(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
778927
15597
154