1.8 KiB
1.8 KiB
title | description | menu | weight | ||||||
---|---|---|---|---|---|---|---|---|---|
pushbullet.endpoint() function | The `pushbullet.endpoint()` function creates the endpoint for the Pushbullet API and sends a notification of type `note`. |
|
202 |
The pushbullet.endpoint()
function creates the endpoint for the Pushbullet API
and sends a notification of type note
.
Function type: Output
import "pushbullet"
pushbullet.endpoint(
url: "https://api.pushbullet.com/v2/pushes",
token: ""
)
Parameters
url
Pushbullet API URL.
Defaults to https://api.pushbullet.com/v2/pushes
.
Data type: String
token
Pushbullet API token
to use when interacting with Pushbullet.
Defaults to ""
.
Data type: String
Usage
pushbullet.endpoint
is a factory function that outputs another function.
The output function requires a mapFn
parameter.
mapFn
A function that builds the object used to generate the API request.
Requires an r
parameter.
Data type: Function
The returned object must include the following fields (as defined in
pushbullet.pushNote()
):
title
text
Examples
Send the last reported status to Pushbullet
import "pushbullet"
import "influxdata/influxdb/secrets"
token = secrets.get(key: "PUSHBULLET_TOKEN")
e = pushbullet.endpoint(token: token)
lastReported =
from(bucket: "example-bucket")
|> range(start: -10m)
|> filter(fn: (r) => r._measurement == "statuses")
|> last()
lastReported
|> e(mapFn: (r) => ({
r with
title: r.title,
text: "${string(v: r._time)}: ${r.status}."
})
)()