-
-
Save JagCesar/94e4a2f91d876d8ae2119f70e12ce1ad to your computer and use it in GitHub Desktop.
#!/bin/sh | |
message="$1" | |
curl -so \ | |
- --data "title=$message&token=[token-here]" \ | |
https://pushmeapi.jagcesar.se | |
Hello there, thanks for the cool service! I have a question: should parameter be "token" or "identifier", as mentioned in the iOS app? I managed to send notifications before but now I can't see pushes on device with either parameter name.
Ah, never mind, both do work. I just had to change the script to make it work on macOS Sierra:
message="$1"
curl -d "title=$message&token=my_token" -X POST https://pushmeapi.jagcesar.se
I think this gist should be updated to:
#!/usr/bin/env
message="$1"
curl "title=$message&identifier=my_token" https://pushmeapi.jagcesar.se
Hi, I made a Python Post function, as curl is not available on all my platforms. I thought it might be helpful to others. Many thanks for this awesome app!
Dano.
import requests
'''Send Message to Push Me App via HTTP POST Request.
This mimics the Curl headers.'''
def PostAlert(secret_tok, msg):
url = 'https://pushmeapi.jagcesar.se'
data='title=' + msg + '&token=' + secret_tok
headers = {'Host': 'pushmeapi.jagcesar.se', 'User-Agent': 'curl/7.55.1', 'Accept': '*/*', \
'Content-Length': str(len(data)), 'content-type': 'application/x-www-form-urlencoded'}
r = requests.post(url, data, headers=headers)
print(r.text)
'''Get the Secret Token from the Push Me App, look in Inboxes -> Share Identifier, and set it here. '''
pushme_secret_tok = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
'''Send Test message'''
pushme_msg = 'This text will go to your Push Me App'
PostAlert(pushme_secret_tok, pushme_msg)
I forked the code for my python version of the Push Me Script:
https://gist.github.com/Nocube/0b63a165f9267b721924d58a81b006f6
Just in case anyone needs to run this on Windows here is a command shell example:
C:\Windows\System32\curl.exe -o NUL -s -d "title=Text Message&token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -X POST https://pushmeapi.jagcesar.se
@Nocube I don't speak python ๐, but thanks for sharing that snippet with the community! I took the liberty to modify your comment and make it render as code. Feel free to edit it accordingly. Have a nice day!
@Nocube I don't speak python ๐, but thanks for sharing that snippet with the community! I took the liberty to modify your comment and make it render as code. Feel free to edit it accordingly. Have a nice day!
Thanks Jag.
Save this to a
.sh
file, and don't forget to make it executable using the commandchmod +x pushMe.sh
.Then you execute it by writing
./pushMe.sh Hello!