> 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/public-directory.md).

# Public Directory

You can listen to the public folder by specifying a public object in the webhookListener function. With this feature, you can make your transfers from your public folder without requiring an additional intermediate server when sending images, files, etc. over whatsapp.

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",
	public: {
		name: "/public" // this is public path on your hostname. For example: https://<your_sub>.ngrok-free.app/public
		path: "path/to/public/dir" // this is public files dir
	}
});
```

As you can see, the Events class is called and the Events in it are selected. You can take a look at [2Chat Documentation](https://developers.2chat.co/docs/API/WhatsApp/webhooks/subscribe) to learn which Event does what.
