Action

Send to Pushover

Posted by deanfx, Last update about 7 hours ago

This action will send the contents of the active draft to Pushover.

At first run, it will require you to provide your userKey and appToken. Be sure to have this ready!

The token and key are stored within drafts credentials.

To manage the credentials used, or to change:
Drafts Settings > Credentials > Pushover Credentials

Steps

  • script

    // Credential Registration
    let credential = Credential.create("Pushover Config", "Enter your Pushover API details.");
    
    credential.addTextField("uKey", "User Key");
    credential.addPasswordField("aToken", "API Token");
    
    if (credential.authorize()) {
      const userKey = credential.getValue("uKey");
      const appToken = credential.getValue("aToken");
      
      let http = HTTP.create();
      let response = http.request({
        "url": "https://api.pushover.net/1/messages.json",
        "method": "POST",
        "parameters": {
          "token": appToken,
          "user": userKey,
          "title": draft.displayTitle,
          "message": draft.content || "(No Body Content)"
        }
      });
    
      if (response.statusCode == 200) {
        app.displaySuccessMessage("Pushed!");
      } else {
        alert("Error: " + response.responseText);
        context.fail();
      }
    }

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.