npm.io
2.3.1 • Published 9 years ago

exponent-server-sdk

Licence
MIT
Version
2.3.1
Deps
3
Vulns
1
Weekly
0
Stars
1.0K
DeprecatedThis package is deprecated

exponent-server-sdk-node

Server side library for working with Exponent using Node.js

Usage

yarn add exponent-server-sdk
import Expo from 'exponent-server-sdk';

// To check if something is a push token
let isPushToken = Expo.isExponentPushToken(somePushToken);

// Create a new Expo SDK client
let expo = new Expo();

// To send push notifications -- note that there is a limit on the number of
// notifications you can send at once, use expo.chunkPushNotifications()
(async function() {
  try {
    let receipts = await expo.sendPushNotificationsAsync([{
      // The push token for the app user to whom you want to send the notification
      to: 'ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]',
      sound: 'default',
      body: 'This is a test notification',
      data: {withSome: 'data'},
    }]);
    console.log(receipts);
  } catch (error) {
    console.error(error);
  }
})();

Developing

The source code is in the src/ directory and babel is used to turn it into ES5 that goes in the build/ directory.

To build, npm run build.

To build and watch for changes, npm run watch.

TODO

  • Need to add tests

See Also

Keywords