Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Bot.Builder.Community.sln
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bot.Builder.Community.Compo
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bot.Builder.Community.Components.Trigger.ExpireConversation", "libraries\Bot.Builder.Community.Components.Trigger.ExpireConversation\Bot.Builder.Community.Components.Trigger.ExpireConversation.csproj", "{53DD5870-58AC-4B4E-9C12-16AA218EBFCE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bot.Builder.Community.Components.Adapters.MessageBird", "libraries\Bot.Builder.Community.Components.Adapters.MessageBird\Bot.Builder.Community.Components.Adapters.MessageBird.csproj", "{E438DC4C-670F-496A-AAB3-C800C78E0532}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bot.Builder.Community.Adapters.Facebook", "libraries\Bot.Builder.Community.Adapters.Facebook\Bot.Builder.Community.Adapters.Facebook.csproj", "{4DE48D05-D466-4AFA-861C-D1F72A0ADB90}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bot.Builder.Community.Adapters.Slack", "libraries\Bot.Builder.Community.Adapters.Slack\Bot.Builder.Community.Adapters.Slack.csproj", "{E449DA9D-62D9-474A-8C0A-6D0B7324D247}"
Expand Down Expand Up @@ -731,6 +733,14 @@ Global
{53DD5870-58AC-4B4E-9C12-16AA218EBFCE}.Documentation|Any CPU.Build.0 = Debug|Any CPU
{53DD5870-58AC-4B4E-9C12-16AA218EBFCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{53DD5870-58AC-4B4E-9C12-16AA218EBFCE}.Release|Any CPU.Build.0 = Release|Any CPU
{E438DC4C-670F-496A-AAB3-C800C78E0532}.Debug - NuGet Packages|Any CPU.ActiveCfg = Debug|Any CPU
{E438DC4C-670F-496A-AAB3-C800C78E0532}.Debug - NuGet Packages|Any CPU.Build.0 = Debug|Any CPU
{E438DC4C-670F-496A-AAB3-C800C78E0532}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E438DC4C-670F-496A-AAB3-C800C78E0532}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E438DC4C-670F-496A-AAB3-C800C78E0532}.Documentation|Any CPU.ActiveCfg = Debug|Any CPU
{E438DC4C-670F-496A-AAB3-C800C78E0532}.Documentation|Any CPU.Build.0 = Debug|Any CPU
{E438DC4C-670F-496A-AAB3-C800C78E0532}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E438DC4C-670F-496A-AAB3-C800C78E0532}.Release|Any CPU.Build.0 = Release|Any CPU
{4DE48D05-D466-4AFA-861C-D1F72A0ADB90}.Debug - NuGet Packages|Any CPU.ActiveCfg = Debug|Any CPU
{4DE48D05-D466-4AFA-861C-D1F72A0ADB90}.Debug - NuGet Packages|Any CPU.Build.0 = Debug|Any CPU
{4DE48D05-D466-4AFA-861C-D1F72A0ADB90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -874,6 +884,7 @@ Global
{55546728-AADE-4ED0-88AD-B517B915CD5D} = {1F7F4CAF-CF22-491F-840D-A63835726C12}
{56A89D8F-2CD5-439B-8E04-A7A6D9C7566C} = {1F7F4CAF-CF22-491F-840D-A63835726C12}
{53DD5870-58AC-4B4E-9C12-16AA218EBFCE} = {1F7F4CAF-CF22-491F-840D-A63835726C12}
{E438DC4C-670F-496A-AAB3-C800C78E0532} = {1F7F4CAF-CF22-491F-840D-A63835726C12}
{4DE48D05-D466-4AFA-861C-D1F72A0ADB90} = {BF310E8A-8DA1-441F-90E9-DE0E66553048}
{E449DA9D-62D9-474A-8C0A-6D0B7324D247} = {BF310E8A-8DA1-441F-90E9-DE0E66553048}
{8CBD9940-772C-495F-A54E-1B364C4774E2} = {BF310E8A-8DA1-441F-90E9-DE0E66553048}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class MessageBirdAdapter : BotAdapter, IBotFrameworkHttpAdapter

public MessageBirdAdapter(MessageBirdAdapterOptions options = null, ILogger logger = null)
{
_options = options ?? throw new ArgumentNullException(nameof(options));
_options = options ?? new MessageBirdAdapterOptions();
_logger = logger ?? NullLogger.Instance;

if (_options.UseWhatsAppSandbox)
Expand All @@ -50,7 +50,9 @@ public MessageBirdAdapter(MessageBirdAdapterOptions options = null, ILogger logg
}
_requestAuthorization = new MessageBirdRequestAuthorization();
}

Client _messageBirdClient;

public async Task ProcessAsync(HttpRequest httpRequest, HttpResponse httpResponse, IBot bot, CancellationToken cancellationToken = default)
{
if (httpRequest == null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Text;

namespace Bot.Builder.Community.Adapters.MessageBird
{
public class MessageBirdAdapterOptions
{
public MessageBirdAdapterOptions()
{

}
public MessageBirdAdapterOptions(IConfiguration configuration)
: this(configuration["MessageBirdAccessKey"], configuration["MessageBirdSigningKey"], Convert.ToBoolean(configuration["MessageBirdUseWhatsAppSandbox"]))
{ }
Expand All @@ -17,8 +19,11 @@ public MessageBirdAdapterOptions(string accessKey, string signingKey, bool useWh
SigningKey = signingKey;
UseWhatsAppSandbox = useWhatsAppSandbox;
}

public string AccessKey { get; set; }

public string SigningKey { get; set; }

public bool UseWhatsAppSandbox { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove('$(MSBuildThisFileDirectory)../', 'Bot.Builder.Community.sln'))\CommonTargets\library.shared.targets" />

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Description>Adapter component for v4 of the Bot Builder .NET SDK to allow for a bot to be used with MessageBird whatsapp.</Description>
<Authors>Bot Builder Community</Authors>
<Company>Bot Builder Community</Company>
<PackageLicenseUrl>https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/master/libraries/Bot.Builder.Community.Components.Adapters.MessageBird</PackageProjectUrl>
<Version>1.0.0</Version>
<FileVersion>1.0.0</FileVersion>
<AssemblyVersion>1.0.0</AssemblyVersion>
<PackageIcon>package-icon.png</PackageIcon>
<RepositoryUrl>https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/</RepositoryUrl>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<ContentTargetFolders>content</ContentTargetFolders>
<PackageTags>bots;ai;botframework;botbuilder;msbot-component;msbot-adapter</PackageTags>
<NoWarn>$(NoWarn);NU5104</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="$(Bot_Builder_Version)" />
<PackageReference Include="Microsoft.Bot.Builder" Version="$(Bot_Builder_Version)" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Bot.Builder.Community.Adapters.MessageBird\Bot.Builder.Community.Adapters.MessageBird.csproj" />
<ProjectReference Include="..\Bot.Builder.Community.Components.Shared\Bot.Builder.Community.Components.Shared.csproj" />
</ItemGroup>

<ItemGroup>
<Content Include="**/*.schema" />
<Content Include="**/*.uischema" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\package-icon.png" Link="package-icon.png">
<PackagePath></PackagePath>
<Pack>True</Pack>
</None>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Bot.Builder.Community.Adapters.MessageBird;
using Bot.Builder.Community.Components.Shared.Adapters;

namespace Bot.Builder.Community.Components.Adapters.MessageBird
{
public class MessageBirdBotComponent :
AdapterBotComponent<MessageBirdAdapter, MessageBirdAdapterOptions>
{

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Unofficial MessageBird WhatsApp Adapter for Bot Framework Composer


# Description

This is part of the [Bot Builder Community](https://github.com/botbuildercommunity) project which contains Bot Framework Components and other projects / packages for use with Bot Framework Composer and the Bot Builder .NET SDK v4.

The MessageBird WhatsApp adapter enables receiving and sending WhatsApp messages. The MessageBird adapter allows you to add an additional endpoint to your bot for receiving WhatsApp messages. The MessageBird endpoint can be used in conjunction with other channels meaning, for example, you can have a bot exposed on out of the box channels such as Facebook and Teams, but also via an MessageBird (as well as side by side with the Google/Twitter adapters also available from the Bot Builder Community Project).


The adapter currently supports the following scenarios:

* Send/receive messages with WhatsApp Sandbox
* Send/receive text messages
* Send/receive media messages (document, image, video, audio) - Supported formats for media message types available [here](https://developers.facebook.com/docs/whatsapp/api/media/#supported-files)
* Send/receive location messages
* Verification of incoming MessageBird requests (There is one issue for delivery report webhook verification, MessageBird team is investigating.)
* Receive delivery reports
* Full incoming request from MessageBird is added to the incoming activity as ChannelData

## Usage

- [Prerequisites](#Prerequisites)
- [Component Installation](#Component-installation-via-Composer-Package-Manager)
- [Configure the MessageBird connection in Composer](#Configuring-the-MessageBird-connection-in-Bot-Framework-Composer)
- [More Information](#More-Information)
### Prerequisites

- [Bot Framework Composer](https://dev.botframework.com/)

## Component installation via Composer Package Manager

1. Go to Package Manager (in the left hand navigation within Composer).

2. Within in Package Manager, search for an install the latest version of Bot.Builder.Community.Components.Adapters.MessageBird.

## Configuring the MessageBird connection in Bot Framework Composer

1. In Composer, go to your project settings. Within the 'Connections' tab, there should be a new entry called `MessageBird Connection`. Select `Configure` to configure the new connection.

![image](https://user-images.githubusercontent.com/16264167/150645167-fd69af6a-277a-47bf-b3ea-87cc90fb5d5c.png)


2. A modal will pop up. Fill the fields with the values

![image](https://user-images.githubusercontent.com/16264167/150645351-c45e011b-c353-4734-9bb7-aa9643ca6d76.png)


3. Once you close the modal, your connection should appear as configured in the bot settings.



## More Information
- [MessageBird](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/develop/libraries/Bot.Builder.Community.Adapters.MessageBird)

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://schemas.botframework.com/schemas/component/v1.0/component.schema",
"$role": "implements(Microsoft.IAdapter)",
"title": "MessageBird Connection",
"description": "Connects a bot to MessageBird WhatsApp.",
"type": "object",
"properties": {
"AccessKey": {
"type": "string",
"title": "Access Key",
"description": "Endpoint on which messages will be sent."
},
"SigningKey": {
"type": "string",
"title": "Signing Key",
"description": "Signing Key for requests authentication and authorization."
},
"UseWhatsAppSandbox": {
"type": "boolean",
"title": "UseWhatsAppSandbox",
"description": "Use WhatsApp Sandbox."
},
"route": {
"type": "string",
"title": "Route",
"description": "Optional route where the adapter is exposed.",
"default": "messagebird"
},
"type": {
"type": "string",
"title": "Type",
"description": "Adapter type.",
"default": "Bot.Builder.Community.Adapters.MessageBird.MessageBirdAdapter"
}
},
"required": [
"AccessKey",
"SigningKey",
"UseWhatsAppSandbox"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://schemas.botframework.com/schemas/ui/v1.0/ui.schema",
"form": {
"label": "MessageBirdAdapter connection",
"description": "Connects a bot to MessageBird whatsApp.",
"helpLink": "https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/blob/feature/packages-preview/libraries/Bot.Builder.Community.Adapters.Zoom/Component/README.md",
"order": [
"AccessKey",
"SigningKey",
"UseWhatsAppSandbox",
"*"
],
"hidden": [
"type"
]
}
}