Automatically send a Direct Message to all users of a Slack workspace.
Slack is becoming more and more useful as a way to build communities. The fact that's it's semi-private and that people answer quickly since they often also use it within their companies is really powerful.
Schedule and send customized messages to a list of your Slack workspace buddies. Really useful to spread the word in a personalized way about some topic that's dear to your heart.
You'll be able to message all the users of your list, or only those online when the API launches. That way you'll be able to handle all the answers you'll get.
In order to build that list of recipients, we recommend using our Slack Channel Users Extractor tool. It'll neatly gather all users from a specific channel in a spreadsheet.
What will you need? ⚙️
Your "Slack's Workspace URL": To find your Slack's workspace URL and cookie, you'll need to open it in your browser, not in app.
"d Session Cookie": That's your authentication d session cookie. Note that on each workspace your cookie will be different.
"Spreadsheet URL or a Slack User ID": The list of recipient's IDs you want to send messages to. You can a list of users with our Slack User Extractor API or copy users ID by hand. In browser, they look like this: https://mycompany.slack.com/messages/DD9FK9A56/.
Which steps to follow?
1. Create an account on Phantombuster.com 💻
If you haven't already, create a FREE account on Phantombuster. Our service will browse the web for you. Our automations run in the cloud.
2. Use this API on your account.👌
Now that you're connected to Phantombuster, Click on the following button (it will open a new tab).
3. Click on Configure me!
You'll now see the 3 configuration dots blinking. Click on them.
4. Get your Slack Session cookie
The Session Cookie you'll need to make this API work is called "d",
Here's how you can get yours:
Using Chrome (not the Slack app), go to your workspace and open the inspector.
→ Right-click anywhere on the page and select “Inspect”
→ CMD+OPT+i on macOS
→ F12 or CTRL+MAJ+i on Windows
Locate the “Application” tab
Select “Cookies” > “https://www.yourworkspace.slack.com” on the left menu.
Locate the “d” session cookie.
Copy what’s under “Value” (Double click on it then Ctrl+C) and paste it into your script Argument)
The second argument is "Slack Workspace URL". We need it to know which Slack workspaces you want to target.
This URL should look something like yourcompany.slack.com.
6. Input the spreadsheet URL containing your recipient's IDs.
The "Spreadsheet URL or Slack User ID" can take either one single ID – which might be alright for a prank – or a list of recipient in the form of Slack user ID's. For the latter, write down those IDs in a Google Spreadsheet, make the spreadsheet public and paste its URL the configuration form.
Click on Launch & Enjoy!
It’s done! All that is left to do is to click on "launch" to try your script!
More bots like this one will be added to Phantombuster,