pushbullet.pushData() function
The pushbullet.pushData()
function sends a push notification to the Pushbullet API.
*Function type: Output*
import "pushbullet"
pushbullet.pushData(
url: "https://api.pushbullet.com/v2/pushes",
token: "",
data: {
"type": "link",
"title": "This is a notification!",
"body": "This notification came from Flux.",
"url": "http://example.com"
}
)
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*
data
Required
Data to send to the Pushbullet API. The function JSON-encodes data before sending it to Pushbullet.
*Data type: Record*
Examples
Send the last reported status to Pushbullet
import "pushbullet"
import "influxdata/influxdb/secrets"
token = secrets.get(key: "PUSHBULLET_TOKEN")
lastReported =
from(bucket: "example-bucket")
|> range(start: -1m)
|> filter(fn: (r) => r._measurement == "statuses")
|> last()
|> tableFind(fn: (key) => true)
|> getRecord(idx: 0)
pushbullet.pushData(
token: token,
data: {
"type": "link",
"title": "Last reported status",
"body": "${lastReported._time}: ${lastReported.status}."
"url": "${lastReported.statusURL}"
}
)