> For the complete documentation index, see [llms.txt](https://whatsappjs.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whatsappjs.gitbook.io/docs/how-to-create-webhook-server/initialize-webhook-server.md).

# Initialize Webhook Server

If you want to receive incoming and outgoing messages, you need to install Webhook Listener. We have listed the steps for this respectively:

* You need to obtain a tunnel address via NGROK. [How do I do it?](/docs/how-to-create-webhook-server/ngrok.md)
* You need to call and configure the webhookServer class in the WhatsappJS class.

An example is given below.

```

import { WhatsappJS } from '@efesoroglu/whatsappjs'

const client = new WhatsappJS("<your-api-key>", "<channel-phone-number>");

client.webhookServer({
	port: 8080,
	events: ["whatsapp.message.new"],
	host_name: "https://<your_sub>.ngrok-free.app",
});

  

client.once('ready', (client) => {
	console.log(`The bot started with the name ${client.friendly_name} (${client.phone_number})!`);
});

client.start();
```

\
Now you are ready and can listen to the events you have selected!
