Microsoft Bot Framework Bot duplicate responses in Slack - c#

I have a simple code to test bot responses in my RoodDialog.cs code:
if (activity.Text.Trim().ToLower() == "--hi")
{
IMessageActivity replyMessage = context.MakeMessage();
replyMessage.Text = $"Hello {activity.From.Name}";
await context.PostAsync(replyMessage);
}
Works as expected in Skype, Emulator and Facebook Messenger, however sends duplicate response messages ("Hello {Name}") in Slack.
I think its either Slack configuration or a Bot Framework issue. Anyone seen and resolved this?
Thanks

Thanks to some Howdy developers I found the issue.
It happens when the bot has already been authorized to the team, and then someone else comes in and authorizes the bot again. When that happens, it seems there are two bots running that then use the same RTM connection to post to the channel twice.
I don't know how I got 2 bots in same Slack client. but once I removed and reinstalled my bot it started working as expected.
Same issue is causing this other symptom: Microsoft Bot Framework IDialogContext.Call() not working when using Slack

Related

Why delete messages in discord.net crashes

Unfortunately I have a problem with the discord.net libraries. basically when I try to delete a message from the 'message_receive_event' event by doing message.DeleteAsync() Discord outputs this error message Log: 18:40:16 Gateway A MessageReceived handler has thrown an unhandled exception.: Discord.Net.HttpException: The server responded with error 403: Forbidden in Discord.Net.Queue.RequestBucket.<SendAsync>d__18.MoveNext(). I have already tried several times a solution among the many forums and documents of discord.net, but nobody seems to have encountered a problem like mine. If you need to watch the code to solve the problem: https://github.com/carpall/dalvikbot
As said by Anu6is, the bot does not have permissions to delete the message. When your bot joined your server it gave it a role that is named after your bots name. Make sure to go into your role settings and give it administrator perms. I am kinda late but hoping I can help the people who search for the same issue in the future.

Refresh access token failed with status code: 401

I'm trying to test botframework server on my localhost.
I followed the steps in https://learn.microsoft.com/en-us/azure/bot-service/bot-service-troubleshoot-authentication-problems?view=azure-bot-service-4.0#step-3-enable-security-and-test-on-localhost- .
First I changed app config with the MicrosoftAppId and MicrosoftAppPassword passed the test of https://learn.microsoft.com/en-us/azure/bot-service/bot-service-troubleshoot-authentication-problems?view=azure-bot-service-4.0#step-2 .
Then I started my bot on localhost and the web page shows it was running on http://localhost:3979/ .
But when I tried to test it on the Bot Framework Emulator, it returned 400 directline.postActivity with the message of "Refresh access token failed with status code: 401".
The screenshot is on https://i.loli.net/2019/06/06/5cf88ea120b9973175.png .
My botframework version is 3.13.1.
My Bot Framework Emulator version is 4.3.3.
What should I do to solve this problem?
Thanks for any help.
{
"error": {
"code": "ServiceError",
"message": "Refresh access token failed with status code: 401"
}
}
[11:42:22]POST 201 directline.start Conversation
[11:42:22]Emulator listening on http://localhost:49840
[11:42:22]ngrok listening on https://082d32c4.ngrok.io
[11:42:22]ngrok traffic inspector:http://127.0.0.1:4040
[11:42:22]Will bypass ngrok for local addresses
[11:42:25]->message hi
[11:42:26]POST 400 directline.postActivity
"Refresh access token failed with status code: 401" errors are almost always an issue with appId/appPass.
Please verify:
You have the correct appId/appPass from the App Registration Portal
Note: If you didn't save your password, just click "New client secret" to generate a new one.
Verify you set the correct appId/appPass in web.config
Verify that you entered the correct app/Id/appPass in Emulator:
You should also upgrade Emulator to the latest release. There was a bug in Emulator long before 4.3.3 that caused this error, but I guess there could be something similar with V3 bots, since we rarely use them.
If this is a new bot, you should really be using V4. V3 will be deprecated July 1, 2019. Existing bots will work, but users will no longer be able to create them.

Feed subscription of a Page

