SlackL is a Slack bot that provides DeepL translations for messages in Slack.
Quickly translate any text from the Slack UI using the /translate command |
translate any old or newly received messages by pressing the ... (more actions) button on a message and selecting the "Translate Message" option. |
Automatic Message Translations for Specific Channels feature allows users to configure automatic translations for specific channels using commands. This feature is customizable, enabling users to set up and manage translation settings according to their preferences. |
SlackL is a free, open-source, and customizable self-hosted solution. By hosting it on your own infrastructure, you maintain complete control over the implementation. |
Developed at SoftSora 💖
- Java 17
- Maven
- A Slack workspace
- DeepL API key
- Go to the Slack API and create a new app.
- Choose "From an app manifest" and select the workspace.
- Copy the contents of the provided
manifest.json
file and paste it into the manifest editor. - Replace the placeholders in the
manifest.json
file with temporary URLs (e.g.,https://example.com
). - Click "Next" and review the settings.
- Click "Create" to create the app.
- Navigate to OAuth & Permissions.
- Install the app to your workspace and copy the Bot User OAuth Token.
Edit the src/main/java/com/hapangama/Constants.java
file and set the following constants:
package com.hapangama;
public interface Constants {
String SLACK_BOT_TOKEN = "your-slack-bot-token"; // make sure to include the token that start with xoxb
String SLACK_SIGNING_SECRET = "your-slack-signing-secret";
String SLACK_CLIENT_SECRET = "your-slack-client-secret";
String DEEPL_API_KEY = "your-deepl-api-key";
int SLACK_PORT = 3000;
//...
}
- Open a terminal and navigate to the project directory.
- Run the following command to build the project:
mvn clean package
- Run the application using the following command:
java -jar target/SlackL-1.0-SNAPSHOT.jar
- After deploying your application, obtain the actual URLs for your server endpoints.
- Go back to the Slack API and select your app.
- Navigate to Event Subscriptions and update the Request URL with your actual server endpoint.
- Navigate to Slash Commands and update the URLs for each command with your actual server endpoint.
- Save the changes.
Your Slack bot should now be up and running with the correct URLs. You can test it by using the configured slash commands in your Slack workspace.
{
"display_information": {
"name": "SlackL",
"description": "DeepL Translations For Slack",
"background_color": "#142230"
},
"features": {
"bot_user": {
"display_name": "SlackL",
"always_online": false
},
"shortcuts": [
{
"name": "Translate Message",
"type": "message",
"callback_id": "translate_message_sk",
"description": "Translate Message"
}
],
"slash_commands": [
{
"command": "/ping",
"url": "https://your-domain.com:port",
"description": "Test Translation Bot",
"should_escape": false
},
{
"command": "/translate",
"url": "https://your-domain.com:port",
"description": "Quickly Translate Any Text From UI",
"should_escape": false
},
{
"command": "/translate-channel",
"url": "https://your-domain.com:port",
"description": "Automatically Translate Messages Sent to Channel",
"should_escape": false
}
]
},
"oauth_config": {
"scopes": {
"user": [
"chat:write"
],
"bot": [
"app_mentions:read",
"assistant:write",
"bookmarks:read",
"channels:history",
"channels:join",
"channels:read",
"chat:write",
"chat:write.customize",
"chat:write.public",
"commands",
"reactions:read",
"reactions:write",
"users:read",
"users:read.email"
]
}
},
"settings": {
"event_subscriptions": {
"request_url": "https://your-domain.com:port",
"bot_events": [
"app_mention",
"message.channels"
]
},
"interactivity": {
"is_enabled": true,
"request_url": "https://your-domain.com:port"
},
"org_deploy_enabled": false,
"socket_mode_enabled": false,
"token_rotation_enabled": false
}
}