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

@infobip-api/sdk

v0.3.2

Published

Node.js Client SDK for Infobip APIs.

Downloads

19,908

Readme

infobip-api-node-sdk

Node.js Client SDK for Infobip APIs.

Supported Channels

Table of Contents:

General Info

For the @infobip-api/sdk package versioning we use the Semantic Versioning scheme.

Node.js 14 is minimum supported version by this SDK.

License

Published under an MIT License.

Installation

Install the library by using the following command:

npm install @infobip-api/sdk

Code Example

The package is intended to be used with an Infobip account. If you don't already have one, you can create a free trial account here.

This example shows you how to send a WhatsApp text message. The first step is to import the Infobip and AuthType dependencies.

import { Infobip, AuthType } from "@infobip-api/sdk";

Next, you need to create an instance of Infobip with your API Base URL and authentication mechanism. You can find all this information on the Infobip Portal.

let infobip = new Infobip({
  baseUrl: "YOUR_BASE_URL",
  apiKey: "YOUR_API_KEY",
  authType: AuthType.ApiKey,
});

After that you can access all the objects from infobip.channel.

To send text message you can use the infobip.channel.whatsapp.send method and add a payload:

let response = await infobip.channels.whatsapp.send({
  type: "text",
  from: "447860099299",
  to: "447123456789",
  content: {
    text: "Hello World",
  },
});

console.log(response);

E-mail Attachment Example

When sending an E-mail with an attachment or inline image, you'll need follow the below process

``javascript import { Infobip, AuthType } from "@infobip-api/sdk";


Next, you need to create an instance of `Infobip` with your API Base URL and authentication mechanism. You can find all this information on the [Infobip Portal](https://portal.infobip.com/homepage/).

```javascript
let infobip = new Infobip({
  baseUrl: "YOUR_BASE_URL",
  apiKey: "YOUR_API_KEY",
  authType: AuthType.ApiKey,
});

And to send with an attachment, the following way to identify it

let response = await infobip.channels.email.send({
  to: '[email protected]',
  from: 'Tests <[email protected]>',
  subject: 'Testing',
  text: 'hello world',
  attachment: [{
    data: Fs.readFile('/path/to/your/file'),
    name: 'name-of-the-attachment-in-the-email',
  }]
})

console.log(response);

Testing

To run tests position yourself in the project's root after you've installed dependencies and run:

npm run test

Building & Installing a Local Version

To build the project for the first time, position yourself in the project's root and run:

npm install

Subsequent builds can be triggered by using:

npm run build

After building a local version of this SDK, you can use it in a local Node.js project. First, position yourself in the new project root, and then run:

npm install ../path/to/infobip-node