# google-instanceid-batchimport

> NodeJS library for accessing the batchImport method of the Google Instance ID service

Latest version **0.0.2** (published 2019-10-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install google-instanceid-batchimport
pnpm add google-instanceid-batchimport
yarn add google-instanceid-batchimport
bun add google-instanceid-batchimport
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2019-10-09 |
| First published | 2019-10-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Y. Wayne Huang |
| Maintainers | wayne530 |
| Keywords | google, instanceid, iid, batchimport, apns, fcm, token |

## Links

- npm: https://www.npmjs.com/package/google-instanceid-batchimport
- Repository: https://github.com/hero-group/google-instanceid-batchimport
- Homepage: https://github.com/hero-group/google-instanceid-batchimport#readme
- Issues: https://github.com/hero-group/google-instanceid-batchimport/issues
- npm.io page: https://npm.io/package/google-instanceid-batchimport

## Dependencies (1)

- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2019-10-09
- 0.0.1 — 2019-10-08

## README

# google-instanceid-batchimport

Lightweight client implementing only the `batchImport` method of the Google Instance ID
service. This is useful for mapping one or more (up to 100) APNs tokens to GCM/FCM
tokens. See: https://developers.google.com/instance-id/reference/server#create_registration_tokens_for_apns_tokens

## Installation

```shell script
npm install --save google-instanceid-batchimport
```

## Usage
```ecmascript 6
const BatchImportService = require('google-instanceid-batchimport');
const service = BatchImportService(FCM_SERVER_KEY);
service.batchImport(
    'com.mydomain.myapp',
    true,
    [
        'apnstoken1',
        'apnstoken2',
        // ... etc    
    ]
).then(response => {
    if (response.status === 200) {
        return response.json();    
    }
    throw new Error(`Request returned ${response.status}`);
}).then(data => {
    for (let token of data.results) {
        console.log(`${token.apns_token} mapped to ${token.registration_token}`);    
    }
});
```

---
_Source: https://npm.io/package/google-instanceid-batchimport · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
