pushbullet.endpoint() function

The pushbullet.endpoint() function creates the endpoint for the Pushbullet API and sends a notification of type note.

*Function type: Output*

  1. import "pushbullet"
  2. pushbullet.endpoint(
  3. url: "https://api.pushbullet.com/v2/pushes",
  4. token: ""
  5. )

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 record used to generate the API request. Requires an r parameter.

*Data type: Function*

The returned record must include the following fields (as defined in pushbullet.pushNote()):

  • title
  • text

Examples

Send the last reported status to Pushbullet
  1. import "pushbullet"
  2. import "influxdata/influxdb/secrets"
  3. token = secrets.get(key: "PUSHBULLET_TOKEN")
  4. e = pushbullet.endpoint(token: token)
  5. lastReported =
  6. from(bucket: "example-bucket")
  7. |> range(start: -10m)
  8. |> filter(fn: (r) => r._measurement == "statuses")
  9. |> last()
  10. lastReported
  11. |> e(mapFn: (r) => ({
  12. r with
  13. title: r.title,
  14. text: "${string(v: r._time)}: ${r.status}."
  15. })
  16. )()