Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Send functional, flexible push notifications to iOS, Android, and desktop devices (without your own app or website).

License

Notifications You must be signed in to change notification settings

spontit/spontit-api-python-wrapper

Repository files navigation

SPONTIT 📳

Check out our complete API documentation at api.spontit.com. Our API repository is available here.

Send push notifications without your own app. 👊

Using the Spontit API and Spontit app/webapp, you can send your own push notifications programmatically to Android, iOS, and Desktop devices. You can send your own in less than 5 minutes. 😎 🏆 (Without touching Swift, Objective-C, Java, XCode, Android Studio, the App Store approval process... 😵).

This repository is the Python wrapper for our API. To see code snippets for several languages, see our documentation here.

RAPID START 🏃

Spontit is 100% free! Please star the repo and rate/review the Spontit app in the App Store as well. Please invite a friend or two to Spontit!

  1. Sign up at spontit.com (you might need to click "Take me to the Desktop version"). Note down your username. It should be displayed on your profile once you are signed in.

  2. Get a secret key at spontit.com/secret_keys.

  3. Get the iPhone app or Android app. Sign in with the same account and allow notifications. See Step 11 to invite others.

  4. pip install spontit --upgrade && pip install requests

  5. from spontit import SpontitResource

  6. resource = SpontitResource(my_username, my_secret_key)

  7. response = resource.push("Hello!")

  8. Run the command help(SpontitResource) in Python for complete documentation.

  9. Or try an example! Check out the examples.

  10. You can customize the image of the notification on the website, iPhone app, or via the API by setting the image for the respective channel. See the image example titled create_new_channel_with_profile_image_and_push_to_it in the examples.

  11. To push to others, you can do two things.
    a) Have them sign up with a known email or phone number. Then push to them directly using their email or phone number. They do not have to follow you in order to receive the push. See simple_push_to_specific_phone_numbers_and_emails_example for an example (in the examples file).
    b) Have them follow the channel to which you will push (e.g. share spontit.com/my_username). You can see available invite options by calling print(resource.get_channel(...)) and supply the channel name. See the functions titled create_new_channel_and_get_invite_options and get_invite_options_for_my_main_account in the examples.

  12. Spontit is more than just broadcasting. You can send pushes to specific users and push personalized content. See how to do so at simple_push_to_specific_followers_example, simple_push_to_specific_phone_numbers_and_emails_example, and specific_followers_and_channel_example in the examples. You simply input a list of usernames and it will push to those users (provided they follow the specified channel) -- or input a list of phone numbers and emails (they do not have to follow the given channel; see part 11(a)). You can list the usernames of those who follow one of your specified channels. See an example of how to do so at list_followers_example and list_followers_for_channel_example in the examples.

  13. We are constantly working on expanding the functionality of Spontit. We GREATLY appreciate your input - feel free to add a feature request on our Github. 😃

Getting Started ✅

Make an Account

First, go to spontit.com or download the Spontit app. Create an account and get your user ID. To see your user ID in the app, tap the "Profile" tab. To see your user ID on the website, look at the top of the screen.

You can change your user ID at any time here.

Generate a Secret Key

Once you have made an account, generate a secret key here. You might have to re-authenticate.

Push Notification UI Anatomy

You can change your user ID and display name at any time here.

Above we see a push notification sent to the main channel. Here, "Josh Wolff" is the display name of the user. The push message is the displayed text. The image shown is the personal profile picture of the user (see step 10 above). If the user opens the notification, they can open a link attached, if any, among other options (help(SpontitResource)). If they have an iPhone, they can like and comment on the notification.

Above we see a push notification to a channel (separate from the main channel). Josh owns this channel, but as you can see, it looks like its own account. "Dem 2020 Polls" is the channel name, the non-bold text is the message, and the image is the image set for the channel (see step 10 above). You can also change the push title with the pushTitle attribute.

Note on Our Development Priorities

We prioritize development of the iOS application over the website. If at any time, we describe a feature and it does not seem to be on the website, it might only exist in the iOS application. Please email us at info {at} spontit {dot} com so that we can clarify this to you and other developers. You are more than welcome to add a feature request.