@rabid/pmi-whatsapp-send
is an integration library for the Pipeline Manager to send messages via WhatsApp using the Facebook Graph API.
npm install @rabid/pmi-whatsapp-send
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);
});
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.
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.