This package contains an adapter that communicates directly with the Facebook API, and translates messages to and from a standard format used by your bot.
Includes support for Facebook Handover Protocol.
PM> Install-Package Bot.Builder.Community.Adapters.Facebook
To authenticate the requests, you'll need to configure the Adapter with the Verify Token, the App Secret and a Access Token.
You could create in the project an appsettings.json
file to set the Facebook credentials as follows:
{
"FacebookVerifyToken": "",
"FacebookAppSecret": "",
"FacebookAccessToken": ""
}
FacebookAdapter provides a translation layer for BotBuilder so that bot developers can connect to Facebook and have access to the Facebook API.
To add the Facebook Adapter to a bot, for example, an EchoBot
, in the Startup
class you should add:
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
// Create the Bot Framework Facebook Adapter.
services.AddSingleton<IBotFrameworkHttpAdapter, FacebookAdapter>();
// Create the bot as a transient. In this case the ASP Controller is expecting an IBot.
services.AddTransient<IBot, EchoBot>();
}