@rabid/pmi-whatsapp-send
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

@rabid/pmi-whatsapp-send

@rabid/pmi-whatsapp-send is an integration library for the Pipeline Manager to send messages via WhatsApp using the Facebook Graph API.

Installation

npm install @rabid/pmi-whatsapp-send

Usage

import { WhatsAppSend } from '@rabid/pmi-whatsapp-send';

const whatsappSend = new WhatsAppSend({
  accessToken: 'your-access-token',
  apiVersion: 'v13.0'
});

const input = {
  senderPhoneId: 'your-sender-phone-id',
  type: 'text',
  text: {
    body: 'Hello, this is a test message!'
  }
};

// Execute a message send
whatsappSend.execute(input).then(response => {
  console.log(response);
});

API

WhatsAppSend

constructor(config: WhatsAppConfig)

Creates an instance of WhatsAppSend.

  • config: The configuration object for WhatsAppSend.
    • accessToken: A valid access token for authenticating API requests.
    • apiVersion: The version of the API to be used.

execute(input: TextInput | LocationInput | InteractiveInput): Promise<ExecutionResponse | void>

Executes a message sending operation based on the input type.

  • input: The input object containing the details needed to send a message, including sender information and message type.
    • senderPhoneId: The phone ID of the sender.
    • type: The type of the message (e.g., 'text', 'location', 'interactive').
    • text: Optional. The text message content.
    • location: Optional. The location message content.
    • interactive: Optional. The interactive message content.

Readme

Keywords

none

Package Sidebar

Install

npm i @rabid/pmi-whatsapp-send

Weekly Downloads

6

Version

2.0.0

License

Affero GPL-3.0

Unpacked Size

37 kB

Total Files

17

Last publish

Collaborators

  • jmdiego