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:

Exploring Nushell, A Rust Powered, Cross Platform Shell

Exploring Nushell, a Rust-powered, cross-platform shell

Nushell is a modern, performant, extensible shell built with Rust. Explore its pros, cons, and how to install and get started with it.

Oduah Chigozie
Apr 23, 2024 ⋅ 6 min read
Exploring Zed, A Newly Open Source Code Editor Written In Rust

Exploring Zed, an open source code editor written in Rust

The Zed code editor sets itself apart with its lightning-fast performance and cutting-edge collaborative features.

Nefe Emadamerho-Atori
Apr 22, 2024 ⋅ 7 min read
Implementing Infinite Scroll In Next Js With Server Actions

Implementing infinite scroll in Next.js with Server Actions

Infinite scrolling in Next.js no longer requires external libraries — Server Actions let us fetch initial data directly on the server.

Rahul Chhodde
Apr 19, 2024 ⋅ 10 min read
Integrating Django Templates With React For Dynamic Webpages

Integrating Django templates with React for dynamic webpages

Create a dynamic demo blog site using Django and React to demonstrate Django’s server-side functionalities and React’s interactive UI.

Kayode Adeniyi
Apr 18, 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