I want to get notifications when a new feed has landed on a designated page (by page id). After what I understand, the Realtime-update og Graph API should be able to do this trick according to https://developers.facebook.com/docs/graph-api/real-time-updates/v2.4.
So I want to add a new subscription, which I try to do with the following code:
dynamic result = client.Post(urlPath, new
{
#object = "page",
callback_url = callbackUrl,
fields = "feed",
verify_token = "654321",
access_token = accessToken
});
return result;
But when I try to run this, I'm getting the following error code:
(OAuthException - #2200) (#2200) callback verification failed: Received HTTP code 502 from proxy after CONNECT"
What do I miss?
The callback url is https://127.0.0.1:8989/ and I have a TcpListener running on the port, which does not seem to get any response/request incoming...
The application is a C# console application, so no fancy asp.net stuff or something. I'm using the Facebook .net SDK.
Should I FacebookClient.VerifyPostSubscription() or anything else that I missed out?? Maybe the SDK wraps a handle?
So the answer I'm looking for is:
- How do I create/add a subscription for feeds of a facebook page, using the .net SDK on a windows console project??
UPDATE:
I changed the loopback with a domain name, that I the NAT to my target machine, and now I actually get some encrypted data on my TcpListener!
So, the question now is, how do I respond correctly to this received respons, only by using a Tcp Client??
How you have to respond is exactly outlined in the docs you linked:
https://developers.facebook.com/docs/graph-api/real-time-updates/v2.4#setupget
It's not really clear what you mean with "TCP listener". You need to have some logic why can send HTTP responses to the Facebook servers, otherwise your service will be disregarded after some time, meaning no updates will be send.
Typically, this is implemented as a script/application in a web/application server.
Please note: The "C# SDK" is a third-party SDK and not officially supported by FB.

Masstransit and RabbitMQ permissions

I am trying to figure out Masstransit 2.9.9 and RabbitMQ 3.4.3. I have RabbitMQ installed on a server and am trying to get a simple console application from my desktop to send a message. I created another administrator login.
I keep getting permission errors and the bus won’t initialize.
ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
When I look in the log files, it seems to use guest even when I send another login.
IServiceBus bus = ServiceBusFactory.New(sbc =>
{
sbc.UseRabbitMq(r =>
{
r.ConfigureHost(new Uri("rabbitmq://server/vhost/queue"), h =>
{
h.Validate();
h.SetUsername("user");
h.SetPassword("pwd");
});
}
sbc.ReceiveFrom("rabbitmq://server/order_queue");
}
I saw something about maybe needed to configure ssl for rabbit but i'm not sure.
Any ideas?
Thanks
I had exactly the same problem (I am testing first time Masstransit & rabbitMq). I added username and password in Uri:
new Uri("rabbitmq://user:pwd#server/vhost/queue")
I think that your ReceiveFrom address needs username and password. Also vhost is needed.
sbc.ReceiveFrom("rabbitmq://user:pwd#server/vhost/order_queue");
After banging my head, it appears the rabbit client that comes with the masstransit rabbitmq nuget package is slightly out of date. I did an update and the code works. The only change was to remove queue from the configurehost
r.ConfigureHost(new Uri("rabbitmq://server/vhost"), h => ....

Lync 2010 SDK - Calling a response group

I have a response group made of 2 agents. For the sake of clarification let's use the following:
Agent1: ag1#domain.com
Agent2: ag2#domain.com
Response Group: RG#domain.com
My code is based on the following walk through to establish an AV call with an agent:
http://msdn.microsoft.com/en-us/library/lync/hh378584.aspx
If I establish a call with Agent1 or Agent2 directly using their SIP address, the call goes through and everything works perfectly and I can even render the video from both sides.
If I establish a call with the Response Group however, and even if Agent 1 or Agent 2 take the call, it just ends with no error message and no exceptions thrown on my side.
The Sample application accompanying the SDK (AudioVideoConversation) also exhibits the same problems.
What's the reason for this? Is the SDK capable of handling response groups? If so, then how?
Edit: (1) Forgot to mention: Lync is in suppression mode!
Edit: (2) Further investigation lead me to this answer on the Lync Client Development forum: Forum Answer which to be honest is quite inconclusive and outrageous since the issue was raised in 2011 and the bug was replicated by MS.
Edit: (3) Question was raised again in the Lync Client Development forum, pending the Lync team bug reproduction Forum Answer
Edit: (4) The recent June updates for the client don't solve the issue either.

Categories

Resources