Slack File Library - slack

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.

Related

How to perform Graph auth without hosting my bot in Azure?

From my understanding, the OAuthPrompt requires a connection name. To create this, I need to make use of the Bot Channels Registration (as per the documentation). However, this seems to require me to create an Azure account and enter my payment card details. I would like to avoid entering my details if possible as I would not like to be charged for using any Azure services. Is there any way to avoid this?
If I must manually handle the OAuth process, I would like my sign-in to pop up in a small window like the "Allow" button triggers within the Who bot. I have tried SignIn cards which I have read just don't work in teams, and I have also tried OpenUrl type actions in a card which, when pressed, open the URL in my browser as opposed to a pop-up. How can I achieve this?
You can create a Bot Framework bot (only for Microsoft Teams) using the guidance here: https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/bots/bots-create. To summarize that article, you can use this endpoint to create a non-Azure bot: https://dev.botframework.com/bots/new
If you chose to use the Azure Bot Framework, you will not be charged for the Bot Framework if Microsoft Teams is your only channel (this does NOT include your web service if you chose to host your bot code on Azure, although you can chose a free tier to avoid any charges).
For authentication, see this section of the MS Teams documentation: https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/authentication/authentication. Depending on how you chose to implement your authentication, there are a few articles in that section that may apply. The OAuth card does work in Teams (not the free version, does not work with guest accounts, and only works for Azure bots).
For authentication, if you're redirecting to a different domain make sure you add it to the validDomains in your app manifest.

How to find out if workspace added or removed your Slack App?

I have some questions about Slack App after Public Distribution is activated.
Our team has developed a Slack App with bot and incoming webhook features, and we have activated public distribution for this Slack App, and added the "Add to Slack" button on our product webpage.
Questions:
Is there any way to find out what workspaces have added our Slack App? I understand that via the Add-to-Slack flow, we would know when a workspace has added the Slack App along with the resulting bot access token and webhook. But is that the only way to keep track? Is there no API to just list the workspaces, resulting bot, and webhook?
Is there any way to find out which workspaces have removed our Slack App? I can infer that information by doing an users.list API call using the bot access token. If it says token invalid, then I can guess that the workspace has removed the Slack App. Is there no other direct API to find out if a workspace has removed the Slack App?
Thank you.
Is there any way to find out what workspaces have added our Slack App?
I understand that via the Add-to-Slack flow, we would know when a
workspace has added the Slack App along with the resulting bot access
token and webhook. But is that the only way to keep track? Is there no
API to just list the workspaces, resulting bot, and webhook?
This is the only way (to track workspace during installation flow). At least for now, I saw such a feature in mid/long term plans for Slack API team.
Is there any way to find out which workspaces have removed our Slack
App? I can infer that information by doing an users.list API call
using the bot access token. If it says token invalid, then I can guess
that the workspace has removed the Slack App. Is there no other direct
API to find out if a workspace has removed the Slack App?
Take a look at app_uninstalled and tokens_revoked API events.

Slack API : Ability to view all recently added users to Slack Channel

I am working on a POC to proof out the ability to get a list of all the new users who have been added to a specific Slack Channel. From my initial review of the Slack API I am not seeing anything that showcases this ability, I was curious to see if anyone had worked on something similar or could point me to resources that would be a viable solution.
I believe there is no ready-made API method available, that will give you that specific information. However, Slack is very flexible and you can use the existing building blocks to easily add additional features as needed.
E.g. To get the requested information you can develop a small Slack app that listens to the member_joined_channel and member_left_channel events to keep track of when members joined a channel.
If you need a historical record of membership in a channel, you could use the Slack API's groups.history method, page through results, and build a membership log by looking for events of type member_joined_channel and member_left_channel through time.

Skype Bots - Please tell me I'm missing something

Working on an application and developing chat integration bot. Note that contrary to some news bots or other tools, there is no central website or server that the bot gets its data from. The software installation comes with a repository, and that is where the bot connects to. Thus, every user, upon installing the software, will basically get their own copy of the bot, alongside with their own repository, etc.
Now, having done that for Telegram: You open the telegram client, initiate a chat with the botfather, get the token for your new bot with one or two commands, and then add that token to my application. Done. Easy for the user to follow, takes a few minutes at most and they have a working bot.
Trying to do the same with Skype, the users must:
Sign up for an Azure account
Provide credit card and phone number verification (that's probably where some users will stop right away)
Log on to the Azure Portal
Create a bot channel, through a myriad of different screens I have to guide the user through.
Have the user obtain the bot's password, again through a variety of different screens he needs to be guided through. (if the user hasn't given up yet, at this point he'll definitely get grumpy)
Enable the Skype channel, and enable the bot to be added to group chats.
Attempt to locate the bot via Skype and eventually add it in.
Now, if I wanted to document this properly, this will be a 10-15 page document with tons of screenshots and all. To do what Telegram does in two minutes or even less. There's so many opportunities in all of this for something to go wrong, that I can't even consider forcing my users to go through this.
Surely, I must be missing something? It can't be that you have to go through this horrible mess of an over-engineering spectacle that is second to none, just to get the most basic bot to function?
All I need is a means to say "this is the bots name, give me its token and API URL so that it can send messages using the REST API". But I can't seem to find this for Skype.

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