How to Receive WhatsApp messages using VB.NET and webhook

Introduction

In this tutorial, we will create a simple example to read incoming WhatsApp messages using VB.NET.

Download the project

You can download the project files from GitHub.

Dependencies

for local development purposes, a tunneling service is required. This example uses ngrok , you can download Ngrok from here.

run project

dotnet watch

Start Ngrok

ngrok http https://localhost:6000

set Webhook URL

Go to your ultramsg account to set Webhook URL after copying the Ngrok URL and add /api/ Route like this:

image 8
Webhook on Received: TRUE

receive WhatsApp messages

now you should be able to receive WhatsApp webhooks.

Example Json response:

{
  "event_type": "message_received",
  "instanceId": "1150",
  "id": "",
  "referenceId": "",
  "data": {
    "id": "[email protected]_3EB02E5EB89Cff3FB034",
    "from": "[email protected]",
    "to": "101721[email protected]",
    "author": "",
    "pushname": "Steve",
    "ack": "",
    "type": "chat",
    "body": "Hi,How are you",
    "media": "",
    "fromMe": false,
    "isForwarded": false,
    "isMentioned": false,
    "quotedMsg": {},
    "mentionedIds": [],
    "time": 1650002600
  }
}

Congratulations!

You can visit the project on GitHub.