botbuilder-community-dotnet
botbuilder-community-dotnet copied to clipboard
Infobip Viber unable to receive and send message
When I try to send message from Viber app to bot, I receive error message - An error occurred while writing to logger(s). (Input string was not in a correct format.)
Exception type - System.FormatException
and failed method is - Bot.Builder.Community.Adapters.Infobip.Viber.ToActivity.ToViberActivityConverter.Convert
.
I am getting same error in @ivanursic-infobip sample after setting appsettings file correctly.
I have found that in function private Activity ConvertToActivity(InfobipViberIncomingResult response)
in file Bot.Builder.Community.Adapters.Infobip.Viber.ToActivity.ToViberActivityConverter.cs, response.IsDeliveryReport()
and response.IsViberMessage()
are always false. And control never enters in any of the if-block.
In the same function response.Message.Text
is null.
In the function ProcessAsync
in InfobipViberAdapter.cs
, the value stored in stringifiedBody
is
{"results":[{"from":"917225******","to":"DemoCompany","text":"Get started","cleanText":"","keyword":"GET STARTED","receivedAt":"2021-10-08T10:02:43.645+0000","smsCount":1,"messageId":"5627202345175914830","pairedMessageId":null,"price":{"pricePerMessage":0.000000,"currency":"PHP"},"callbackData":null}],"messageCount":1,"pendingMessageCount":9}
If someone can point to working example of infobip-viber, then it will be helpful.
@programmercave0 check here : https://github.com/ivanursic-infobip/botbuilder-community-dotnet/tree/develop/samples/Infobip%20Viber%20Sample
@rvinothrajendran I have tried with that sample and getting the same error.
@ivanursic-infobip Can you help here
@ivanursic-infobip , @garypretty can you please help here.
In function ProcessAsync
in file InfobipViberAdapter.cs
, if I try to serialize using var tmp = JsonConvert.SerializeObject(incomingMessage, Formatting.Indented);
, after the line var incomingMessage = stringifiedBody.FromInfobipIncomingMessageJson<InfobipViberIncomingResult>();
var incomingMessage = stringifiedBody.FromInfobipIncomingMessageJson<InfobipViberIncomingResult>();
var tmp = JsonConvert.SerializeObject(incomingMessage, Formatting.Indented);
Then the value of tmp
is
{"results": [{"Message": null,"bulkId": null,"integrationType": null,"price": {"pricePerMessage": 0,"currency": "PHP"},"status": null,"error": null,"messageId": "5628934191496715454","doneAt": null,"messageCount": 0,"callbackData": null,"sentAt": null,"to": "DemoCompany","from": "917225******","channel": null,"receivedAt": "2021-10-13T04:44:27.975+00:00","keyword": "GET STARTED"}],"messageCount": 1,"pendingMessageCount": -1}
Message
is null.