How to set up the connexion to my Slack Team?
Go to Tools > WP Down Slack Alert and follow the tutorial to get your Slack API token and customize your Slack notification bot:
To set up your Slack app, you'll need to get a Slack Bot token:
- Go to this page: https://api.slack.com/apps?new_app=1 and provide a name for your App, choose a Slack workspace and click on "Create App" button.
- In the "Features and functionality" section, click on the "Bots" panel.
- That will lead you to the "Bot user" screen. Click on "Add a Bot User" button.
- Leave the default names (you will be able to override that in the plugin’s settings), and click "Add bot user" button.
- Click on the "Install App" menu item in the navigation sidebar, then click on the "Install App to Workspace" button.
- Allow this Slack App to access your Slack team: click on the "Allow" button.
- Copy/paste the Bot User OAuth Access Token in the plugin’s settings field.
= How to programmatically define the plugin settings using PHP constants?
To programmatically define your settings, you can optionally use the following PHP constants, in a customized mu-plugin:
// Disable the admin settings screen (false to disable)
define( 'WPDSA_SETTINGS', false );
// Define the Slack API Token (string)
define( 'WPDSA_NOTIFICATION_TOKEN', 'qcsqkjcssjcksqh' );
// Define the notification channel (string - slugified)
define( 'WPDSA_NOTIFICATION_CHANNEL', 'my_slack_channel' );
// Disable the notification email (true to disable)
define( 'WPDSA_NOTIFICATION_DISABLE_EMAIL', true );
// Define the Slack notification recurrence (string - accepted values: '0,5', '1', '2', '6', '24', 'anytime')
define( 'WPDSA_NOTIFICATION_RECURRENCE', '2' );
// Define the notification bot name (string - slugified)
define( 'WPDSA_NOTIFICATION_BOTNAME', 'My_bot_name' );
// Define the notification message title text (string)
define( 'WPDSA_NOTIFICATION_MESSAGE_TITLE', 'My message title' );
// Define the notification message footer text (string)
define( 'WPDSA_NOTIFICATION_MESSAGE_FOOTER', 'My message footer text' );
// Define the notification message image (string - absolute link to an online image)
define( 'WPDSA_NOTIFICATION_MESSAGE_IMAGE', 'http://assets.whodunit.fr/brand/logo_whodunit_petit.png' );
// Disable the "Green" notification message (true to disable)
define( 'WPDSA_NOTIFICATION_DISABLE_GREEN', true );
Follow this link to download a complete example of mu-plugin file
You can download it, change the constants values if needed and upload it to /wp-content/mu-plugins
folder. You can also define the PHP constants in your wp-config.php
file.