Documentation

pushbullet.pushData() function

The pushbullet.pushData() function sends a push notification to the Pushbullet API.

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.

token

Pushbullet API token to use when interacting with Pushbullet. Defaults to "".

data

(Required) Data to send to the Pushbullet API. The function JSON-encodes data before sending it to Pushbullet.

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}",
    }
)

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.