pushbullet.pushData() function

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

*Function type: Output*

  1. import "pushbullet"
  2. pushbullet.pushData(
  3. url: "https://api.pushbullet.com/v2/pushes",
  4. token: "",
  5. data: {
  6. "type": "link",
  7. "title": "This is a notification!",
  8. "body": "This notification came from Flux.",
  9. "url": "http://example.com"
  10. }
  11. )

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
  1. import "pushbullet"
  2. import "influxdata/influxdb/secrets"
  3. token = secrets.get(key: "PUSHBULLET_TOKEN")
  4. lastReported =
  5. from(bucket: "example-bucket")
  6. |> range(start: -1m)
  7. |> filter(fn: (r) => r._measurement == "statuses")
  8. |> last()
  9. |> tableFind(fn: (key) => true)
  10. |> getRecord(idx: 0)
  11. pushbullet.pushData(
  12. token: token,
  13. data: {
  14. "type": "link",
  15. "title": "Last reported status",
  16. "body": "${lastReported._time}: ${lastReported.status}."
  17. "url": "${lastReported.statusURL}"
  18. }
  19. )