Skip to content

Getting Started

Ananyobrata Pal edited this page Sep 25, 2024 · 7 revisions

Installation and Setup

This is a walkthrough for the initial configuration step you would require to get your own Slack bot with Frappe!
Follow the steps once you have finished installation of frappe-slack-connector in your Frappe installation.

NOTE: All the tokens, names and 'secrets' are for demonstration purposes only. They were created for this documentation and are not valid.

Step 1: Create a Slack App

To begin integrating the Frappe Slack connector with your Slack workspace, head over to the Slack App Dashboard and create a new app.

Create new app

Step 2: Create from Scratch

On the next screen, select From Scratch to create a custom app.

Select from scratch

Step 3: Choose Your Workspace

Choose the App name and the Slack workspace where you want the app to be installed.

Select workspace

Step 4: App Creation Complete

Once your app is created, you will be directed to the app's dashboard where you can find all the essential details.
We would require these credentials in the next part of setting up.

App details

Step 5: Setup Interactivity

For handling interactivity such as Slack actions or modals, enter your Frappe app's URL in the Interactivity section.
The URL should be: https://<your_domain_here>/api/method/frappe_slack_connector.api.slack_interactions.event

Enter interactivity URL

Step 6: Configure Slash Commands

To allow users to apply for leaves via a Slack command, go to Slash Commands and add your custom command.

Slash commands

Step 7: Create the Command

Define the command you want to use, for example /apply_leave, and configure it according to your Frappe app’s endpoint.
The URL should be: https://<your_domain_here>/api/method/frappe_slack_connector.api.slash_leave.slash_leave

Create new command

Step 8: Customize the App Appearance

From Basic Information tab in sidebar, you can customize the appearance of the app by uploading an icon, app name, and other display preferences.

Customize appearance

Step 9: Install the App in Your Workspace

Once all configurations are done, now it's time to Install App to add it to your workspace. Just to do that, we have to set up OAuth Scope, i.e, the permissions the Bot would have on your Workspace.
To configure that, navigate to OAuth and Permissions tab from the sidebar.

Install app

Step 10: Configure OAuth Scopes

In the OAuth & Permissions section, add the required scopes that the your app needs to function correctly.

Add permissions for:

  • channels:history
  • channels:read
  • chat:write
  • commands
  • users:read
  • users:read.email
OAuth scopes

Step 11: Install the App

After adding scopes, install or reinstall the app to the workspace.
You will be prompted to approve the app for your workspace by clicking Allow.

Allow access

NOTE: You have to reinstall the app everytime the OAuth Permissions are changed.

Step 12: Get the Bot Token

Once installed, you will receive a bot token that will be used to authenticate requests between Slack and your Frappe app.

Bot token

Step 13: Sync Slack Settings with Frappe

In your Frappe app's settings, update the Slack configurations.
Check the information from the initial screen and fill these up in the settings page

  • Bot Token
  • App Token (not used, currently you can just use the Bot token here too)
  • Signing Token
  • Attendance Channel ID
  • and the Time you'd want the attendance updates

NOTE: The bot needs to be invited to the Slack Channel before it can send messages. You can mention the bot in the channel and slack will add it. Also, after saving the configuration page, click on test channel to send a test message on the aforementioned channel so as to check the bot is able to send messages properly.

Slack settings sync

Step 14: Completion

Once the integration is complete, you will see a confirmation similar to the one below.
All the users who are connected with Slack are synced (you can see in User Meta DocType shipped with the module).
The users who are not connected to slack and also the ones connected to slack but not on ERP are displayed. You can recheck this list from the Error Log List.

Integration complete

Following these steps will allow you to integrate the Frappe Slack connector successfully and start using it for leave management directly within Slack!

Running Locally

For running the app locally, you'd want to use ngrok and use a free tunnel to connect Slack with your localhost.
Also, look into our other dev-tools for developing, debugging and hosting frappe apps: frappe-manager