Updated Notifiers (markdown)

master
Hunter Long 2018-12-19 17:07:46 -08:00
parent 4924eea4d4
commit d1588d9783
1 changed files with 27 additions and 5 deletions

@ -64,12 +64,34 @@ var example = &Example{&notifier.Notification{
## Notifier Form
Include a form with your notifier so other users can save API keys, username, passwords, and other values.
```go
// NotificationForm contains the HTML fields for each variable/input you want the notifier to accept.
type NotificationForm struct {
Type string `json:"type"` // the html input type (text, password, email)
Title string `json:"title"` // include a title for ease of use
Placeholder string `json:"placeholder"` // add a placeholder for the input
DbField string `json:"field"` // true variable key for input
SmallText string `json:"small_text"` // insert small text under a html input
Required bool `json:"required"` // require this input on the html form
IsHidden bool `json:"hidden"` // hide this form element from end user
IsList bool `json:"list"` // make this form element a comma separated list
IsSwitch bool `json:"switch"` // make the notifier a boolean true/false switch
}
```
- `Type` the HTML input type (text, password, number, or email)
- `Title`
### Example Notifier Form
This is the Slack Notifier `Form` fields.
```go
Form: []notifier.NotificationForm{{
Type: "text",
Title: "Incoming webhooker Url",
Placeholder: "Insert your slack webhook URL here.",
SmallText: "Incoming webhooker URL from <a href=\"https://api.slack.com/apps\" target=\"_blank\">slack Apps</a>",
DbField: "Host",
Required: true,
}}
}
```
### Accepted DbField Values
The `notifier.NotificationForm` has a field called `DbField` which is the column to save the value into the database. Below are the acceptable DbField string names to include in your form.