Created
July 24, 2016 19:30
-
-
Save Streemo/58fbfa370976c183897455b2e52d7c97 to your computer and use it in GitHub Desktop.
Unified SMS/Push Notification API (android + ios + text messaging), ~WIP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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