Skip to content

Instantly share code, notes, and snippets.

@JagCesar
Created May 16, 2017 07:02
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JagCesar/94e4a2f91d876d8ae2119f70e12ce1ad to your computer and use it in GitHub Desktop.
Save JagCesar/94e4a2f91d876d8ae2119f70e12ce1ad to your computer and use it in GitHub Desktop.
Push Me bash script
#!/bin/sh
message="$1"
curl -so \
- --data "title=$message&token=[token-here]" \
https://pushmeapi.jagcesar.se
@JagCesar
Copy link
Author

Save this to a .sh file, and don't forget to make it executable using the command chmod +x pushMe.sh.

Then you execute it by writing ./pushMe.sh Hello!

@malinnikov
Copy link

malinnikov commented Oct 16, 2017

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.

@malinnikov
Copy link

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

@gdzien
Copy link

gdzien commented Feb 25, 2019

I think this gist should be updated to:

#!/usr/bin/env
message="$1"

curl "title=$message&identifier=my_token" https://pushmeapi.jagcesar.se

@Nocube
Copy link

Nocube commented Jan 23, 2020

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

@Nocube
Copy link

Nocube commented Jan 23, 2020

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

@JagCesar
Copy link
Author

@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
Copy link

Nocube commented Jan 28, 2020

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment