Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The MessageBird adapter for WhatsApp does not work when using special Spanish characters #435

Closed
JustZeus opened this issue Jul 22, 2021 · 20 comments

Comments

@JustZeus
Copy link
Contributor

@ahmetkocadogan I appreciate your contributions very much! Thanks for maintaining this adapter

I have managed to use the MessageBird adapter for WhatsApp in a bot created using the composer bot, modifying the source code I made the adapter work properly with the Messagebird sandbox.

The problem is that the bot does not respond at all if I use words with special characters in Spanish such as Á, É, Í, Ó, Ú, and Ñ.

Will it have to do with the encoding at the time the adapter deserializes the JSON to convert it into a variable in C#?

@ahmetkocadogan
Copy link
Contributor

Hello @JustZeus . I am glad if this adapter is useful for you, thank you.

I need to debug and test this cituation to identify the couse, but i am in holiday and will be using a computer next monday. I wanted to let you know so you don't think i am not watching :)

I'll update this issue when i test and identify this issue as soon as i can.

Have a good day.

@ahmetkocadogan
Copy link
Contributor

ahmetkocadogan commented Jul 27, 2021

Hello @JustZeus

I tried the adapter with the letters you send in this issue, like below:

This is the bot sending those letters:

image

And looks like bot can send the letters without a problem.

image

This is i send those letters to bot and make it echo the message:

image

image

I am not an expert about hosting settings, but, can this be an issue with your hosting settings, language or region settings on the machine that you host the bot ?

@JustZeus
Copy link
Contributor Author

Hello! hope you had a great holiday, thank you very much for your support.

Oh, now I see that maybe is not because of the adapter, it could be the web server config instead.

The bot is hosted in an Azure Web App, I developed the bot using the bot framework composer application for windows, I started with the basic QnA template for C#. Then I modified the source code generated from the composer to add the message Bird Adapter and finally I published the bot using the composer's deployment tools

As you can see it only sends a response if I send a word without special characters, but in another channels like telegram and web chat it works fine.

now I'm clueless about the problem, ¿Any suggestions for debugging?

Thank you very much in advance : )

@ahmetkocadogan
Copy link
Contributor

Hello @JustZeus .

Since i can send and receive that special letters, i think you have one more option to try.

Run your bot project locally, setup ngrok, use ngrok url for webhook for WhatsApp sandbox, and type that letter in WhatsApp to the bot. Then inspect ngrok, you can see incoming network requests. If you don't see a webhook request is coming, then we can say it is MessageBird's API that does not transmit the message, if you see the request is coming, then we can say it is the adapter and maybe dive deeper.

And, is there any chance for you to try it in production (via a verified WhatsApp number), not with a WhatsApp sandbox?

@JustZeus
Copy link
Contributor Author

JustZeus commented Aug 2, 2021

I tried with an Azure Functions as a Webhook and MessageBird correctly sends the messages with the special characters of Spanish, the problem is not in MessageBird. I still do not have my registered number, I'd like to resolve this bug first before ordering one.

I configured my development environment to debug the application locally and use ngrok as you mentioned, when I send normal text it responds with 200 responses but as soon as I use some
characters in Spanish only returns me 401 Unauthorized

Could it be that it detects those characters as malicious text?

thanks for all your support!

@ahmetkocadogan
Copy link
Contributor

Hello @JustZeus .

I'll debug the adapter again. With the last info you give, it looks like adapter cousing the issue. Interesting part is, i was able to send and receive that letters without any issue.

I'll dive deeper and debug line by line. I'll let you know when i'm done.

Thank you.

@JustZeus
Copy link
Contributor Author

JustZeus commented Aug 3, 2021

Thank you @ahmetkocadogan , you are exceptional!

If you want to replicate the environment completely, you can create a project using the bot framework composer, a simple template like the one from LUIS or QnA, and edit the generated code by adding the adapter.

Perhaps the problem is in the integration of the adapter in such projects.

I am here to support you if you need it.

