2022-07-25
5391
#ecommerce#node
Daggie Douglas Mwangi
125063
Jul 25, 2022 ⋅ 19 min read

Build an automated ecommerce app with WhatsApp Cloud API and Node.js

Daggie Douglas Mwangi My name is Daggie. I am a software engineer, a polymath, a product hacker-cum-builder, and a developer mentor. Through these articles, I will walk you through APIs, product hacks, code best practices, emerging tech, and everything in between. Follow me on Twitter and GitHub @daggieblanqx.

Recent posts:

Building a Full-Featured Laravel Admin Dashboard with Filament

Building a full-featured Laravel admin dashboard with Filament

Build scalable admin dashboards with Filament and Laravel using Form Builder, Notifications, and Actions for clean, interactive panels.

Kayode Adeniyi
Dec 20, 2024 ⋅ 5 min read
Working With URLs In JavaScript

Working with URLs in JavaScript

Break down the parts of a URL and explore APIs for working with them in JavaScript, parsing them, building query strings, checking their validity, etc.

Joe Attardi
Dec 19, 2024 ⋅ 6 min read
Lazy Loading Vs. Eager Loading

Lazy loading vs. Eager loading

In this guide, explore lazy loading and error loading as two techniques for fetching data in React apps.

Njong Emy
Dec 18, 2024 ⋅ 5 min read
Deno logo over an orange background

How to migrate your Node.js app to Deno 2.0

Deno is a popular JavaScript runtime, and it recently launched version 2.0 with several new features, bug fixes, and improvements […]

Yashodhan Joshi
Dec 17, 2024 ⋅ 7 min read
View all posts

21 Replies to "Build an automated ecommerce app with WhatsApp Cloud API and Node.js"

  1. I have a problem, I tried to make my own, I even tested your application, but anyway it seems that it goes into a loop, the chatbot keeps flooding, it seems to have something to do with the webhooks, in addition to those webhook configurations, something was missing that you forgot to suggest?

    1. Hello, I am getting a 404 error and facebook is not validating my callback link. You have any idea why the app.js file is not picking up the indexroutes

    2. Hi @Rebot
      Im reaching out to see if you managed to get around the “chatbot flooding messages to users” part?
      I created mine too and from time to time the chatbot seems to send duplicate responses to users?

  2. A brilliant blog and an even better Node.js library. I can highly recommend the library to ANY developer wanting to integrate with the WhatsApp Cloud API. Well done to all contributors!

  3. Thanks for the example it works but I get a cyclic repetition of the POST.
    POST: Someone is pinging me!
    POST: Someone is pinging me!
    POST: Someone is pinging me!
    POST: Someone is pinging me!

    How can I avoid it?. Thank you.

    1. Hello @Jairo and @Rebot.

      Change the below block of code from:

      const WhatsappCloudAPI = require(‘whatsappcloudapi_wrapper’);
      const Whatsapp = new WhatsappCloudAPI({
      accessToken: process.env.Meta_WA_accessToken,
      senderPhoneNumberId: process.env.Meta_WA_SenderPhoneNumberId,
      WABA_ID: process.env.Meta_WA_wabaId,
      });

      to this:

      const WhatsappCloudAPI = require(‘whatsappcloudapi_wrapper’);
      const Whatsapp = new WhatsappCloudAPI({
      accessToken: process.env.Meta_WA_accessToken,
      senderPhoneNumberId: process.env.Meta_WA_SenderPhoneNumberId,
      WABA_ID: process.env.Meta_WA_wabaId,
      graphAPIVersion:’ v14.0′
      });

  4. Olá.

    Estoura um erro no console quando realizo um teste no webhook.

    POST: Someone is pinging me!
    {
    error: Error: WABA_ID is not valid. Hint: the message is not intended for this Whatsapp Business Account.
    at module.exports (C:\Users\cleyton\Documents\app.whatsOficial\api-whats-oficial\node_modules\whatsappcloudapi_wrapper\msg_parser.js:24:15)
    at WhatsappCloud.parseMessage (C:\Users\cleyton\Documents\app.whatsOficial\api-whats-oficial\node_modules\whatsappcloudapi_wrapper\index.js:867:16)
    at C:\Users\cleyton\Documents\app.whatsOficial\api-whats-oficial\routes\index.js:43:25
    at Layer.handle [as handle_request] (C:\Users\cleyton\Documents\app.whatsOficial\api-whats-oficial\node_modules\express\lib\router\layer.js:95:5)
    at next (C:\Users\cleyton\Documents\app.whatsOficial\api-whats-oficial\node_modules\express\lib\router\route.js:144:13)
    at Route.dispatch (C:\Users\cleyton\Documents\app.whatsOficial\api-whats-oficial\node_modules\express\lib\router\route.js:114:3)
    at Layer.handle [as handle_request] (C:\Users\cleyton\Documents\app.whatsOficial\api-whats-oficial\node_modules\express\lib\router\layer.js:95:5)
    at C:\Users\cleyton\Documents\app.whatsOficial\api-whats-oficial\node_modules\express\lib\router\index.js:284:15
    at Function.process_params (C:\Users\cleyton\Documents\app.whatsOficial\api-whats-oficial\node_modules\express\lib\router\index.js:346:12)
    at next (C:\Users\cleyton\Documents\app.whatsOficial\api-whats-oficial\node_modules\express\lib\router\index.js:280:10)

    Pode ajudar o que pode ser esse erro, ja verigiquei o id da conta Bussiness.

  5. Hi.I was following this tutorial and was working for a month it was working fine but when now I am trying to configure webhook i am getting an “The callback URL or verify token couldn’t be validated. Please verify the provided information or try again later” error.I tried to create with all new accounts but still i am getting this error.Can you please suggest what should I do?

    1. Olá. Passei por problema parecido.
      Tente a tag — region au no ngrok.
      Na documentação você pode especificar a região do seu servidor usando essa tag. Ficando:
      ngrok http 8000 –region au
      Na documentação tem as regiões disponíveis.

  6. Hie. Thanks for this great article. I have been following through the steps outlines but when i try to configure webhooks url on facebook it gives this error.
    “The URL couldn’t be validated. Response does not match challenge, expected value=”481656951″, received=”\u003C!DOCTYPE html>\n\u003Ch…“

  7. Hie. I am getting this error when i try to configure webhooks
    `The URL couldn’t be validated. Response does not match challenge, expected value=”481656951″, received=”\u003C!DOCTYPE html>\n\u003Ch…”`

  8. Dear @daggieblanqx,

    I wanted to express my gratitude for the outstanding work you have done on this article. Your clear and concise step-by-step instructions have made it easy for anyone to understand and implement. As a result, I was able to successfully create an ecommerce WhatsApp bot using your guidance. Your hard work has paid off and I want to give you my sincerest compliments. Keep up the excellent work.

    Best regards,

    Luke

Leave a Reply