Skip to content

Instantly share code, notes, and snippets.

@Streemo
Created July 24, 2016 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Streemo/58fbfa370976c183897455b2e52d7c97 to your computer and use it in GitHub Desktop.
Save Streemo/58fbfa370976c183897455b2e52d7c97 to your computer and use it in GitHub Desktop.
Unified SMS/Push Notification API (android + ios + text messaging), ~WIP
import { Messages } from "./Notifications.js" //import
//uses AWS SNS under the hood for all payload delivery
//send a push notification
//will determine whether or not to send to android or ios automatically.
Messages.send({
title: "This is a short Title",
text: "This is the body of the message and is expected to be more detailed and most likely longer...",
users: ["userId1", "userId2", ...],
data: {
some: "customizedData"
}
})
//send a text message with the same API
Messages.send({
text: "This is the body of the message and there is no Title for text messages",
numbers: ["+1 123 456 7890", "+1 098 765 4321"] //E.164 format
})
//The implementation isn't fleshed out yet, but I'll try and post something to my github soon!
//I've re-written this package: https://github.com/mmmelon/sns-push
//My additions are minimal, I've made mongo updates a bit more efficient and added support for batch sending.
//Also, I've added the ~polymorphic support for sending texts AND push notifications.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment