Skip to content

Commit fce3823

Browse files
garyprettyEricDahlvangrvinothrajendranarafattehsinJustZeus
authored
Automated tests fix and adapter samples (#473)
* Swallow handoff events and suppport datetime (#404) * Swallow handoff events and suppport datetime Ensure handoff events handled by the handoff middleware are swallowed and not passed to the user. Update ServiceNow controller / middleware to handle datetimepicker. Update readme. * Fix link / multi link support and add card support * Update TokenExchangeSkillHandler tags and package info (#397) Fixes: #396 * Added TextRecognizer middlware compoent (#402) * Added TextRecognizer middlware compoent * Added readme file for TextRecognizer middleware * Updated readme.md file * Replace with Bot_Builder_Version tag * add it to the turn state and remove from conversation state * Updated read.md file * Add Sentiment Analysis Middleware Component (#400) * chore: update the SentimentAnalyzer reference for Sentiment Analysis Middleware * chore: add the Sentiment Analysis Middleware component * chore: modified the description. * Update README.md Add all the relevant details * chore: add solution file and fixed the null check * chore: add it to the turn state and remove from conversation state after discussing with SDK team Co-authored-by: Gary Pretty <gary@garypretty.co.uk> * ServiceNow Component Updates (#407) * Swallow handoff events and suppport datetime Ensure handoff events handled by the handoff middleware are swallowed and not passed to the user. Update ServiceNow controller / middleware to handle datetimepicker. Update readme. * Fix link / multi link support and add card support * Updates for images / carousels * Add Google Business Messaging Adapter Component (#408) * Add Google Business Messaging Component * Update project file and component registration * Add package icon * Include schemas in project * Add incoming message validation and partnerKey property * Change to UTF8 encoding in the body validation when requesting authorization (#439) * StreamReader overload to specify UTF8 encoding type StreamReader overload to UTF8 encoding type in order to have more compatibility with the character sets of other languages ​​apart from English. since this can generate incompatibility in certain cases such as in #435 * Change from ASCII to UTF8 encoding in _requestBodyByte Change from ASCII to UTF8 encoding type in the body request to have more compatibility with the character sets of other languages ​​apart from English. since this can generate incompatibility in certain cases such as in #435 * Include gifs in cards library readme (#431) Co-authored-by: Kyle Delaney <v-kydel@microsoft.com> * Update cards library sample dependencies (#430) Co-authored-by: Kyle <v-kydel@microsoft.com> * Added null conditional operators for default case and outputText Case to handle Null reference exception (#425) * Resolved the issue by adding text inside the hero card, changed item.header to display title for the single link response type. (#426) * Modifications made in the else part of picker case and boolean case to render the text within the hero card instead of separate message. (#424) * Limiting the number of buttons to 50 and cards to 10 that can be rendered in a Hero card carousel. (#423) * A new response type called OutPutHTML is released in the latest build. With this release, the rich text is not shown and line breaks are missing, displays as a plain text. (#428) * UI change to Incident card Keys/Titles like Short description to be bold in the card response type. (#422) * Added Multi select choice input (#420) * Added Multi select choice input * Create README.md * Document has updated * URL is not constructed properly (#427) * Checking for the takeControl flag along with the responseMessage.completed flag to hand over back the user to MS Bot (#421) * Removed unnecessary param in the payload (#429) * Removed unnecessary param in the payload * Revert "Removed unnecessary param in the payload" This reverts commit 4003a9f. * Removed unnecessary param in the payload * Fix for Ticket Details are truncating and not wrapping (#452) Co-authored-by: Palanikumar Ravichandran <palanikumar.ravic@hcl.com> * Update token exchange skill handler readme (#440) * Update readme.md * Update readme.md * Update readme.md Co-authored-by: Gary Pretty <gary@garypretty.co.uk> * Expire Conversation Trigger for Bot composer (#456) * Added expire conversation trigger * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md Co-authored-by: Gary Pretty <gary@garypretty.co.uk> * Bump RestSharp in /libraries/Bot.Builder.Community.Adapters.Zoom (#445) Bumps [RestSharp](https://github.com/restsharp/RestSharp) from 106.10.2-alpha.0.8 to 106.12.0. - [Release notes](https://github.com/restsharp/RestSharp/releases) - [Changelog](https://github.com/restsharp/RestSharp/blob/dev/releasenotes.md) - [Commits](https://github.com/restsharp/RestSharp/commits/106.12) --- updated-dependencies: - dependency-name: RestSharp dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Gary Pretty <gary@garypretty.co.uk> * Added custom Bot composer dialog Inputs (#457) * Added custom inputs * Added custom dialog inputs * Added custom dialog inputs Co-authored-by: Gary Pretty <gary@garypretty.co.uk> * Move Facebook, Slack, Twilio, Webex adapters (#461) * Copy Facebook Adapter * Delete schema files * Rename project file. * -Change namespace -Remove unused usings -Remove Microsoft copyright notice * Add README, project file, update solution * Add Slack, Twilio, Webex initial copy from MS repo * Slack - update namespace, remove MS copyright notice, remove ununsed usings * Twilio - update namespaces, remove MS copyright * Webex - update namespace, remove copyright * Remove schemas, icons * Add fully qualified name to Schema * Add Facebook, Slack, Twilio, Webex tests from MS repo * Update adapters tests * Update READMEs * Remove old project file * Remove old project files. * MessageBird adapter for BotComposer (#460) * MessageBird adapter for BotComposer * MessageBird adapter for BotComposer * MessageBird adapter for BotComposer * MessageBird adapter for BotComposer * Update BotBuilderCommunity.MessageBirdAdapter.schema Co-authored-by: Gary Pretty <gary@garypretty.co.uk> * Google adapter fix for Access Token (#463) Co-authored-by: Gary Pretty <gary@garypretty.co.uk> * MessageBird API New Request Verification Method and Breaking Changes (#467) * #466 * switch statement added, if/else blokcs are removed. * added caption support for MediaContent's like image, video, audio, file * fixed some unnecessary indentations * Changed sample , image caption and added Sample project to the solution file * fix content type for samples * added sample code to readme file * more fixing readme file * updating composer component to reflect the breaking changes of the adapter, NuGet tags and description * reverting a tag for NuGet * Move Samples for Facebook, Slack, Twilio, Webex adapters (#472) * Copy Facebook Adapter * Delete schema files * Rename project file. * -Change namespace -Remove unused usings -Remove Microsoft copyright notice * Add README, project file, update solution * Add Slack, Twilio, Webex initial copy from MS repo * Slack - update namespace, remove MS copyright notice, remove ununsed usings * Twilio - update namespaces, remove MS copyright * Webex - update namespace, remove copyright * Remove schemas, icons * Add fully qualified name to Schema * Add Facebook, Slack, Twilio, Webex tests from MS repo * Update adapters tests * Update READMEs * Remove old project file * Remove old project files. * Add Facebook, Twilio, Slack, Webex adapter samples. * Update namespaces, remove copyright notice, update adapter package references, update READMEs. * Update namespaces. * Update READMEs. * Update test projects target framework to netcoreapp3.1. Co-authored-by: Eric Dahlvang <erdahlva@microsoft.com> Co-authored-by: Vinoth Rajendran <r.vinoth@live.com> Co-authored-by: Arafat Tehsin <arafattehsin@hotmail.com> Co-authored-by: Ricardo Zamudio <46466785+JustZeus@users.noreply.github.com> Co-authored-by: Kyle Delaney <kyle_delaney@msn.com> Co-authored-by: Kyle Delaney <v-kydel@microsoft.com> Co-authored-by: Amit-singh96 <85606479+Amit-singh96@users.noreply.github.com> Co-authored-by: newlogics <30690070+newlogics@users.noreply.github.com> Co-authored-by: Palanikumar Ravichandran <palanikumar.ravic@hcl.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Monica Rivera <44449640+mrivera-ms@users.noreply.github.com> Co-authored-by: lauren-mills <lamil@microsoft.com> Co-authored-by: ahmetkocadogan <ahmetkocadogan@gmail.com>
1 parent f3b8498 commit fce3823

89 files changed

Lines changed: 6179 additions & 119 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Bot.Builder.Community.Samples.sln

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio Version 16
3-
VisualStudioVersion = 16.0.29318.209
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.0.32014.148
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Location Dialog Sample", "samples\Location Dialog Sample\Location Dialog Sample.csproj", "{10BEDE11-C9DE-4B67-9467-4E48272229C6}"
66
EndProject
@@ -34,6 +34,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFramework Storage Sam
3434
EndProject
3535
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ACS SMS Sample", "samples\ACS SMS Adapter Sample\ACS SMS Sample.csproj", "{6A0A707E-FB59-41C5-8ABA-9AF7A4B68ABF}"
3636
EndProject
37+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Facebook Adapter Sample", "samples\Facebook Adapter Sample\Facebook Adapter Sample.csproj", "{BD2D6ED0-0607-4460-B273-C249CD012514}"
38+
EndProject
39+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Slack Adapter Sample", "samples\Slack Adapter Sample\Slack Adapter Sample.csproj", "{5248D719-4773-4598-82B0-3E61FE5D239B}"
40+
EndProject
41+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Twilio Adapter Sample", "samples\Twilio Adapter Sample\Twilio Adapter Sample.csproj", "{755C476B-A901-413C-90C9-D71BC568DBD4}"
42+
EndProject
43+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Webex Adapter Sample", "samples\Webex Adapter Sample\Webex Adapter Sample.csproj", "{2857DBC8-A81A-480D-A7DA-44561B6F512E}"
44+
EndProject
45+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MessageBird Adapter Sample", "samples\MessageBird Adapter Sample\MessageBird Adapter Sample.csproj", "{46BA332B-3F41-4DDA-88C0-308AFDA84D88}"
46+
EndProject
3747
Global
3848
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3949
Debug|Any CPU = Debug|Any CPU
@@ -92,10 +102,6 @@ Global
92102
{272CCEF9-4DB1-4AC4-9616-CB6E4DDC436F}.Debug|Any CPU.Build.0 = Debug|Any CPU
93103
{272CCEF9-4DB1-4AC4-9616-CB6E4DDC436F}.Release|Any CPU.ActiveCfg = Release|Any CPU
94104
{272CCEF9-4DB1-4AC4-9616-CB6E4DDC436F}.Release|Any CPU.Build.0 = Release|Any CPU
95-
{BC01A8C4-3FEB-46E8-AE39-D71F5CB7602F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
96-
{BC01A8C4-3FEB-46E8-AE39-D71F5CB7602F}.Debug|Any CPU.Build.0 = Debug|Any CPU
97-
{BC01A8C4-3FEB-46E8-AE39-D71F5CB7602F}.Release|Any CPU.ActiveCfg = Release|Any CPU
98-
{BC01A8C4-3FEB-46E8-AE39-D71F5CB7602F}.Release|Any CPU.Build.0 = Release|Any CPU
99105
{FC26CCC4-9FBA-42F0-8EC9-46C55B6AB145}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
100106
{FC26CCC4-9FBA-42F0-8EC9-46C55B6AB145}.Debug|Any CPU.Build.0 = Debug|Any CPU
101107
{FC26CCC4-9FBA-42F0-8EC9-46C55B6AB145}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -108,6 +114,26 @@ Global
108114
{6A0A707E-FB59-41C5-8ABA-9AF7A4B68ABF}.Debug|Any CPU.Build.0 = Debug|Any CPU
109115
{6A0A707E-FB59-41C5-8ABA-9AF7A4B68ABF}.Release|Any CPU.ActiveCfg = Release|Any CPU
110116
{6A0A707E-FB59-41C5-8ABA-9AF7A4B68ABF}.Release|Any CPU.Build.0 = Release|Any CPU
117+
{46BA332B-3F41-4DDA-88C0-308AFDA84D88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
118+
{46BA332B-3F41-4DDA-88C0-308AFDA84D88}.Debug|Any CPU.Build.0 = Debug|Any CPU
119+
{46BA332B-3F41-4DDA-88C0-308AFDA84D88}.Release|Any CPU.ActiveCfg = Release|Any CPU
120+
{46BA332B-3F41-4DDA-88C0-308AFDA84D88}.Release|Any CPU.Build.0 = Release|Any CPU
121+
{BD2D6ED0-0607-4460-B273-C249CD012514}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
122+
{BD2D6ED0-0607-4460-B273-C249CD012514}.Debug|Any CPU.Build.0 = Debug|Any CPU
123+
{BD2D6ED0-0607-4460-B273-C249CD012514}.Release|Any CPU.ActiveCfg = Release|Any CPU
124+
{BD2D6ED0-0607-4460-B273-C249CD012514}.Release|Any CPU.Build.0 = Release|Any CPU
125+
{5248D719-4773-4598-82B0-3E61FE5D239B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
126+
{5248D719-4773-4598-82B0-3E61FE5D239B}.Debug|Any CPU.Build.0 = Debug|Any CPU
127+
{5248D719-4773-4598-82B0-3E61FE5D239B}.Release|Any CPU.ActiveCfg = Release|Any CPU
128+
{5248D719-4773-4598-82B0-3E61FE5D239B}.Release|Any CPU.Build.0 = Release|Any CPU
129+
{755C476B-A901-413C-90C9-D71BC568DBD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
130+
{755C476B-A901-413C-90C9-D71BC568DBD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
131+
{755C476B-A901-413C-90C9-D71BC568DBD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
132+
{755C476B-A901-413C-90C9-D71BC568DBD4}.Release|Any CPU.Build.0 = Release|Any CPU
133+
{2857DBC8-A81A-480D-A7DA-44561B6F512E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
134+
{2857DBC8-A81A-480D-A7DA-44561B6F512E}.Debug|Any CPU.Build.0 = Debug|Any CPU
135+
{2857DBC8-A81A-480D-A7DA-44561B6F512E}.Release|Any CPU.ActiveCfg = Release|Any CPU
136+
{2857DBC8-A81A-480D-A7DA-44561B6F512E}.Release|Any CPU.Build.0 = Release|Any CPU
111137
EndGlobalSection
112138
GlobalSection(SolutionProperties) = preSolution
113139
HideSolutionNode = FALSE

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ The following adapters can be used to expose your bot on additional channels not
8383
| ------ | ------ | ------ | ------ |
8484
| [Azure Communication Services SMS Adapter](libraries/Bot.Builder.Community.Adapters.ACS.SMS) | An adapter to integrate with Azure Communication Services to send / reveive SMS messages, including receiving delivery reports. | [Sample](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/master/samples/ACS%20SMS%20Adapter%20Sample) | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://www.nuget.org/packages/Bot.Builder.Community.Adapters.ACS.SMS/) |
8585
| [Alexa Adapter](libraries/Bot.Builder.Community.Adapters.Alexa) | An adapter to allow for Alexa Skills to be built using the Bot Builder SDK. Includes broad support for Alexa Skills capabilities, including devices with displays (Show / Spot), Alexa Cards, access to user profile data and the ability to send Progressive Responses. | [Sample](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/master/samples/Alexa%20Adapter%20Sample) | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://www.nuget.org/packages/Bot.Builder.Community.Adapters.Alexa/) |
86-
| [Facebook Adapter](libraries/Bot.Builder.Community.Adapters.Facebook) | An adapter that communicates directly with the Facebook API, and translates messages to and from a standard format used by a bot. Includes support for Facebook Handover Protocol. | | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://www.nuget.org/packages/Bot.Builder.Community.Adapters.Facebook/) |
86+
| [Facebook Adapter](libraries/Bot.Builder.Community.Adapters.Facebook) | An adapter that communicates directly with the Facebook API, and translates messages to and from a standard format used by a bot. Includes support for Facebook Handover Protocol. | [Sample](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/master/samples/Facebook%20Adapter%20Sample) | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://www.nuget.org/packages/Bot.Builder.Community.Adapters.Facebook/) |
8787
| [Google Actions SDK (latest) Adapter](libraries/Bot.Builder.Community.Adapters.ActionsSDK) | An adapter to allow for Google Actions to be built using the Bot Builder SDK via the latest Actions SDK (note: DialogFlow and legacy Actions SDK projects should use [this alternate adapter](libraries/Bot.Builder.Community.Adapters.Google). Includes broad support for Google Actions capabilities, including Cards and suggestion chips | [Sample](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/master/samples/Actions%20SDK%20Adapter%20Sample) | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://www.nuget.org/packages/Bot.Builder.Community.Adapters.Google/) |
8888
| [Google DialogFlow and legacy Actions SDK Adapter](libraries/Bot.Builder.Community.Adapters.Google) | This adapter supports integration with DialogFlow and legacy Actions SDK projects with the Bot Builder SDK. Includes broad support for Google Actions capabilities, including Cards and suggestion chips | [Sample](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/master/samples/Google%20Adapter%20Sample) | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://www.nuget.org/packages/Bot.Builder.Community.Adapters.Google/) |
89-
| [Slack Adapter](libraries/Bot.Builder.Community.Adapters.Slack) | An adapter that communicates directly with the Slack API, and translates messages to and from a standard format used by your bot. | | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://www.nuget.org/packages/Bot.Builder.Community.Adapters.Slack/) |
90-
| [Twilio Adapter](libraries/Bot.Builder.Community.Adapters.Twilio) | An adapter that communicates directly with the Twilio API, and translates messages to and from a standard format used by your bot. | | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://www.nuget.org/packages/Bot.Builder.Community.Adapters.Twilio/) |
89+
| [Slack Adapter](libraries/Bot.Builder.Community.Adapters.Slack) | An adapter that communicates directly with the Slack API, and translates messages to and from a standard format used by your bot. | [Sample](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/master/samples/Slack%20Adapter%20Sample) | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://www.nuget.org/packages/Bot.Builder.Community.Adapters.Slack/) |
90+
| [Twilio Adapter](libraries/Bot.Builder.Community.Adapters.Twilio) | An adapter that communicates directly with the Twilio API, and translates messages to and from a standard format used by your bot. | [Sample](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/master/samples/Twilio%20Adapter%20Sample) | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://www.nuget.org/packages/Bot.Builder.Community.Adapters.Twilio/) |
9191
| [Twitter Adapter](libraries/Bot.Builder.Community.Adapters.Twitter) | An adapter that integrates Twitter Direct Messages with the Bot Builder. The adapter sets up the required webhooks and responds to CRC requests. The webhooks code is based on the work by Tweety with modifications to support the Premium tier of the Account Activity API. | [Sample](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/master/samples/Twitter%20Adapter%20Sample) | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://www.nuget.org/packages/Bot.Builder.Community.Adapters.Twitter/) |
92-
| [Webex Adapter](libraries/Bot.Builder.Community.Adapters.Webex) | An adapter that communicates directly with the Webex Teams API, and translates messages to and from a standard format used by your bot. | | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://www.nuget.org/packages/Bot.Builder.Community.Adapters.Webex/) |
92+
| [Webex Adapter](libraries/Bot.Builder.Community.Adapters.Webex) | An adapter that communicates directly with the Webex Teams API, and translates messages to and from a standard format used by your bot. | [Sample](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/master/samples/Webex%20Adapter%20Sample) | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://www.nuget.org/packages/Bot.Builder.Community.Adapters.Webex/) |
9393
| [RingCentral Adapter](libraries/Bot.Builder.Community.Adapters.RingCentral) | An adapter that integrates the RingCentral Platform API with the Bot Builder. The adapter sets up the required webhooks and endpoints to RingCentral requests. Supporting features such as human handoff, activity publishing and WhatsApp support. | [Sample](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/master/samples/RingCentral%20Adapter%20Sample) | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://www.nuget.org/packages/Bot.Builder.Community.Adapters.RingCentral/) |
9494
| [Zoom Adapter](libraries/Bot.Builder.Community.Adapters.Zoom) | An adapter that accepts and handles Zoom app requests. Specifically developed to handle Zoom chatbot app requests and allow for the sending of messages using Zoom Message Templates. The adapter will also receieve any event subscribed to via Zoom, even those not chatbot related. | [Sample](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/develop/samples/Zoom%20Adapter%20Sample) | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://www.nuget.org/packages/Bot.Builder.Community.Adapters.Zoom/) |
9595
| [Infobip WhatsApp Adapter](libraries/Bot.Builder.Community.Adapters.Infobip.WhatsApp) | An adapter that accepts and hanldes WhatsApp app requests via Infobip, including support for various messages and template types. | | [![NuGet version](https://img.shields.io/badge/NuGet-blue.svg)](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/develop/libraries/Bot.Builder.Community.Adapters.Infobip.WhatsApp/) |

libraries/Bot.Builder.Community.Adapters.MessageBird/Bot.Builder.Community.Adapters.MessageBird.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
<PropertyGroup>
55
<TargetFramework>netstandard2.0</TargetFramework>
66
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
7-
<PackageTags>microsoft;bot;adapter;infobip;sms;botframework;botbuilder;bots</PackageTags>
8-
<PackageProjectUrl>https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/master/libraries/Bot.Builder.Community.Adapters.Infobip.MessageBird</PackageProjectUrl>
9-
<Description>Adapter for v4 of the Bot Builder .NET SDK to allow for a bot to be used for WhatsApp channel with MessageBird C# SDK.</Description>
7+
<PackageTags>microsoft;bot;adapter;messagebird;whatsapp;botframework;botbuilder;bots</PackageTags>
8+
<PackageProjectUrl>https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/master/libraries/Bot.Builder.Community.Adapters.MessageBird</PackageProjectUrl>
9+
<Description>Adapter for v4 of the Bot Builder .NET SDK for connecting bots with MessageBird WhatsApp communication channel.</Description>
1010
<RepositoryUrl>https://www.github.com/botbuildercommunity/botbuildercommunity-dotnet</RepositoryUrl>
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="MessageBird" Version="2.1.0" />
14+
<PackageReference Include="MessageBird" Version="3.2.0" />
1515
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="$(Bot_Builder_Version)" />
1616
</ItemGroup>
1717

libraries/Bot.Builder.Community.Adapters.MessageBird/MessageBirdAdapter.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,11 @@ public class MessageBirdAdapter : BotAdapter, IBotFrameworkHttpAdapter
3838
public MessageBirdAdapter(MessageBirdAdapterOptions options = null, ILogger logger = null)
3939
{
4040
_options = options ?? new MessageBirdAdapterOptions();
41+
4142
_logger = logger ?? NullLogger.Instance;
4243

43-
if (_options.UseWhatsAppSandbox)
44-
{
45-
_messageBirdClient = Client.CreateDefault(_options.AccessKey, features: new Client.Features[] { Client.Features.EnableWhatsAppSandboxConversations });
46-
}
47-
else
48-
{
49-
_messageBirdClient = Client.CreateDefault(_options.AccessKey);
50-
}
44+
_messageBirdClient = Client.CreateDefault(_options.AccessKey);
45+
5146
_requestAuthorization = new MessageBirdRequestAuthorization();
5247
}
5348

@@ -76,7 +71,7 @@ public async Task ProcessAsync(HttpRequest httpRequest, HttpResponse httpRespons
7671
body = await sr.ReadToEndAsync();
7772
}
7873

79-
if (!_requestAuthorization.Verify(httpRequest.Headers["Messagebird-Signature"], _options.SigningKey, httpRequest.Headers["Messagebird-Request-Timestamp"], body))
74+
if (!_requestAuthorization.VerifyJWT(httpRequest.Headers["MessageBird-Signature-JWT"], _options.SigningKey, body, _options.MessageBirdWebhookEndpointUrl))
8075
{
8176
httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized;
8277
return;
@@ -142,13 +137,10 @@ public override Task<ResourceResponse[]> SendActivitiesAsync(ITurnContext turnCo
142137
}
143138
}
144139
return Task.FromResult(new ResourceResponse[0]);
145-
146-
147140
}
148141
catch (Exception)
149142
{
150143
return Task.FromResult(new ResourceResponse[0]);
151-
152144
}
153145
}
154146
}

libraries/Bot.Builder.Community.Adapters.MessageBird/MessageBirdAdapterOptions.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,22 @@ public MessageBirdAdapterOptions()
1010

1111
}
1212
public MessageBirdAdapterOptions(IConfiguration configuration)
13-
: this(configuration["MessageBirdAccessKey"], configuration["MessageBirdSigningKey"], Convert.ToBoolean(configuration["MessageBirdUseWhatsAppSandbox"]))
13+
: this(configuration["MessageBirdAccessKey"], configuration["MessageBirdSigningKey"], configuration["MessageBirdWebhookEndpointUrl"])
1414
{ }
1515

16-
public MessageBirdAdapterOptions(string accessKey, string signingKey, bool useWhatsAppSandbox)
16+
public MessageBirdAdapterOptions(string accessKey, string signingKey, string messageBirdWebhookEndpointUrl)
1717
{
1818
AccessKey = accessKey;
1919
SigningKey = signingKey;
20-
UseWhatsAppSandbox = useWhatsAppSandbox;
20+
MessageBirdWebhookEndpointUrl = messageBirdWebhookEndpointUrl;
2121
}
2222

2323
public string AccessKey { get; set; }
2424

2525
public string SigningKey { get; set; }
2626

27+
public string MessageBirdWebhookEndpointUrl { get; set; }
28+
2729
public bool UseWhatsAppSandbox { get; set; }
2830
}
2931
}
Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using MessageBird;
2+
using MessageBird.Exceptions;
23
using MessageBird.Objects;
34
using System;
45
using System.Collections.Generic;
@@ -8,12 +9,32 @@ namespace Bot.Builder.Community.Adapters.MessageBird
89
{
910
public class MessageBirdRequestAuthorization
1011
{
11-
public bool Verify(string _messageBirdSignature, string _signingKey, string _timeStampt, string _requestBody)
12+
/// <summary>
13+
///
14+
/// </summary>
15+
/// <param name="_messageBirdRequestSignature">MessageBird-Signature-JWT header value of incoming request</param>
16+
/// <param name="_signingKey">your MessageBird signing key</param>
17+
/// <param name="_requestBody">incoming request body</param>
18+
/// <param name="_messageBirdWebhookEndpointUrl">your endpoint URL for MessageBird webhooks like https://yourdomain.com/api/messagebird</param>
19+
/// <returns></returns>
20+
public bool VerifyJWT(string _messageBirdRequestSignature, string _signingKey, string _requestBody, string _messageBirdWebhookEndpointUrl)
1221
{
13-
byte[] _requestBodyByte = Encoding.UTF8.GetBytes(_requestBody);
14-
var requestSigner = new RequestSigner(Encoding.ASCII.GetBytes(_signingKey));
15-
var request = new Request(_timeStampt, "", _requestBodyByte);
16-
return requestSigner.IsMatch(_messageBirdSignature, request);
22+
RequestValidator validator = new RequestValidator(_signingKey);
23+
24+
// requestSignature is the value of the 'MessageBird-Signature-JWT' HTTP header.
25+
string requestSignature = _messageBirdRequestSignature;
26+
string requestURL = _messageBirdWebhookEndpointUrl;
27+
byte[] requestBody = Encoding.UTF8.GetBytes(_requestBody);
28+
try
29+
{
30+
validator.ValidateSignature(requestSignature, requestURL, requestBody);
31+
return true;
32+
}
33+
catch (RequestValidationException e)
34+
{
35+
// The request is invalid, so respond accordingly.
36+
return false;
37+
}
1738
}
1839
}
1940
}

libraries/Bot.Builder.Community.Adapters.MessageBird/Models/MessageBirdWebhookPayload.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
using System.Collections.Generic;
33
using MessageBird.Objects.Conversations;
44
using System.Text;
5+
using System.Runtime.Serialization;
6+
using Newtonsoft.Json;
7+
58

69
namespace Bot.Builder.Community.Adapters.MessageBird.Models
710
{

0 commit comments

Comments
 (0)