Tag Archives: Slack

Automatic Slack invitations with Microsoft Forms and Flow

As we are currently preparing everything for the PowerShell Conference Asia, we decided to open up our Slack team to the general public. In order to do this we had to set up an automated Slack inviter. My initial search for examples of how to set this up resulted in a lot of old blog post, because of that I went back to the drawing board and took a look at what I thought I needed:

  • An online form
  • Trigger when form is filled in
  • A method of inviting

Because I have an Office 365 account I decided to use a combination of Microsoft Forms and Microsoft Flow for this purpose. Microsoft Forms is similar to many other online forms, but the combination with Microsoft Flow was what won me over. Microsoft Flow allows for setting up automated workflows in Office 365. It can also use webhooks, which happens to be an excellent method of working with Slack.

I then found this post on Stack Overflow, in the Slack API team invitation question, covering an undocumented feature in the Slack API that allows for invitations to be send out by webhooks. With that we filled in the have matched the requirements for setting up automatic invites for Slack.

So first things first, in order to use the Slack API we require a token, for this purpose I requested a Legacy token, which can be done at the following URI:

https://api.slack.com/custom-integrations/legacy-tokens

After clicking create token you will get a string that resembles this:

xoxp-00000000000-00000000000-000000000000-00000aa0a00a0a0a0aa0aaf00b00a00d

We will need this to authenticate with Slack once we setup the webhook, because of this it is important you do not share this token with anyone, or store this in a public repository.

The next step is to setup a form in Microsoft Forms, to keep sign up simple we will just request users to enter their email address. They can choose to fill in the rest of their details when they click the registration link that will be send out by Slack. I created the following:

Next up we want to create a sharing link for this Form, make sure you set the sharing option to, Anyone with the link can respond, as the default sharing option is that only people within your Office 365 organization are able to access the Form. This can be done as shown in the following screenshot.

Now that we have this setup it is time to create our Flow. For the purpose of this blog post I created a simple Flow that triggers when a response has been received:

Then we configure the HTTP webhook to trigger Slack to send an invitation email to that email address:

https://slack.com/api/users.admin.invite?token=xoxp-00000000000-00000000000-000000000000-00000aa0a00a0a0a0aa0aaf00b00a00d&email=

After saving and enabling this flow the automatic invitations will be send out as soon as someone fills out the form. Because we made the the sharing link public to the Microsoft Form you can now use social media to share out and promote your Slack team.

Let me know how this works for you and if you have become curious about the PowerShell Conference Asia or you want to network with some of the attendees and speakers of that conference you can sign up here:

PowerShell Conference Asia – Slack Invitation

Share

Chat automation in a modern IT environment

Winops Banner

This week I was invited to speak at the joint WinOps London and London PowerShell user group meetup in central London. For more information about the event you can have a look at the following link: WinOps #14 – in connection with PowerShell London UK

Our July meetup will be held at Rubrik’s offices in Moorgate on Thursday 20th July. Rubrik are one of our gold sponsors for the WinOps Conference. This meetup will be in connection with PSUG UK and we’ll have a PowerShell MVP speaking on the night. Last meetup before the conference so not one to miss!

During my presentation I covered the very broad topic of Chat Automation, also known as ChatOps. This has recently been getting more attention and I put together a presentation in which I showed how to setup PoshBot on a Windows machine, demoed its functionality. Also I gave an example of how to use a Chat bot to resolve an issue in a production, assisted by Daniel Krebs. The full session description is as follows:

In this session we will cover a range of topics regarding Chat automation and the possibilities this gives us. We will dive into the concept of ChatOps, what it is, how we can implement it and what the benefits are. After this brief introduction we will dive into real-world examples of setting up and configuring your first chat bot, configuring security and resolving real-world incidents using this chat bot.

To give you an impression of the event I have attached some pictures taken that evening:

All the code and slides are as always available in my Events GitHub repository:

I also share my presentations on SlideShare:

Share