BotBuilderCommunity/botbuilder-community-dotnet

MessageBird component doesnt work with Functions

saikumaru opened this issue · 14 comments

I am able to see the request comes into the endpoint of the bot, i.e. /api/messagebird.
I do see its returned a 200 OK status.

Referred docs- https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/develop/libraries/Bot.Builder.Community.Adapters.MessageBird

Reproduction steps: I executed the same steps as above doc, but for Azure Function+C#+Emptybot.

@ahmetkocadogan - please let me know what I need to modify to get it working?

Additionally, I also tried using the adapter, but it fails at "MessageBirdAdapterWithErrorHandler.cs", due to Messagebird client referring null keys. Which should be something to do with DI in Azure functions?

Hello @saikumaru

Does your Client ID for WhatsApp channel contains "-" character ?

Hi @ahmetkocadogan - yes, it does. However I was testing this with the Sandbox.

Hi @saikumaru

Well there was an issue with sandbox when we use MessageBird library version 3, i am not sure if it is resolved or not. Is it possible for you to try with a production channel instead of sandbox?

Also i have a PR merged into develop branch but haven't been released yet, which solves an issue with channel id's that contains "-" character.

I am not sure which issue you are facing.

Sure, I will try the prod channel.

Would you mind sharing which approach works for you, when you replicate, with either of Prod channel or Sandbox?
(a) AZ Function C# + Messagebird Adapter
(b) AZ Function C# + Messagebird component
(c) Appservice C# + Messagebird Adapter
(d) Appservice C# + Messagebird component

@saikumaru hello.

I use App Service Windows and MessageBird Adapter, and i have two production bots working , I guess it is (c) :)

Also, for the channel id issue, you can take a look at this PR #477

This PR is merged but there is no release yet, so when you copy adapter from the repo, make sure you make the same changes as I did in this PR.

Thank you, I will give these a try today and update you.

@saikumaru hello.

Also, please take a look at this issue #378 (comment)

In production, you don't have an UI to configure your webhook endpoint. You need to do it with a request to MessageBird conversations API.

Thank you! Yes, I spent a while yesterday to realize it doesnt have a UI unlike the sandbox to configure the webhook.

I was in fact hoping there's already a method in the adapter which is creating these webhooks, since it already has the secrets it needs. May be it would be a good feature to add.

Well I wish i have a chat to talk about my adapter to make this kind of changes. I don't know how many people use it, what they want etc. With the interaction through issues, i guess me and 4 other people use it :)

By using Sandbox-
This is the error I get, by using the latest composer(AppService)+develop branch version of the adapter
Also, looks like the Messagebird keeps repeating its messag sending activity, as I received multiple requests on the bot.

image

Also, please let me know if your google mail has Google-chat enabled to talk about this.

@saikumaru hello.

Yeah, MessageBird API will send the webhook till it gets a 200 OK or timeout.

This looks like a JWT validation error. You need to check your app settings.

{
  "MessageBirdAccessKey": "access_key_that_you_obtained_from_messagebird",
  "MessageBirdSigningKey": "signing_key_that_you_obtained_from_messagebird",
  "MessageBirdWebhookEndpointUrl": "your_bot_endpoint_url_for_incoming_messagebird_requests"
}

Also, which version of the adapter are you using ?

I wasnt able to debug the adapter, so I replaced the package with the classes as per the develop branch

@saikumaru hello.

Yeah, MessageBird API will send the webhook till it gets a 200 OK or timeout.

This looks like a JWT validation error. You need to check your app settings.

{
  "MessageBirdAccessKey": "access_key_that_you_obtained_from_messagebird",
  "MessageBirdSigningKey": "signing_key_that_you_obtained_from_messagebird",
  "MessageBirdWebhookEndpointUrl": "your_bot_endpoint_url_for_incoming_messagebird_requests"
}

Also, which version of the adapter are you using ?

I am using the keys as I see on this page, https://dashboard.messagebird.com/en/developers/settings#

and

https://dashboard.messagebird.com/en/developers/access

MessageBirdWebhookEndpointUrl this should be the full url of your endpoint.

For example, your domain is saikumaru.azurewebsites.net and your endpoint is /api/messagebird, this parameter should be "https://saikumaru.azurewebsites.net/api/messagebird"

You can debug with ngrok, setup the ngrok and use that url for webhook, it should be fine.

Hello @saikumaru

We have a new release with fixes. You can try with adapter version 4.13.4 when you resolve your issue with your whatsapp number.

Please close this issue when you think your issue is resolved, or provide more info if it persists with adapter version 4.13.4.

Thanks.