npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rileybarabash/sendblue-ts

v0.1.1

Published

A Typescript Node.js wrapper for the Sendblue API, a service for seamlessly integrating your apps with iMessage.

Downloads

390

Readme

Sendblue for Node.js

Overview

"sendblue-ts" is a Typescript-friendly Node.js wrapper for the Sendblue API, providing a seamless interface for sending and receiving messages.

Prerequisites

Before using this library, you need to get your API keys from Sendblue by signing up for an account here.

Installation

Install the sendblue-ts package using your favourite package manager:

pnpm add @rileybarabash/sendblue-ts

Usage

Initialization

Initialize a new Sendblue instance with your API keys. You can do so in separate file and import it as a module, or directly in your code.

import { env } from "process"
import Sendblue from "@rileybarabash/sendblue-ts"

/**
 * Initialize a Sendblue instance.
 */
export const sendblue: Sendblue = new Sendblue(env.SENDBLUE_PK ?? "", env.SENDBLUE_SK ?? "")

Send Message

Sends a message to a single recipient.

const response: SendMessageResponse = await sendblue.sendMessage({
    number: "+19998887777",
    content: "Hello from Sendblue!",
    sendStyle: "invisible",
    mediaUrl: "https://source.unsplash.com/random.png",
    statusCallback: "https://example.com/callback"
})

Send Group Message

Sends a message to a group of recipients.

const response: SendblueAPIResponse = await sendblue.sendGroupMessage({
    numbers: ["+19998887777", "+19998887778"],
    content: "Hello from Sendblue!",
    sendStyle: "invisible",
    mediaUrl: "https://source.unsplash.com/random.png",
    statusCallback: "https://example.com/callback"
})

Get Message

Gets the message associated with the provided ID.

const response: SendblueAPIResponse = await sendblue.getMessage({ id: "messageId" })

Modify Group

Modifies a message group. Currently only supports adding recipients.

const response: SendblueAPIResponse = await sendblue.modifyGroup({
    groupId: "groupId",
    modifyType: "add_recipient",
    number: "+19998887777"
})

Lookup Number

Checks if a number is registered with iMessage.

const response: SendblueAPIResponse = await sendblue.lookup({ number: "+19998887777" })

Send Typing Indicator

Sends a typing indicator to the specified recipient.

const response: SendblueAPIResponse = await sendblue.sendTypingIndicator({ number: "+19998887777" })

Get Contacts

Retrieves a list of contacts associated with the Sendblue account.

const response: SendblueAPIResponse = await sendblue.getContacts()

Create Contact

Creates a contact from a recipient's contact details.

const response: SendblueAPIResponse = await sendblue.createContact({
    number: "+19998887777",
    firstName: "First Name",
    lastName: "Last Name",
    companyName: "Company Name"
})

Delete Contact

Deletes a contact with the specified ID.

const response: SendblueAPIResponse = await sendblue.deleteContact({ id: "contactId" })

Get Messages

Gets all of the messages associated with a contact.

const response: SendblueAPIResponse = await sendblue.getMessages({ contactId: "contactId" })

For more details and options, refer to the Sendblue API Documentation.

Made with <3 in YEG <Edmonton, Alberta>