The cost of using the official WhatsApp API is based on a conversation-based pricing model, where businesses pay per 24-hour conversation session with users. Prices range from approximately $0.005 to $0.07 for user-initiated conversations (session messages) and $0.02 to $0.14 for business-initiated ones (template messages), with the first 1,000 conversations per month being free.
@aneeshbakshi72002 ай бұрын
This is why I love your channel. You come up with the best tutorials.
@manfraio2 ай бұрын
Thank you very much.🤜🏻🤛🏻
@alexdioliver2 ай бұрын
Do not ever give up uploading new videos. You're a legend!
@manfraio2 ай бұрын
Thank you my friend. 🤜🏻🤛🏻
@gianlucabredice865223 күн бұрын
Thank you for this video. It's all I needed!
@tchisama6 күн бұрын
i love u bro , i just was about to give up on wb i swear
@manfraio6 күн бұрын
Glad I could help🤜🏻🤛🏻
@JigneshPatel-p8f18 күн бұрын
Very Nice tutorial!
@OnlyJavascript2 ай бұрын
you are amazing bro. but post more tuts. i learned stirpe integration from you and completed a project too. thanks a lot.
@manfraio2 ай бұрын
Thank you for the comment. Glad I could help.🤜🏻🤛🏻
@bernardtowindo1949Ай бұрын
Very helpful, thanks alot.
@dharsanr65042 ай бұрын
Kindly post full stack project tutorials that will be awesome👍
@manfraio2 ай бұрын
Yes, soon there will be full stack tutorials. Stay tuned my friend.🤜🏻🤛🏻
@smartdriver29902 ай бұрын
Thanks for the useful content
@nobudev2 ай бұрын
best release time 🥳
@noelrobin86742 ай бұрын
Hi bro can u do a complete node js tutorial for an app like food delivery app but explained in way that beginners can understand
@manfraio2 ай бұрын
Yes, soon we’re gonna upload entire project tutorials. Delivery app is one of them. Stay tuned!🤜🏻🤛🏻
@noelrobin86742 ай бұрын
@@manfraio Thank you so much man looking forward to it !! 🔥🔥🔥
@innovateignite-753Ай бұрын
Hi! Thank you for video! very informative! What if we want to send verification code for the user? In such a case the user won't answer, we must send the code as a first message. Do you have any idea how to implement this?
@manfraioАй бұрын
Thank you for the comment. You can create a template message with a variable that is gonna be the verification code. Just like on the video, instead of sending the user name on the variable , you send the code. Does that make sense?
@innovateignite-753Ай бұрын
@@manfraio Yes! Awesome! This way I don't need a Twillio in order to send just verification codes;) Thank you!
@innovateignite-753Ай бұрын
@@manfraio Other question, adding my own phone number to sending messages through Whatsapp, can I use the same number on my phone?
@manfraioАй бұрын
The WhatsApp Business API requires you to register a dedicated WhatsApp Business number that is separate from your personal WhatsApp number.
@innovateignite-753Ай бұрын
@@manfraio I found the issue that whatsapp doesn't want to accept my templates with verification code. Do you have any template that they would accept?
@maheshkumar-dn6ofАй бұрын
good, how can I send document(pdf) along text message
@manfraioАй бұрын
Use the upload function to upload the pdf file to whatsapp server: async function uploadFile(filePath) { const data = new FormData() data.append('messaging_product', 'whatsapp') data.append('file', fs.createReadStream(filePath) data.append('type', 'application/pdf') const response = await axios({ url: 'graph.facebook.com/v20.0/phone_number_id/media', method: 'post', headers: { 'Authorization': `Bearer ${process.env.WHATSAPP_TOKEN}` }, data: data }) return response.data.id } Then call the uploadFile function and send a message along with the file: async function sendPDFFile() { const pdfFileId = await uploadFile(filePath) const response = await axios({ url: 'graph.facebook.com/v20.0/phone_number_id/messages', method: 'post', headers: { 'Authorization': `Bearer ${process.env.WHATSAPP_TOKEN}`, 'Content-Type': 'application/json' }, data: JSON.stringify({ messaging_product: 'whatsapp', to: 'phone_number', type: 'document', document: { id: pdfFileId, caption: 'This is message', filename: 'any_filename' } }) }) console.log(response.data) }
@Ola_Editzz12 күн бұрын
you didn't explain on how to receive a text from the bot ?
@manfraio12 күн бұрын
That’s a little more complex cause it envolves webhooks. I’ll create another video for that.
@Ola_Editzz10 күн бұрын
@@manfraio thank you for the response, please is there any way i can send a button menu to a user with whatsapp api
@09avishkargaikwad71Ай бұрын
I'm not able to select the test phone numbers. In your case the test phone is automatically generated but that's not same in my case. Can you provide any guidance?
@manfraioАй бұрын
You mean the test number that whatsapp generated for you to use to send messages or the phone number you add, to send to that number?
@maged_sar7anАй бұрын
@manfraio All of them please 😢
@SathishM-n8iАй бұрын
can we create a chatbot from Whatsapp API with Node.js ?
@manfraioАй бұрын
Yes. You would need to create a webhook on your server to listen for incoming messages, and configure this webhook on your whatsapp business platform: // Webhook to receive messages from WhatsApp app.post('/webhook', (req, res) => { const webhookEvent = req.body; // Check if this is a message event if (webhookEvent.entry && webhookEvent.entry[0].changes && webhookEvent.entry[0].changes[0].value.messages) { const messageEvent = webhookEvent.entry[0].changes[0].value.messages[0]; const from = messageEvent.from; // The user's phone number const messageText = messageEvent.text.body; // The message content // Chatbot logic to respond to the message let responseMessage; // Basic chatbot responses (you can expand this logic) if (messageText.toLowerCase().includes('hello')) { responseMessage = 'Hello! How can I assist you today?'; } else if (messageText.toLowerCase().includes('price')) { responseMessage = 'Our products range from $10 to $100. How can I help with pricing?'; } else if (messageText.toLowerCase().includes('bye')) { responseMessage = 'Goodbye! Have a great day!'; } else { responseMessage = 'Sorry, I did not understand that. Can you please rephrase?'; } // Send the response back to the user sendMessage(from, responseMessage); } // Send a 200 OK response back to WhatsApp res.sendStatus(200); }); // Verification route to verify the webhook with WhatsApp app.get('/webhook', (req, res) => { const verifyToken = process.env.VERIFY_TOKEN || 'your_verify_token'; const mode = req.query['hub.mode']; const token = req.query['hub.verify_token']; const challenge = req.query['hub.challenge']; // Validate the webhook token if (mode && token === verifyToken) { console.log('Webhook Verified'); res.status(200).send(challenge); } else { res.sendStatus(403); } });
@insidedocumentary31622 ай бұрын
Bro how can i add multiple number you didn't tell that
@manfraio2 ай бұрын
You have to loop inside an array of numbers. Till today the api only allow to send to one number.
@manfraio2 ай бұрын
Here’s an example: const phoneNumbers = ['1234567890', '0987654321', '1123456789']; // Message you want to send const messageText = 'Hello from WhatsApp via Node.js!'; // Loop through each phone number and send a message phoneNumbers.forEach(async (phoneNumber) => { try { // Send the message const response = await axios.post( apiURL, { messaging_product: 'whatsapp', to: phoneNumber, type: 'text', text: { body: messageText } }, { headers: { 'Authorization': `Bearer ${accessToken}`, 'Content-Type': 'application/json' } } ); console.log(`Message sent to ${phoneNumber}:`, response.data); } catch (error) { console.error(`Failed to send message to ${phoneNumber}:`, error.response ? error.response.data : error.message); } });
@insidedocumentary31622 ай бұрын
@@manfraio Bother For Production level I want to send message on any Whatsapp like through my postmen, i take that number through user and send messages to that number is it possible?
@manfraio2 ай бұрын
@insidedocumentary3162 yes, but you cannot send any message. You have to send an template
@insidedocumentary31622 ай бұрын
@@manfraio Yes i should send Template now is there any setting i have to do on face portal, 2nd the code you provide is enough to send Template message to anyone without adding there number in Facebook Developer Test Number list