# streambird

> Node.js library for the Streambird API

Latest version **1.0.9** (published 2022-08-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install streambird
pnpm add streambird
yarn add streambird
bun add streambird
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2022-08-08 |
| First published | 2022-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 211.2 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | Streambird |
| Maintainers | tim-streambird, quangsb |
| Keywords | streambird, passwordless authentication, verification, api |

## Links

- npm: https://www.npmjs.com/package/streambird
- Repository: https://github.com/streambird/streambird-node
- Homepage: https://github.com/streambird/streambird-node#readme
- Issues: https://github.com/streambird/streambird-node/issues
- npm.io page: https://npm.io/package/streambird

## Dependencies (2)

- [jose](https://npm.io/package/jose.md) ^4.6.2
- [axios](https://npm.io/package/axios.md) ^0.21.1

## Alternatives

- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads
- [escher-request](https://npm.io/package/escher-request.md) — 545 weekly downloads

## Recent versions

- 1.0.9 (latest) — 2022-08-08
- 1.0.8 — 2022-08-08
- 1.0.7 — 2022-08-07
- 1.0.6 — 2022-06-12
- 1.0.5 — 2022-06-08
- 1.0.4 — 2022-06-07
- 1.0.3 — 2022-04-29

## README

# Streambird Node.js Library

The official Node.js library for integrating with the Streambird API.

Documentation can be found at <https://developers.streambird.io/>

This library is only for use on the backend, as it uses Streambird API tokens which must be kept secret.

This version uses Streambird API v1.0.

## Installation

For npm:

```sh
npm install streambird
```

For Yarn:

```sh
yarn add streambird
```

## Getting started

Require the package:

```js
const { Streambird } = require("streambird");
```

For TypeScript users, types are available as well:

```ts
import { Streambird, User, StreambirdApiError } from "streambird";
```

Configure with your API token and region:

```js
const streambird = new Streambird({
  apiKey: process.env.STREAMBIRD_API_TOKEN,
});
```

Using with `async`/`await` (in an `async function`):

```js
try {
  const user = await streambird.users.create({
    firstName: "Wayne",
    middleName: "Payne",
    lastName: "Schmein",
    email: "wayneps@streambird.io",
    phoneNumber: "+15555551000",
    requiresVerification: true,
  });

  return user;
} catch (error) {
  if (error instanceof StreambirdApiError) {
    console.log(error.message);
    console.log(error.type);
    console.log(error.isClientError());
  } else {
    console.log(error.message);
  }
}
```

Using with promises:

```js
streambird.users
  .create({
    firstName: "Wayne",
    middleName: "Payne",
    lastName: "Schmein",
    email: "wayneps@streambird.io",
    phoneNumber: "+15555551000",
    requiresVerification: true,
  })
  .then(user =>
    // Handle successfully created user.
  )
  .catch(error => {
    // Handle error.
  });
```

## Response format

Most responses will be normal JavaScript objects. Property names will be in camelCase rather than snake_case, including property names in nested objects.

```js
const user = await streambird.users.create({
  firstName: "Wayne",
  middleName: "Payne",
  lastName: "Schmein",
  email: "wayneps@streambird.io",
  phoneNumber: "+15555551000",
  requiresVerification: true,
});

console.log(user);
{
  userId: "user_27omXGknF0uVnO4fpVLbP6cVM8v",
  appId: "0a6aa9d3-2786-461c-950e-c4b9e00c826e",
  firstName: "Wayne",
  middleName: "Payne",
  lastName: "Schmein",
  status: "pending",
  active: false,
  updatedAt: 1649994850,
  createdAt: 1649994850,
  emails: null,
  phoneNumbers: null,
  wallets: null,
  emailId: "email_27omXJMY3TqFKQrlZLNFDoifWwV",
  phoneNumberId: "pn_27omXFBBiC5JC0UFNmA2X5JtGg3",
  requiresVerification: true,
  email: "wayneps@streambird.io",
  phoneNumber: "+15555551000"
}
```

## More documentation

More documentation and code examples can be found at <https://developers.streambird.io/>

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