vasani-arpit / WBOT

A simple Web based BOT for WhatsApp™ in NodeJS 😜. Working as of 📅 Feb 4th, 2024
Other
980 stars 314 forks source link

How to work webhooks? #69

Closed FitterX closed 4 years ago

FitterX commented 4 years ago

Hi all. I try webhooks but no have success.

Have tutorial?

vasani-arpit commented 4 years ago

You can take a look at https://github.com/vasani-arpit/WBOT/blob/master/docs/Webhook-example.md for now. I am planing to write a article or make a video about that.

FitterX commented 4 years ago

Hey Vasani, thank you!

I'm using php to get the message and the type is working! But I can't send the return (response) through PHP. Can you help me with a little example?

vasani-arpit commented 4 years ago

here is what your php endpoint should return

[{
      "text": "Look, Reply from Webhook!",
      "type": "message"
}]

You can check the errors by opening DevTools of the whatsapp window.

FitterX commented 4 years ago

i try this! echo json_encode(['"text"' => 'test', '"type"' => 'message']);

result: { "text": "test", "type": "message" }

FitterX commented 4 years ago

Hey..sorry.. I add brackets its work now! Thank for help!

setijo commented 3 years ago

I thank you, the application is running well. I have been able to create a BOT using the webhook. Please help to provide examples in utilizing existing functions, such as:

  1. Send image files
  2. Get whatsapp id / number

window.WAPI.getMyContacts = function () { return window.Store.Contact.filter((contact) => contact.isMyContact === true).map((contact) => WAPI._serializeContactObj(contact)); };

BR