# sendpulse-api-request

> A simple SendPulse API client library for Node.js

Latest version **0.0.2** (published 2021-10-09) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install sendpulse-api-request
pnpm add sendpulse-api-request
yarn add sendpulse-api-request
bun add sendpulse-api-request
```

## 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 | 2021-10-09 |
| First published | 2021-10-09 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 20.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | SendPulse |
| Maintainers | dshemendiuk |
| Keywords | sendpulse, api |

## Links

- npm: https://www.npmjs.com/package/sendpulse-api-request
- Repository: https://github.com/dshemendiuk/sendpulse-api-request
- Issues: https://github.com/dshemendiuk/sendpulse-api-request/issues
- npm.io page: https://npm.io/package/sendpulse-api-request

## Recent versions

- 0.0.2 (latest) — 2021-10-09
- 0.0.1 — 2021-10-09

## README

# SendPulse API Request
A simple [SendPulse API](https://sendpulse.com/api) client wrapper for Node.js.


### Install

```
npm install sendpulse-api-request
```

### Usage
This module helps you with authorization and you just perform requests to native SendPulse API methods endpoints with specific parameters. 

```javascript
const sendpulse = require("sendpulse-api-request");
const TOKEN_STORAGE = "/tmp/";

/*
 * Initialization with SendPulse credentials https://login.sendpulse.com/settings/#api
 */
sendpulse.init("USER_ID", "USER_SECRET", TOKEN_STORAGE, function() {console.log});

/*
 * Get a list of WhatsApp chats (https://sendpulse.com/integrations/api/chatbot/whatsapp#/chats/get_chats)
 */
sendpulse.sendRequest("/whatsapp/chats", "GET", {"bot_id": "XXXXXXXXXXXX"}, function(data) {
    console.log(JSON.stringify(data))
});

/*
 * Send a WhatsApp message to a phone number (https://sendpulse.com/integrations/api/chatbot/whatsapp#/contacts/post_contacts_sendByPhone)
 */
sendpulse.sendRequest("/whatsapp/contacts/sendByPhone", "POST", {
    "bot_id": "XXXXXXXXXXXX",
    "phone": "1XXXXXXXXXX",
    "message": {
        "type": "text",
        "text": {
            "body": "sample text"
        }
    }
}, function(data) {
    console.log(data)
});
```

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