Pushover API

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
Grovkillen
Automation Wizard
Posts: 462
Joined: Fri Aug 10, 2012 2:38 pm
Location: Hudiksvall, Sweden
Contact:

Pushover API

Post by Grovkillen » Fri Jan 18, 2019 7:23 am

Code: Select all

//token needs to be generated by adding a application to your user
//user key is automatically generated to your user, but if you want to push info to multiple
//users you need to make a group key
Let>pushover_token=YOUR_APPLICATION_TOKEN
Let>pushover_user_key=YOUR_USER_KEY

Let>pushover_api_url=https://api.pushover.net/1/messages.json

Let>pushover_title=title text
Let>pushover_message=test message body
Let>pushover_device=your_device_name
Let>pushover_priority=1

//You can add all keys found here: https://pushover.net/api
Let>DISABLE_COMPLEX_EXPRESSIONS=1
Let>pushover_json={ "token":"%pushover_token%"%COMMA%
Concat>pushover_json,"user":"%pushover_user_key%"%COMMA%
Concat>pushover_json,"priority":"%pushover_priority%"%COMMA%
Concat>pushover_json,"device":"%pushover_device%"%COMMA%
Concat>pushover_json,"title":"%pushover_title%"%COMMA%
Concat>pushover_json,"message":"%pushover_message%" }
Let>DISABLE_COMPLEX_EXPRESSIONS=0

Let>HTTP_TIMEOUT=5
Let>HTTP_REDIRECTS=1
Let>HTTP_SSL=1
Let>HTTP_POSTJSON=1
HTTPRequest>pushover_api_url,,POST,pushover_json,api_response
//MDL>api_response
Let>ME=%Script%

Running: 15.0.9

NickD
Pro Scripter
Posts: 52
Joined: Fri Sep 23, 2016 2:17 pm

Re: Pushover API

Post by NickD » Mon Jan 13, 2020 4:23 pm

Thanks for posting this Grovekillen, you saved me a job :D
It looks like the API has changed slightly since you posted, but I managed to get it working with a few minor tweaks. Updated code below:

Code: Select all

//token needs to be generated by adding a application to your user
//user key is automatically generated to your user, but if you want to push info to multiple
//users you need to make a group key

Let>equals={("=")}
Let>and={("&")}
Let>plus={("+")}

Let>pushover_token=YOUR_APPLICATION_TOKEN
Let>pushover_user_key=YOUR_USER_KEY
Let>pushover_api_url=https://api.pushover.net/1/messages.json
Let>pushover_title=My Test Title
Let>pushover_message=My test message body
StringReplace>pushover_title,SPACE,%plus%,pushover_title
StringReplace>pushover_message,SPACE,%plus%,pushover_message
Let>pushover_device=your_device_name
Let>pushover_priority=1
//You can add all keys found here: https://pushover.net/api
Let>DISABLE_COMPLEX_EXPRESSIONS=1
Let>pushover_json=token%equals%%pushover_token%%and%
Concat>pushover_json,user%equals%%pushover_user_key%%and%
Concat>pushover_json,priority%equals%%pushover_priority%%and%
Concat>pushover_json,device%equals%%pushover_device%%and%
Concat>pushover_json,title%equals%%pushover_title%%and%
Concat>pushover_json,message%equals%%pushover_message%
Let>DISABLE_COMPLEX_EXPRESSIONS=0
Let>HTTP_TIMEOUT=5
Let>HTTP_REDIRECTS=1
Let>HTTP_SSL=1
Let>HTTP_POSTJSON=1
HTTPRequest>pushover_api_url,,POST,pushover_json,api_response
//MDL>api_response

User avatar
Grovkillen
Automation Wizard
Posts: 462
Joined: Fri Aug 10, 2012 2:38 pm
Location: Hudiksvall, Sweden
Contact:

Re: Pushover API

Post by Grovkillen » Tue Jan 14, 2020 9:46 pm

Thanks for the feedback! 👍
Let>ME=%Script%

Running: 15.0.9

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts