Raspberry Pi

Send Push-Notifications by pushsafer.com to iOS, Android and Windows 10 devices out of your Raspberry Pi

a python example pushsafer.py with response of status and data for evaluation

import httplib, urllib
conn = httplib.HTTPSConnection("pushsafer.com:443")
conn.request("POST", "/api",
  urllib.urlencode({
    "k": "<PRIVATEKEY>",                # Your Private or Alias Key
    "m": "<MESSAGE>",                   # Message Text
    "t": "<TITLE>",                     # Title of message
    "i": "<ICON>",                      # Icon number 1-98
    "s": "<SOUND>",                     # Sound number 0-28
    "v": "<VIBRATION>",                 # Vibration number 0-3
    "p": "<PICTURE>",                   # Picture Data URL with Base64-encoded string
  }), { "Content-type": "application/x-www-form-urlencoded" })
response = conn.getresponse()

print response.status, response.reason
data = response.read()
print data

a simple bash script example pushsafer.sh with response of data for evaluation

#!/bin/bash

URL="https://www.pushsafer.com/api"

PRIVATEKEY="" #Your Private or Alias Key
TITLE="Alert"
MESSAGE="Your Message";
DEVICE="131";                #Device or Device Group ID
ICON="11";
SOUND="3";
VIBRATION="0";
PICTURE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADkAAAA5CAIAAAADehTSAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAEMhJREFUeNrUWgmUVNWZvsvbaq+uqm56hYZGQBSFlomAgoigGBJk3I4mk8RJ1PEYJi6MGjN61HhMTIyj54wnLtGMQ9QghDlBDYqgIiAQkR1UkKWbprfqrqqu/W333vlfVUM3TTc00jknuafo87jvvXv/+/3b99/7MGMMnVETovsC456e49eneKv3831GGFyTxPE3ByMi/CUEESpOnAVbljNxv3PDKzCHLPfpxoARB5jw4IWWOOeDkhKGk2W4Kv6wnsFdMRFvw+ksGn0+CkWwzVC/y4ZOSRKpmPhiJ/a4UahchMJI8wlKCaKOjLDOogynkxjrun6Ku4VRBHe5iqjSAzvRp3+l69bTLVtw7AjK6agD8Rvm6UuXE6TifN5BvXfjXKguAfduvZm8sgRFEPJoKFTN6ifzmZeyf7qYj50IeIGMRM8j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d60mWFYQa9GoeNMD8VPPTrjUK4FvCqzbcNmpw2J5BRDQZyyLecAsXZURUuXuX3rEeRRBR46WH3qns8av2rN1o6qcg7VLHbq0/3++WuhamW6YdXWltRfVGdx9INFS9vjWbUi4LAX4J4n/oB/DXjmKwol9UmvQJ9aFogZ9i2LlsXT5kWTR48eGTYtG36ob4o4ttu3c+fO/gwUClsa8Wvvr9u/9XD7x2sbdn0VRRMqnSqe8T4ZHQamClWcqlqcLCiU7pbgtslOVrCzNy9TtLd5XE1o1uV19SOHXT1rTDxlAMC0P4LYj6zwVN60S0u8I0eE66f9YvuWzUgZCeWRc+gKVtVbSQXMkGGgYT5lfDXJGM5KSM/3F84ehVczD7Si5gRStL45BVQBOpEoak4i/fDocRfs/OyRWDzd1pZSVWlQsh7bKOHgT9F49tMvopqLOtxR9PM5AhFQikWWrdr1x7V7pNoymXUfwRRdgcnUbOj49sVj//Xbk5KZODvZPbhTmdgyyefs+nNKq8p8XWkDSqZ+jVYagAQ7ra0zO+6c0ou/Mdo5b+/3dYDQNJFWOXF06fI/fGyGfPIwP0rmu8+gfZoJpcTB6C9/f9t59eOR3opkecBvN2Qlncx+sa9VVmSCcb/xSxqwFiDE45YPN8QajyTwAF9LgPg2F4rUPuGCcffdOueJp1bkr5qo+VUEzijhHJS7q/cuvGPWefW1e/fu1HUhUSzQgEfhoDlNk/EAgg4o6/FDCEmm3duOA4QSKOvyunnw4NFHHr+uubnz1RXb9boy5FVR1gREb7hm0q+e+k5jY1s2a7k0hYsBIx6MLzkHeqf4hGRgez0D+oNxOp2PDPOfMzy8+I+b33h7b0MiV+N3Xz93/G23TG1sSbS1JPw+DxNnSyeGQNbCNwk4lzOCAdeompCRsxKZfNCjaV61sTmRSGQ0TR18oXKK9v8CDABQGn/iqHrP+AAAAABJRU5ErkJggg==";

if [ ${#PRIVATEKEY} == 0 ]
then
	echo "Error: You need to supply an app token"
	exit 1;
fi

if [ ${#MESSAGE} == 0 ]
then
	echo "Error: message may not be empty"
	exit 1;
fi

RESPONSE=`curl -s --data k=$PRIVATEKEY --data-urlencode t="$TITLE" --data-urlencode m="$MESSAGE" --data d="$DEVICE" --data i="$ICON" --data s="$SOUND" --data v="$VIBRATION" --data-urlencode p="$PICTURE" $URL`

echo "Send Push"
echo "| TITLE: $TITLE"
echo "| MESSAGE: $MESSAGE"
echo "| RESPONSE: $RESPONSE"
echo "|____________________"

For more information about replacing values (title, message, icon, icon color, sound, vibration) in your push notification, check out our API description!


© 2016 - 2024 Pushsafer.com, All rights reserved.