-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Facebook, Slack, Webex adapters (#4214)
* Update Facebook, Slack, Webex adapters to follow pattern from Twilio adapter * Tweak exception messages
- Loading branch information
1 parent
abeab29
commit a6a1e92
Showing
20 changed files
with
382 additions
and
969 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 0 additions & 61 deletions
61
libraries/Adapters/Microsoft.Bot.Builder.Adapters.Facebook/FacebookAdapterOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,18 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Microsoft.Bot.Builder.Adapters.Facebook | ||
{ | ||
/// <summary> | ||
/// Options class for Facebook Adapter. | ||
/// </summary> | ||
public class FacebookAdapterOptions | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="FacebookAdapterOptions"/> class. | ||
/// </summary> | ||
/// <param name="verifyToken">The token used to validate that incoming webhooks are originated from Facebook.</param> | ||
/// <param name="appSecret">The app secret.</param> | ||
/// <param name="accessToken">The Facebook access token.</param> | ||
/// <param name="apiHost">A token for validating the origin of incoming webhooks.</param> | ||
/// <param name="apiVersion">A token for a bot to work on a single workspace.</param> | ||
public FacebookAdapterOptions(string verifyToken, string appSecret, string accessToken, string apiHost = "graph.facebook.com", string apiVersion = "v3.2") | ||
{ | ||
FacebookVerifyToken = verifyToken; | ||
FacebookAppSecret = appSecret; | ||
FacebookAccessToken = accessToken; | ||
FacebookApiHost = apiHost; | ||
FacebookApiVersion = apiVersion; | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the alternate root URL used to construct calls to Facebook's API. Defaults to "graph.facebook.com" but can be changed (for mocking, proxy, etc). | ||
/// </summary> | ||
/// <value>The API host.</value> | ||
public string FacebookApiHost { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the alternate API version used to construct calls to Facebook's API. Defaults to "v3.2". | ||
/// </summary> | ||
/// <value>The API version.</value> | ||
public string FacebookApiVersion { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the verify token used to initially create and verify the webhooks subscription settings on Facebook's developer portal. | ||
/// </summary> | ||
/// <value>The verify token.</value> | ||
public string FacebookVerifyToken { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the app secret from the **Basic Settings** page from your app's configuration in the Facebook developer portal. | ||
/// </summary> | ||
/// <value>The app secret.</value> | ||
public string FacebookAppSecret { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the access token. | ||
/// When bound to a single page, use `access_token` to specify the "page access token" provided in the Facebook developer portal's "Access Tokens" widget of the "Messenger Settings" page. | ||
/// </summary> | ||
/// <value>The access token.</value> | ||
public string FacebookAccessToken { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether incoming requests should be verified. | ||
/// Should be set to true in Production but can be set to false for testing or development purposes. | ||
/// </summary> | ||
/// <value>The flag to indicate if incoming requests should be verified.</value> | ||
public bool VerifyIncomingRequests { get; set; } = true; | ||
|
||
/// <summary> | ||
/// Throws a <see cref="NotImplementedException"/> exception in all cases. | ||
/// </summary> | ||
/// <param name="pageId">The page ID.</param> | ||
/// <returns>The access token for the page.</returns> | ||
public virtual Task<string> GetAccessTokenForPageAsync(string pageId) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
libraries/Adapters/Microsoft.Bot.Builder.Adapters.Facebook/FacebookClientWrapperOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Microsoft.Bot.Builder.Adapters.Facebook | ||
{ | ||
/// <summary> | ||
/// Options class for Facebook Adapter. | ||
/// </summary> | ||
public class FacebookClientWrapperOptions | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="FacebookClientWrapperOptions"/> class. | ||
/// </summary> | ||
/// <param name="verifyToken">The token used to validate that incoming webhooks are originated from Facebook.</param> | ||
/// <param name="appSecret">The app secret.</param> | ||
/// <param name="accessToken">The Facebook access token.</param> | ||
/// <param name="apiHost">A token for validating the origin of incoming webhooks.</param> | ||
/// <param name="apiVersion">A token for a bot to work on a single workspace.</param> | ||
public FacebookClientWrapperOptions(string verifyToken, string appSecret, string accessToken, string apiHost = "graph.facebook.com", string apiVersion = "v3.2") | ||
{ | ||
FacebookVerifyToken = verifyToken; | ||
FacebookAppSecret = appSecret; | ||
FacebookAccessToken = accessToken; | ||
FacebookApiHost = apiHost; | ||
FacebookApiVersion = apiVersion; | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the alternate root URL used to construct calls to Facebook's API. Defaults to "graph.facebook.com" but can be changed (for mocking, proxy, etc). | ||
/// </summary> | ||
/// <value>The API host.</value> | ||
public string FacebookApiHost { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the alternate API version used to construct calls to Facebook's API. Defaults to "v3.2". | ||
/// </summary> | ||
/// <value>The API version.</value> | ||
public string FacebookApiVersion { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the verify token used to initially create and verify the webhooks subscription settings on Facebook's developer portal. | ||
/// </summary> | ||
/// <value>The verify token.</value> | ||
public string FacebookVerifyToken { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the app secret from the **Basic Settings** page from your app's configuration in the Facebook developer portal. | ||
/// </summary> | ||
/// <value>The app secret.</value> | ||
public string FacebookAppSecret { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the access token. | ||
/// When bound to a single page, use `access_token` to specify the "page access token" provided in the Facebook developer portal's "Access Tokens" widget of the "Messenger Settings" page. | ||
/// </summary> | ||
/// <value>The access token.</value> | ||
public string FacebookAccessToken { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.