How can I setting webhook callback url for Bot Framework (Skype)? - botframework

I need to setting URL for a service that was been receive event for new messages. According to Microsoft documentation I can set the url for, e.g., Facebook (https://learn.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-facebook?view=azure-bot-service-3.0#generate-a-page-access-token), but I can't find information about setting url for Skype.
But I can specify a message endpoint for my bot. The message endpoint is a webhook url?
Sorry for my bad English
See also: Messaging Webhook for Microsoft skype bot
PS: about web hooks for Skype: https://msdn.microsoft.com/en-us/skype/trusted-application-api/docs/webhooks

I'm not sure if you are using C# or node but I will try my best to answer both.
The Webhook is just the endpoint for your calling controller in C# so for example in the sample from the botbuilder repository in C# They are using the CallController.cs Your webhook would be https://{your site}/api/call.
In the sample from node they are using server.post('/api/calls', connector.listen()); so your webhook url would be https://{your site}/api/calls in this setup

Related

How to use Google Oauth2.0 to authenticate user via Telegram Bot

This is my first time interacting with Google API and I'm using python3.9 with this library Python Telegram Bot
I want to access a user Google API Calendar via a telegram bot and I can't seem to find any article to guide me through it. My key problem (I think) is redirecting the success authorization flow back to telegram bot.
This is what I have in mind:
In the telegram app, user send '/send' to bot
Bot receive message and return a google an authorization link to user
User clink on authorization link and allow access
Bot receive authorization access and completes the Oauth flow
The problem lies betweeen step 3 and 4. A standard authorization link is
https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=<clientid>&redirect_uri=<redirect_uri>&scope=<scope>&state<state>&access_type=offline
How do I send the authorization link back to my telegram bot? Should I create another API endpoint to receive that authorization link? Or can I send telegram api send_message() in the <redirect_uri> to redirect the success message to my bot.
Update 1
Thanks to CallMeStag, I manage to figure out a way to complete the oauth process. For people who faced the same problem, this is what I did
Pre-requisite: Credentials is created in google console api - Web application. redirect_uri set as localhost:8000 (During development phase)
User send '/send' to bot
Bot receive message and return an authorization link https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=<clientid>&redirect_uri=http://localhost:8000/&scope=<scope>&state<state>&access_type=offline
User click on link to authenticate and it will redirect to http://localhost:8000. Used fastapi as a webhook to receive the message. Capture the authorization code, use google.oauthlib.flow to complete the authorization process. Next, redirect user back to telegram link https://t.me/<botname>
Start using user google calendar
It's currently indeed not very straight forward for a PTB-application to listen for external updates (the auth verification in this cas) - see also this issue. Currently it might be easiest for you to set up a custom webhook application that runs in parallel to the Updater - e.g. using flask/django/starlette/fastapi/…. Alternatively, if you're using webhooks for your bot anyway, you can patch the Updater to do the job for you. Although that requires some manual work - see here for an example.
Once you are able to listen to updates coming from Google, handling them can be done via PTBs usual handler setup, specifically via the TypeHandler or even a custom Handler subclass - see this FAQ entry.
Regarding the redirect url: You'll want to redirect your user back to your bot, so you'll have to provide a link that does that. Bot.link should probably do the trick.
Disclaimer: I'm currently the maintainer of python-telegram-bot.

Bot Framework dotnet Slack adapter fails to verify Slack request when changing the Events Request Url

I have a Slack bot that is working fine and interacting with users. I'm using Bot Framework composer and the Slack Adapter.
In the Slack API portal I'm trying to change the Events Request Url the app uses to send Slack Events to my bot.
When I do that, slack sends a challenge request to my bot. The bot first tries to verify that the request is really coming from Slack following: https://api.slack.com/authentication/verifying-requests-from-slack#a_recipe_for_security
The problem is that this is failing and I can't understand why.
I see that Slack is sending all the right content, and that the ClientSigningSecret is being read, otherwise the other calls to the bot wouldn't work.
I know it's a bit far fetched to ask this since it seems to be a problem on my side. But since the bot is validating the requests just fine when users talk to the bot, and the code is from the Slack Adapter which is open source and there's nothing else I can thing of..... maybe someone struggled with the same problem.
I created a support ticket to Slack and they came back pretty quickly.
Pre publish state
Before publishing a Slack app the only configs that exist are the ones you see in the App configuration page. Those are what you use to test your app, this includes the secrets to authenticate the incoming messages from Slack into your backend.
After you publish your Slack App for the first time
Once your app is published, the production version that your users use will see the original settings, including the secrets and these are the ones your backend will get.
The settings you see in the configuration page are like development mode and they won't be persisted into the published app until you request Slack to approve your changes. That's sounds great and is what one would expect, but what you don't see and have no way of imagining is happening is that there are some development time secrets that are different from the ones you see on the settings screen.
When you change the endpoint url to be sent to your backend so that it can return the challenge and Slack would accept the new url, the message payload goes with this development secret and not the one you configured your backend with. Thus your backend will reject the call since it thinks it's not coming from Slack.
Proposed solution from Slack
Don't validate the signature of the incoming request for this type of call in an already published app. I don't like it but there was no other workaround unless Slack changes this. So what I did was:
Remove that check only for this request from the backend and publish to production.
Make the url change in Slack.
Revert the change from the backend.
:(

zapier is unable to send challenge value to enable slack event api

I'm using zapier with slack and want to catch an event when message_replied event was created as referred here.
To use event API, it needs URL verification, which is unable on zapier webhook catching. The following error occurs repeatedly; Request URL Your URL didn't respond with the value of the challenge parameter.
Are there any workarounds?
I'd really appreciate any help you can provide.
some related informations:
app used in zapier : Webhooks by Zapier
Event in zapier : Catch Hook
feature used in slack bot : Event Subscriptions
This is not currently possible. "Webhooks by Zapier" will only respond with the default "success" response because it's intended to be used with any incoming webhook. For that product, there's not special cases for any particular service.
If you're trying to integration with the Slack Events API (something I implemented at Zapier), then I recommend writing your own web service to catch Slack hooks, do business logic, and then send relevant webhooks onto Zapier as needed. This will afford you much more control over the process.

Bot Framework serviceUrl

I am developing a Notification Only bot to enable proactive Teams notifications.
As far as I am aware it is necessary to store the ServiceUrl from an incoming message to the bot endpoint. I have read that it is also possible that service Url can change in the future (although unlikely) and that if this happens the serviceUrl should be updated and used for future messages.
Using a test O365 instance in UK region I see the following behaviour:
When I add member to team or install the app to a team, the service Url comes through as:
https://smba.trafficmanager.net/uk/
When I remove a member from team or remove the app from team, the service Url comes through as:
https://smba.trafficmanager.net/emea/
If our service tries to send a notification via the rest api, using the /emea ServiceUrl it returns a 403 Forbidden
Doing the same using an O365 instance in US region the service Url is allways:
https://smba.trafficmanager.net/amer/
Is this expected behaviour or a bug?
Are there any rules on when the Service Url should be updated and when it should not?
Many Thanks.

Bot Framework SDK4 C# - send proactive message to a user in Teams / REST response timeout

Based on a GitHub sample, I created a dialog bot in Teams that collects information from a user and sends that to a Flow (Microsoft Flow/Power Automate) with a HTTP POST call.
After that the Bot waits for a response and sends it back to the user. This generally would be sufficient if the timeout for the call wasn't limited to 2 minutes - sometimes it takes longer to get the complete actions in Flow and get the response.
My question is how I could accomplish the same without getting the timeout. REST seemed the easiest as I'm not a programmer..
I checked the GitHub sample for proactive messaging (https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/16.proactive-messages), and that worked in the Emulator when I enter http://localhost:3978/api/notify, but I have no idea how to use it published to Azure. What would be the endpoint and how I could pass the message text?
Thanks
You should do some code modify if you want to send an message based on proactive-messages demo .
You can refer to my previous post which will meet your requirement.
After you modify the NotifyController.cs file , you can use send messages to a specific user with steps below :
Connect to your bot get current user ID :
Send message to this user by rest client tool or post man :
Result :
If you publish your bot to Azure , lets assume your Azure App service host is :https://xxxxxx.azurewebsites.net , then your bot message endpoint will be :https://xxxxxx.azurewebsites.net/api/messages and your /notify function endpoint will be : https://xxxxxx.azurewebsites.net/api/notify . In brief , just use your Azure App service endpoint to replace http://localhost:3978 will be fine .
Hope it helps . If there is anything unclear pls feel free to let me know .

Resources