Home General Enabling notifications in Torq

Enabling notifications in Torq

Last updated on Jan 19, 2024

In this article we will guide you through enabling different notification channels in Torq. The notifications are messages from Torq that you receive to external channels. Right now Torq supports Slack, Telegram and Discord. To get most out of the notifications, add them to your workflows by adding the "Notification Sender" action.

Enabling different notification channels

Telegram

You need a telegram bot to receive the notifications to Telegram. Note that that you can create 2 bots if you want to use both available Telegram notification channels (alert and notify).

  1. Start a Telegram chat with a Telegram botuser called "BotFather" by searching "BotFather" in the search bar. (Check that it has the verified mark, to mark that it's the correct bot.)

  2. Write command: /newbot and follow instructions to create a bot.

  3. BotFather now gives you some credentials you can use. Grab those credentials and go to Torq in the browser. Populate those credentials in the desired field on the settings page. Then save the settings.

  4. Click Generate OTP and take note of the generated code

  5. Start a conversation with your new bot in Telegram (search your bot's name in the search bar) and write the command: /register For example: /register 123456789

  6. The bot should respond if you have any lightning nodes connected to Torq

  7. You can test the integration by writing: /status

Slack

To receive Torq notifications to slack, you have to create a new Slack app and install it to your Slack workspace.

  1. Login to your slack in your browser and on a new tab go to: https://api.slack.com/apps?new_app=1

  2. Select ”From an app manifest”

  3. Select your workspace that now should be selectable as you have logged in in an other tab

  4. Copy and paste this manifest (it’s in JSON format). You can change the ”name” and ”display_name”. (If you add this bot to a slack workspace that already has a different torq bot, change the commands /register, /settings and /torq to something else)

    {
        "display_information": {
            "name": "TorqNotifications"
        },
        "features": {
            "bot_user": {
                "display_name": "Torq Notifications",
                "always_online": false
            }
        },
        "oauth_config": {
            "scopes": {
                "bot": [
                    "app_mentions:read",
                    "channels:history",
                    "commands",
                    "groups:history",
                    "groups:read",
                    "im:history",
                    "chat:write",
                    "chat:write.customize",
                    "users:read"
                ]
            }
        },
        "settings": {
            "event_subscriptions": {
                "bot_events": [
                    "app_mention",
                    "channel_id_changed",
                    "message.channels",
                    "message.groups",
                    "message.im"
                ]
            },
            "interactivity": {
                "is_enabled": true
            },
            "org_deploy_enabled": false,
            "socket_mode_enabled": true,
            "token_rotation_enabled": false
        }
    }
    
  5. Click Next and Create. You should now see page ”Basic Information”

  6. Click ”Install to workspace” and allow

  7. (You can edit the display information like the app name and icon from the bottom of the page)

  8. Select ”App Home” from the left menu (under Features). From ”Show Tabs” section check the ”Allow users to send Slash commands and messages from the messages tab”

  9. Scroll down and click ”Generate Token and Scopes”

    1. Set name for token, for example ”Torq app token”

    2. Add scope for all the available scopes and generate.

    3. Copy the token and navigate to Torq in the browser.

    4. Paste the token on the settings page in field ”Slack Bot App Token”

  10. In Slack app settings select ”OAuth & Permissions” from the left menu (under Features).

    1. Copy the ”Bot User OAuth Token”

    2. Paste it on the Torq settings page in field ”Slack OAuth Token”

  11. Remember to save the Torq settings page when both field are populated

  12. In Slack the app itself on the left menu select ”Add apps” and select your just created app that should now be visible. The app should now be seen under the Apps section.

Now the integration is active. But Torq does not know what channel(s) to communicate on. Here are the steps to add a communication channel:

  1. In Torq in the browser you navigate to the settings page and click Generate OTP

  2. Copy the generated code

  3. Start a conversation in the channel you want the notifications and type @bot register For example: @TorqNotifications register 123456789

  4. The bot should respond if you have any lightning nodes connected to Torq

  5. Check that the connection is working by sending @bot status For example: @TorqNotifications status

Discord

To receive Torq notifications in discord, you have to create a new Discord app and install it on your discord server.

  1. Navigate to https://discord.com/developers/applications and make sure you are signed in.

  2. Click on New Application in the top right corner.

  3. Give the application a name and hit create.

  4. Once created you will be able to see more details

  5. Click on Bot in the left menu

  6. Update the username to your liking and flick on Message content intent and hit Save Changes

  7. Then open OAuth2 > URL Generator make sure the bot checkbox is active under scopes this will open the Bot permissions section. Make sure to activate:

    1. General Permissions: Read Messages/View Channels

    2. Text Permissions: Send Messages

    3. Text Permissions: Manage Messages

    4. Text Permissions: Embed Links

    5. Text Permissions: Attach Files

    6. Text Permissions: Read Message History

  8. Once done hit Copy on the bottom and open it in a browser

  9. This will import the bot into your discord server.

  10. Once imported go back to the discord bot settings

  11. On the Bot page click on Reset Token. Once the token is available you copy it

  12. Navigate to Torq in the browser, go to the Settings page and paste the token in the field Discord Token and hit Save

  13. On the same page click on Generate OTP. Once the OTP number is visible copy it.

  14. Open Discord itself. Start a conversation in the channel you want the notifications and type torq register For example: torq register 123456789

  15. The bot should respond if you have any lightning nodes connected to Torq

  16. Check that the connection is working by sending torq status For example: torq status