@ahmetkocadogan
Copy link
Contributor

Hello @JustZeus .

I think i find the issue, i still didn't have time to debug but i inspected my code. Because it gives 401, it should be request verification failing.

This is the part that i read body of the request with StreamReader:

image

And this is the method i call to verify the message :

image

Probably, reading the body in the first picture with StreamReader needs an encoding. This is what i understand with inspecting the code with the info that it returns 401 Unauthorized.

I'll let you know when i debug.

If you can, you can dowload the adapter project and add to your code, modify the StreamReader with encoding, instead of using adapter from NuGet, and check the results, till i find time and inspect it myself.

Have a good day.

JustZeus added a commit to JustZeus/botbuilder-community-dotnet that referenced this issue Aug 17, 2021
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 BotBuilderCommunity#435
JustZeus added a commit to JustZeus/botbuilder-community-dotnet that referenced this issue Aug 17, 2021
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 BotBuilderCommunity#435
@JustZeus
Copy link
Contributor Author

Thank you very much for your support! with your recommendations I was able to solve my problem, now it works wonderfully.
I created a pull request if you are interested in seeing my solution and comment on it if you think it's necessary.

Again, I really appreciate the time you invested in this situation 👍

@ahmetkocadogan
Copy link
Contributor

@JustZeus I am so sorry for making you wait this long. I couldn't have time to debug it again and update you on this.

I am so glad that you resolved the issue, really appreciate your efforts to create that pull request, and making me feel useful with using this adapter :)

Have a nice day.

garypretty pushed a commit that referenced this issue Oct 19, 2021
…rization (#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
@JustZeus
Copy link
Contributor Author

@ahmetkocadogan Hello again!
Hope you are doing very well.

I just acquire my WhatsApp channel, any recommendation to use this adapter in production?

Thank you very much in advance:)

@ahmetkocadogan
Copy link
Contributor

@JustZeus I don't know what to recommend to you to be honest :) It is an adapter that i coded for my needs, i use it for my production bots without an issue.

Also via Messagebird, from sandbox to production, i had no issue about their service.

One mistake i made was, i only handled text messages from bot and in production someone sended an image, boomm app crash :) Make sure that you test and handle all possible message types.

@drmanhatin
Copy link

@JustZeus can you share some code on how to register the IBot? I just started with bot framework composer, now I'm looking to add the messagebird extension aswell.

@ahmetkocadogan
Copy link
Contributor

@JustZeus Hello. If you can share how you use MessageBird library with bot framework composer, we can also update our readme and guide people who wanna use it.

@JustZeus
Copy link
Contributor Author

I’m sorry for the time to answer, I was on my holyday.

Yes of course I can show you!!, It’s very straight forward

I have to say that this is what worked for me but don’t necessary mean that it is the best way to do it.

1.-Step One

Select a template with C#

image

Step 2.- Select Azure Web App as an execution time.

When selected and confirmed the bot Framework Composer will create the project in your selected directory.

image

Step 3.- Open bot’s directory

Once you navigate to the bot’s directory you should see a .sln file (Visual Studio Solution) you can install a version of Visual Studio for your C# bot framework development if you are using Bot Composer. If you prefer you can also do the modifications with a code editor.

image

Step 4.- Open Bot’s .sln file and edit source code

This will open the project in Visual Studio, here you can navigate to the source code generated by the bot composer
First you need to add the package reference to the .csproj file in the project´s directory

image

Step 5.- Follow the steps as shown in the README.md in the adapter repository botbuilder-community-dotnet/libraries/Bot.Builder.Community.Adapters.MessageBird at develop · BotBuilderCommunity/botbuilder-community-dotnet (github.com)

Use the sample code as reference to modify the source code of the Bot project generated by Bot Composer

