braze-community / braze-node

📫 Node.js library for Braze API.
https://braze-community.github.io/braze-node
MIT License
13 stars 10 forks source link
api appboy braze braze-api javascript nodejs npm rest sdk typescript

braze-api

NPM

NPM version build codecov NPM downloads

Node.js library for Braze. See docs and demo. The types are from Braze's Postman collection.

Quick Start

import { Braze } from 'braze-api'

const braze = new Braze('YOUR_API_URL', 'YOUR_API_KEY')

await braze.messages.send({
  external_user_ids: ['your_external_user_id'],
  messages: {
    email: {
      app_id: 'your_app_id',
      from: 'Company <company@example.com>',
      email_template_id: 'your_email_template_id',
    },
  },
})

Documentation

Prerequisites

Installation

NPM:

npm install braze-api

Yarn:

yarn add braze-api

Usage

The package needs to be configured with your account's REST endpoint and API key:

const { Braze } = require('braze-api')

const braze = new Braze('YOUR_API_URL', 'YOUR_API_KEY')

The same can be done with ES Modules:

import { Braze } from 'braze-api'

const braze = new Braze('YOUR_API_URL', 'YOUR_API_KEY')

API URL

Use the REST endpoint provisioned to your account when you log in to the dashboard:

Instance REST Endpoint
US-01 https://rest.iad-01.braze.com
US-02 https://rest.iad-02.braze.com
US-03 https://rest.iad-03.braze.com
US-04 https://rest.iad-04.braze.com
US-05 https://rest.iad-05.braze.com
US-06 https://rest.iad-06.braze.com
US-08 https://rest.iad-08.braze.com
EU-01 https://rest.fra-01.braze.eu
EU-02 https://rest.fra-02.braze.eu

API Key

The API key can be created in your Braze dashboard.

API Methods

The library supports the following Braze API endpoints. Pull requests are welcome!

Campaigns

Canvas

Catalogs

Content Blocks

Custom Events

Email List

Email Templates

KPI

News Feed

Purchases

Preference Center

Schedule Messages

SCIM

Segments

Send Messages

Sessions

SMS

Subscription Groups

User Data

Live Activity

Contributing

Contributions are welcome! Check out the guide. 👋

License

MIT