load slack message history by an external web app - slack

I'm developing a web application which must load slack messages and work on it afterwards.
My question: what is the best way to develop an intermediary between slack and this web application to loads the messages directly after the user gives permission without creating a "slack app".
I saw this useful if we want to load only our own messages, but in my case I have to load the history messages inside my web application for each user who gives permission.

It's not possible to retrieve data from Slack without creating a Slack app. You need to create an app that requests the types of permissions/scopes you require for [conversations.history][1] and/or the Events API.The only way to access that information is with an app token and the only way to get a token is via app installation/authentication.

Related

How to handle the MFA authentication in JMeter

I am testing an application which is configured with Microsoft AD MFA. Whenever i login into application with my user id and pwd, i receive a push notification in my mobile from microsoft authenticator application which states "Approve" or "Deny" request.
Here we need to find out solutions for these two below mentioned problems :-
how can we handle the push notification that we receive in mobile while login using JMeterenter image description here.
how to perform the load test execution with these 2MFA enabled by handling the push notification and token expiry.
Your test should focus on your application only any external dependencies must be excluded. You are not load testing Microsoft servers, are you?
So if your test is making requests to one of the "forbidden websites" most probably these requests need to be removed.
If for some reason it's not possible - ask around if it's possible to turn off Azure authentication.
If it's not possible - ask whether it's possible to turn off the 2nd factor.
If it's not possible - ask whether it's possible to switch it to something you can handle easily like OATH Software token
As the last resort you can use a browser automation framework like Appium for automating the approval process on your mobile device/simulator

How to force the gmail inbox to reload/refresh?

I have built an application that uses the import endpoint in the Gmail API Gmail.Users.Messages.import() to clone an email message but allow for subject changing.
It then deletes the original/old message using the remove endpoint Gmail.Users.Messages.remove()
I would like a way to refresh the Gmail inbox UI or even to just reload the web page from Google Apps Script - however, I'm not aware of how to do this - and a look around the internet hasn't proven especially helpful.
Unfortunately it's not possible to control the user's Gmail interface via an API (or add-on). The best your application could do is instruct the user to do it themselves.

How to access user Google Fit data from backend

I write backend ASP .NET Core API and I need to read user Google Fit data.
I created an Android app that gets the server auth code and sends it to backend. As far as I understand, I need to get user token and then use it to access Google Fit. I tried to find libraries for it and failed. I also tried to get user token using Postman and got the following error:
{
"error": "invalid_grant",
"error_description": "Bad Request"
}
Am I doing something wrong?
You may refer with this thread: Using google fit api from a backend server.
To access from a back end server you will need to use the Rest API's There is documentation at developers.google.com/fit. You should be aware that the Google servers and the Android device are synced irregularly so data on the device may not be visible for hours or even days.
You may also check this link on how to read user's Google Fit data via REST API.
There is a mechanism for Android apps to obtain offline access for web back-ends highlighted in the CrossClientAuth guide from your question. With offline access, you can theoretically serve or store that data in any way that the user has consented to. Any access controls of that data to another person is something that you'd have to handle on your own.

Slack File Library

I really like Slack but my organization won't allow it if we cannot disable file sharing features. I'm trying to find out whether I can either disable uploads of certain file types or hide the file library all together. Their support says there's no way to do this natively but is this possible with the API?
No, not to my knowledge. The main focus of the API is not to configure your Slack team, but to enable bots and 3rd party apps to communicate with your Slack team and retrieve information. All core configuration for your Slack team has to be done in admin settings and apparently you have already learned from Slack support team that you can not deactivate file sharing in admin settings.
But I think I might have a solution for you. You can create a Slack bot that automatically blocks sharing of files in channels. (technically the bot would auto delete any message that is a file share form a user). Users would still be able to upload files, but they wont be able to share them. At least not in any public and known private channel. However there is a caveat: As I understand the bot would not be able to block users from sharing files in direct messaging channels though.
We are using a similar bot to block messages from unauthorized users in some private channels, which works nicely. Our bot is a simple Slack app with a bot user and using the Events API to receive all messages from all channels he is invited too. The bot then checks each new message and deletes the ones that does not fulfill some criteria. In our case if the message comes from a user that is not on the whitelist.

How to create a slack bot with the events API

I have my own slack team, with its own slackbot user.
I want to create a basic slack bot that will respond to direct messages, and I since I need specific events, I need to use the Events API.
I understand that slack will POST to my server the event that happened with its parameters, but I don't understand what needs to be done with the oauth permissions.
How can I add permissions to the slack app, without submitting the app?
reading the docs, I couldn't find the answer to this..
what am I missing?
You do not need to submit your app to the Slack App Directory. That is optional and only necessary if you want to make your app available to the public.
But you need to install your app to your Slack team before you can use it. During the installation process your app will be authenticated to your Slack team and you will receive a special token based on the scopes you requested.
The authentication process follows the OAuth standard and works similar to the process used by other web services, e.g. Twitter or Facebook.
I use a mini website for each of my Slack apps that has the "Add to Slack" button and is able to run through the OAuth process with Slack. This website is basically another script in addition to the one that will handle the events coming form Slack.
Check out the excellent documentation from Slack on the Slack button and how to use Oauth with Slack.

Resources