UNPKG

onxy-messaging

Version:

A Node.js module for sending WhatsApp messages using onyxberry.com/services/wapi

56 lines (40 loc) 1.7 kB
# Onxy Messaging A Node.js module for sending WhatsApp messages using a third-party API. ## Installation Install the module using npm: ```bash npm install onxy-messaging Usage const OnxyMessaging = require('onxy-messaging'); const yourId = 'your_id'; const apiKey = 'your_api_key'; const onxy = new OnxyMessaging(yourId, apiKey); // Example: Sending a simple text message onxy.sendSimpleTextMessage('recipient_number', 'Hello, this is a test message') .then(response => console.log(response)) .catch(error => console.error(error)); // Other methods: // - onxy.sendMediaFromURL('recipient_number', 'media_url', 'Optional caption') // - onxy.sendTextInGroup('group_name', 'message') // - onxy.sendMediaFromURLInGroup('group_name', 'media_url', 'Optional caption') API Methods sendSimpleTextMessage(number, message) Send a simple text message to the specified number. number: Recipient's phone number. message: Text message to be sent. sendMediaFromURL(number, url, caption) Send images/PDF/documents, etc., from a URL to the specified number. number: Recipient's phone number. url: URL of the media file. caption (Optional): Caption for the media file. sendTextInGroup(groupName, message) Send a text message to a WhatsApp group. groupName: Name of the WhatsApp group. message: Text message to be sent. sendMediaFromURLInGroup(groupName, url, caption) Send images/PDF/documents, etc., from a URL to a WhatsApp group. groupName: Name of the WhatsApp group. url: URL of the media file. caption (Optional): Caption for the media file. License This project is licensed under the MIT License - see the LICENSE file for details.