[core] Add doc about new filename field

This commit is contained in:
allburov committed 2023-11-24 17:47:29 +07:00
1 parent 2b1e605e5f
commit 6e0bafdd89
1 file changed
+17 -2
@@ -154,8 +154,8 @@ Receive events when server or recipient gets the message, read or played it.
## Files ![](/images/versions/plus.png)
When people send you files - images, voice messages, and documents - WAHA saves it in the file storage.
In your application you must download it and use it as you want to. You can find the URL in `mediaUrl` field
When people send you media - images, voice messages, and documents - WAHA saves it in the file storage.
In your application you must download it and use it as you want to. You can find the URL in `mediaUrl` field.
For example, you can get the webhook like this with `mediaUrl` value (we've skipped other fields):
@@ -173,6 +173,21 @@ For example, you can get the webhook like this with `mediaUrl` value (we've skip
```
Then you can use the link to download the file `http://localhost:3000/api/files/true_11111111111@c.us_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.jpg`.
For documents (file attachments) there's also `filename` field with the original file name.
```json
{
"event": "message",
"session": "default",
"payload": {
"id": "true_11111111111@c.us_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"timestamp": 1667561485,
"from": "11111111111@c.us",
"mediaUrl": "http://localhost:3000/api/files/true_11111111111@c.us_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.pdf",
"filename": "some-file.pdf"
}
}
```
To configure the url you can use environment variables `WHATSAPP_API_HOSTNAME` and `WHATSAPP_API_PORT`.
By default, WAHA download all files that the account receive.