Sample:
botbuilder-community-dotnet/samples/MessageBird Adapter Sample at develop · BotBuilderCommunity/botbuilder-community-dotnet (github.com)

  • You need to add the appsettings.json file to the project’s root directory

  • Create an MessageBird adapter class, create a MessageBirdAdapterWithErrorHandler.cs file as in the sample

  • Add the controller file (MessageBirdController.cs) to the “Controllers” directory in the bot’s source code.

image

  • Add the singletons to the Startup.cs file

image

Finally, you can start testing it!! Remember to add tour credentials in the “appsettings.json” file

As I said you can follow the sample's methodology.

Hope this helps, I’m here if you need more information, also suggestions are welcome if you see points of improvement.

Ricardo Z.

@rvinothrajendran
Copy link
Member

rvinothrajendran commented Jan 16, 2022

@JustZeus Thanks for sharing & will do it the best way.
@ahmetkocadogan I will convert this adapter to fit the bot composer component later will update the readme file. #459

garypretty added a commit that referenced this issue Mar 16, 2022
* 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>

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>
garypretty added a commit that referenced this issue Mar 17, 2022
* 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>
@saikumaru
Copy link

@JustZeus - can you please check and confirm if this procedure still works, I tried to replicate, but it doesnt work. Bot receives the message, but is unable to respond.

Also, did you use Sandbox for this test or the actual whatsapp number?

I’m sorry for the time to answer, I was on my holyday.

Yes of course I can show you!!, It’s very straight forward

I have to say that this is what worked for me but don’t necessary mean that it is the best way to do it.

1.-Step One

Select a template with C#

image

Step 2.- Select Azure Web App as an execution time.

When selected and confirmed the bot Framework Composer will create the project in your selected directory.

image

Step 3.- Open bot’s directory

Once you navigate to the bot’s directory you should see a .sln file (Visual Studio Solution) you can install a version of Visual Studio for your C# bot framework development if you are using Bot Composer. If you prefer you can also do the modifications with a code editor.

image

Step 4.- Open Bot’s .sln file and edit source code

This will open the project in Visual Studio, here you can navigate to the source code generated by the bot composer First you need to add the package reference to the .csproj file in the project´s directory

image

Step 5.- Follow the steps as shown in the README.md in the adapter repository botbuilder-community-dotnet/libraries/Bot.Builder.Community.Adapters.MessageBird at develop · BotBuilderCommunity/botbuilder-community-dotnet (github.com)

Use the sample code as reference to modify the source code of the Bot project generated by Bot Composer

Sample: botbuilder-community-dotnet/samples/MessageBird Adapter Sample at develop · BotBuilderCommunity/botbuilder-community-dotnet (github.com)

  • You need to add the appsettings.json file to the project’s root directory
  • Create an MessageBird adapter class, create a MessageBirdAdapterWithErrorHandler.cs file as in the sample
  • Add the controller file (MessageBirdController.cs) to the “Controllers” directory in the bot’s source code.

image

  • Add the singletons to the Startup.cs file

image

Finally, you can start testing it!! Remember to add tour credentials in the “appsettings.json” file

As I said you can follow the sample's methodology.

Hope this helps, I’m here if you need more information, also suggestions are welcome if you see points of improvement.

Ricardo Z.

@saikiranvarmaJSN
Copy link

@JustZeus - can you please check and confirm if this procedure still works, I tried to replicate, but it doesnt work. Bot receives the message, but is unable to respond.

Also, did you use Sandbox for this test or the actual whatsapp number?

