This repository demonstrates how to send a WhatsApp message using Node.js and the Maytapi WhatsApp API. Maytapi provides a powerful and easy-to-use API for integrating WhatsApp messaging into your applications.
- Send text messages to WhatsApp numbers
- Easy integration with Maytapi WhatsApp API
- Configurable settings for API credentials
- Modern JavaScript features (async/await, ES6+)
- Node.js 12.0 or higher
- npm (Node Package Manager)
- Maytapi account and API credentials
- Clone this repository:
https://github.com/maytapi-com/send-a-message-with-nodejs-using-whatsapp-api.git
cd project-folder
- Install dependencies:
npm i
- Edit
src/config.jsand add your Maytapi credentials:
module.exports = {
PRODUCT_ID: 'your_product_id',
PHONE_ID: 'your_phone_id',
API_KEY: 'your_api_key'
};To send a test message:
node src/sendMessage.jsTo use in your own project:
- Import the sendWhatsAppMessage function:
const sendWhatsAppMessage = require('./src/sendMessage');- Use the function in your code:
sendWhatsAppMessage("905301234567", "Hello World!")
.then(result => console.log(result))
.catch(error => console.error(error));Note
To perform all these operations correctly, you need to register with maytapi.com, get the credentials, and place them in the config file.
Maytapi offers a robust WhatsApp API solution with features like:
- Multi-device support
- Affordable pricing
- Easy integration
- Comprehensive documentation
Learn more about Maytapi's WhatsApp API and how it can benefit your projects.
Contributions are welcome! Please feel free to submit a Pull Request.
For questions about Maytapi's WhatsApp API, visit official documentation or contact support team.