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:

Rxjs Adoption Guide: Overview, Examples, And Alternatives

RxJS adoption guide: Overview, examples, and alternatives

Get to know RxJS features, benefits, and more to help you understand what it is, how it works, and why you should use it.

Emmanuel Odioko
Jul 26, 2024 ⋅ 13 min read
Decoupling Monoliths Into Microservices With Feature Flags

Decoupling monoliths into microservices with feature flags

Explore how to effectively break down a monolithic application into microservices using feature flags and Flagsmith.

Kayode Adeniyi
Jul 25, 2024 ⋅ 10 min read
Lots of multi-colored blue and purplish rectangles.

Animating dialog and popover elements with CSS @starting-style

Native dialog and popover elements have their own well-defined roles in modern-day frontend web development. Dialog elements are known to […]

Rahul Chhodde
Jul 24, 2024 ⋅ 10 min read
Using Llama Index To Add Personal Data To Large Language Models

Using LlamaIndex to add personal data to LLMs

LlamaIndex provides tools for ingesting, processing, and implementing complex query workflows that combine data access with LLM prompting.

Ukeje Goodness
Jul 23, 2024 ⋅ 5 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