Skip to main content

Introduction

This guide covers creating and deploying Slack bots on Shard Cloud.

Creating a Slack App

1

Create App

Go to Slack API - Your Apps and click “Create New App”.
2

Choose Creation Method

Select “From scratch”, name your app, and select your workspace.
3

Get Credentials

In “Basic Information”, note your Signing Secret. In “OAuth & Permissions”, add scopes like chat:write, app_mentions:read, commands.
4

Install to Workspace

Click “Install to Workspace” and copy the Bot Token (starts with xoxb-).
Security: Never expose your Signing Secret or Bot Token publicly.

Creating Your Bot

Setup

Basic Bot Code

index.js

Package.json

package.json

Environment Variables

Set these in the Shard Cloud dashboard:
  • SLACK_SIGNING_SECRET: Your app’s signing secret
  • SLACK_BOT_TOKEN: Your bot’s OAuth token

Shard Cloud Configuration

.shardcloud
The SUBDOMAIN is required for Slack to send events to your bot via webhooks.

Configuring Slack Events

After deployment, configure your Request URLs in Slack:
  1. Event Subscriptions: Enable and set URL to https://my-slack-bot.shardweb.app/slack/events
  2. Slash Commands: Set URL to https://my-slack-bot.shardweb.app/slack/events

Deploying

1

Prepare Your Files

Ensure you have: - Your bot code file - package.json or requirements.txt
  • .shardcloud
2

Set Environment Variables

Configure SLACK_SIGNING_SECRET and SLACK_BOT_TOKEN in the dashboard.
3

Create ZIP Archive

Compress your project folder (excluding node_modules/).
4

Upload to Shard Cloud

Go to Shard Cloud Dashboard and upload.
5

Configure Slack URLs

Update Event Subscriptions and Slash Command URLs in your Slack app settings.

Additional Resources

Troubleshooting

  • Verify your Request URL is correct - Ensure your app is running and accessible - Check that the signing secret matches
Make sure your bot is running before verifying the URL in Slack.