mirror of https://github.com/statping/statping
Updated Notifiers (markdown)
parent
4924eea4d4
commit
d1588d9783
32
Notifiers.md
32
Notifiers.md
|
@ -64,12 +64,34 @@ var example = &Example{¬ifier.Notification{
|
||||||
|
|
||||||
## Notifier Form
|
## Notifier Form
|
||||||
Include a form with your notifier so other users can save API keys, username, passwords, and other values.
|
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)
|
### Example Notifier Form
|
||||||
- `Title`
|
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
|
### 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.
|
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.
|
||||||
|
|
Loading…
Reference in New Issue