Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Push Me bash script
#!/bin/sh
message="$1"
curl -so \
- --data "title=$message&token=[token-here]" \
https://pushmeapi.jagcesar.se
@JagCesar

This comment has been minimized.

Copy link
Owner Author

@JagCesar JagCesar commented May 16, 2017

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

@malinnikov malinnikov commented Oct 16, 2017

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Owner Author

@JagCesar JagCesar commented Jan 23, 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!

@Nocube

This comment has been minimized.

Copy link

@Nocube 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
You can’t perform that action at this time.