-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GH-108]: Added the setting in the system console for plugin settings #126
base: master
Are you sure you want to change the base?
Changes from all commits
53feffc
bcf9566
d5637cc
85e4615
532b4e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,14 +21,18 @@ Use this plugin to improve onboarding and HR processes. It adds a Welcome Bot th | |
|
||
## Configuration | ||
|
||
1. Go to **System Console > Plugins > Management** and click **Enable** to enable the Welcome Bot plugin. | ||
1. Go to **System Console > Plugins > Plugin Management** and click **Enable** to enable the Welcome Bot plugin. | ||
- If you are running Mattermost v5.11 or earlier, you must first go to the [releases page of this GitHub repository](https://github.com/mattermost/mattermost-plugin-welcomebot/releases), download the latest release, and upload it to your Mattermost instance [following this documentation](https://docs.mattermost.com/administration/plugins.html#plugin-uploads). | ||
|
||
2. Modify your `config.json` file to include your Welcome Bot's messages and actions, under the `PluginSettings`. See below for an example of what this should look like. | ||
2. Modify your configuration to include your Welcome Bot's messages and actions. See below for examples. | ||
|
||
## Usage | ||
|
||
To configure the Welcome Bot, edit your `config.json` file with a message you want to send to a user in the following format: | ||
To configure the Welcome Bot, choose one of the below options: | ||
|
||
### config.json | ||
|
||
Edit your `config.json` file with a message you want to send to a user in the following format: | ||
|
||
``` | ||
"Plugins": { | ||
|
@@ -65,7 +69,45 @@ To configure the Welcome Bot, edit your `config.json` file with a message you wa | |
}, | ||
``` | ||
|
||
where | ||
This field can be JSON or a string containing JSON. | ||
|
||
### System Console | ||
|
||
In the UI, go to **System Console -> Plugins -> Welcome Bot** and edit the **Welcome Messages** text field to include the JSON array for messages you want to send. Use the following format: | ||
|
||
``` | ||
[ | ||
{ | ||
"TeamName": "your-team-name, your-second-team-name", | ||
"DelayInSeconds": 3, | ||
"Message": [ | ||
"Your welcome message here. Each list item specifies one line in the message text." | ||
], | ||
"AttachmentMessage": [ | ||
"Attachment message containing user actions" | ||
], | ||
"Actions" : [ | ||
{ | ||
"ActionType": "button", | ||
"ActionDisplayName": "User Action", | ||
"ActionName": "action-name", | ||
"ActionSuccessfulMessage": [ | ||
"Message posted after the user takes this action and joins channels specified by 'ChannelsAddedTo'." | ||
], | ||
"ChannelsAddedTo": ["channel-1", "channel-2"] | ||
}, | ||
{ | ||
"ActionType": "automatic", | ||
"ChannelsAddedTo": ["channel-3", "channel-4"] | ||
} | ||
] | ||
} | ||
] | ||
``` | ||
|
||
If you see `[Object object]` in the text field, that's because the configuration was configured as JSON directly in your `config.json` instead of as a string. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we instead JSON.stringify the data if it's not originally a string? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mickmister Can you elaborate a bit on this, I am not really able to understand it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regarding the other review comments, I am not able to push the code, as we don't have access to push the code. Will fix it afterwards There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, if it's the case that the setting is an object (and not a JSON string), then the frontend can call Ideally we can just keep it as an object in the config file too, and not have a JSON string in the |
||
|
||
### Reference | ||
|
||
- **TeamName**: The team for which the Welcome Bot sends a message for. Must be the team handle used in the URL, in lowercase. For example, in the following URL the **TeamName** value is `my-team`: https://example.com/my-team/channels/my-channel | ||
- **DelayInSeconds**: The number of seconds after joining a team that the user receives a welcome message. | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -17,6 +17,13 @@ | |||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||
"settings_schema": { | ||||||||||||||||||||||||||||||
"header": "Configure this plugin directly in the config.json file. Learn more [in our documentation](https://github.com/mattermost/mattermost-plugin-welcomebot/blob/master/README.md).\n\n To report an issue, make a suggestion, or submit a contribution, [check the plugin repository](https://github.com/mattermost/mattermost-plugin-welcomebot)." | ||||||||||||||||||||||||||||||
"settings": [ | ||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||
"key": "WelcomeMessages", | ||||||||||||||||||||||||||||||
"type": "longtext", | ||||||||||||||||||||||||||||||
"display_name": "Welcome Messages:", | ||||||||||||||||||||||||||||||
"help_text": "JSON formatted configuration for the welcome messages. See [usage here](https://github.com/mattermost/mattermost-plugin-welcomebot#usage)." | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
] | ||||||||||||||||||||||||||||||
Comment on lines
+21
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The indentation seems off here
Suggested change
|
||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.