I’m sorry for the time to answer, I was on my holyday.
Yes of course I can show you!!, It’s very straight forward
I have to say that this is what worked for me but don’t necessary mean that it is the best way to do it.
1.-Step One
Select a template with C#
image
Step 2.- Select Azure Web App as an execution time.
When selected and confirmed the bot Framework Composer will create the project in your selected directory.
image
Step 3.- Open bot’s directory
Once you navigate to the bot’s directory you should see a .sln file (Visual Studio Solution) you can install a version of Visual Studio for your C# bot framework development if you are using Bot Composer. If you prefer you can also do the modifications with a code editor.
image
Step 4.- Open Bot’s .sln file and edit source code
This will open the project in Visual Studio, here you can navigate to the source code generated by the bot composer First you need to add the package reference to the .csproj file in the project´s directory
image
Step 5.- Follow the steps as shown in the README.md in the adapter repository botbuilder-community-dotnet/libraries/Bot.Builder.Community.Adapters.MessageBird at develop · BotBuilderCommunity/botbuilder-community-dotnet (github.com)
Use the sample code as reference to modify the source code of the Bot project generated by Bot Composer
Sample: botbuilder-community-dotnet/samples/MessageBird Adapter Sample at develop · BotBuilderCommunity/botbuilder-community-dotnet (github.com)

  • You need to add the appsettings.json file to the project’s root directory
  • Create an MessageBird adapter class, create a MessageBirdAdapterWithErrorHandler.cs file as in the sample
  • Add the controller file (MessageBirdController.cs) to the “Controllers” directory in the bot’s source code.

image

  • Add the singletons to the Startup.cs file

image
Finally, you can start testing it!! Remember to add tour credentials in the “appsettings.json” file
As I said you can follow the sample's methodology.
Hope this helps, I’m here if you need more information, also suggestions are welcome if you see points of improvement.
Ricardo Z.

Hi all,
I also followed same steps. I am using Message Bird's Whatsapp Sandbox. I have checked with ngrok, Bot received request from messagebird and responded with 200 ok. but i can't see any message in whatsapp.

I have tested with v4.13.2 and v4.13.3.
1). With v4.13.2 messages were like this:

WhatsApp Image 2022-06-07 at 5 08 18 PM

I have sent Hi message and it triggered OnMessageReceived Activity in Bot Service and Bot service responded with some text message(highlighted with green boxes). "Sorry, it looks like something else" is also from bot. but this message is due to some error in Adapter code that I still haven't figured out.

2). With v4.13.3, Bot responded with 200 ok. But i can't see any message in Whatsapp.

@ahmetkocadogan
Copy link
Contributor

hello @saikiranvarmaJSN

I suggest you to try with a verified WhatsApp number if you have one.

If you don't have one, and want to use sandbox, can you please contact MessageBird support, with referring this issues i created ?

messagebird/csharp-rest-api#89
messagebird/csharp-rest-api#87

I am currently using version 3 of the MessageBird C# sdk, they made some changes with v3 and removed a parameter that we used to set to true while using sandbox, with explanation that parameter is no longer needed.

I check it regularly but looks like sandbox functionality is somehow broken, does not work with MessageBird v3 C# sdk.

I guess this might be your issue.

garypretty added a commit that referenced this issue Jun 9, 2022
* 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.

* Bug fix for mapping of item in reaction_event (#478)

* Bug fix for mapping of item in reaction_event

* restoring message body

* minor fixe

* fixed spacing

* fixed spacing

Co-authored-by: Anshul Sharma <ansharma@linkedin.com>

* Changing encoding from ASCII to UTF8 to support extended charset (#480)

* change split character (#477)

* Webex Adapter: Adding support for Markdown and set default text format to Markdown instead of plain text (#482)

* adding reference to Bot.Builder.Community.Adapters.Share

* handling format and passing MessageTextType to CreateMessageAsync and CreateMessageWithAttachmentsAsync

* Adding support for markdown and additional plain text

* Setting default text format to markdown

* Add activity to google event for GoogleBusinessMessagingRequestMapper (#483)

* Add activity to google event mapping

* update display name

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>
Co-authored-by: Anshul21 <anshul2117@gmail.com>
Co-authored-by: Anshul Sharma <ansharma@linkedin.com>
Co-authored-by: Bastian Thiede <34596230+bastian-thiede@users.noreply.github.com>
Co-authored-by: Zhipeng Wang <zhiwang@microsoft.com>
@ahmetkocadogan
Copy link
Contributor

Hello @JustZeus

You can close the issue if you think your issue is resolved.

@JustZeus JustZeus closed this as completed Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants