2024-06-05 12:19:46 +02:00
---
sidebar_position: 1
---
# Set Webhook
IMPORTANT: Setting up Webhook is mandatory according to Viber rules. You need to have a free URL for this., which will return 200 and a genuine SSL certificate. If there is a certificate and the database is published on the server - you can use an HTTP service. Information about new messages will also be sent there Viber periodically knocks on the Webhook address, so if it is inactive, everything will stop working
2024-07-10 10:59:55 +02:00
< br / >
2024-07-10 12:58:29 +02:00
`Function SetWebhook(Val Token, Val URL) Export`
2024-06-05 12:19:46 +02:00
| Parameter | CLI option | Type | Destination |
|-|-|-|-|
| Token | --token | String | Viber Token |
| URL | --url | String | URL for setting up Webhook |
2024-06-06 14:33:52 +02:00
Returns: Map Of KeyAndValue - serialized JSON response from Viber
2024-06-05 12:19:46 +02:00
2024-07-10 13:05:58 +02:00
< br / >
2024-07-10 10:59:55 +02:00
2024-07-10 12:58:29 +02:00
2024-06-05 12:19:46 +02:00
```bsl title="Code example"
2024-07-10 13:24:11 +02:00
Response = OPI_Viber.SetWebhook(Token, "https://api.athenaeum.digital/opi/hs/viber"); //Map
2024-06-05 12:19:46 +02:00
Response = OPI_Tools.JSONString(Response); //JSON string
```
2024-07-10 10:59:55 +02:00
2024-06-05 12:19:46 +02:00
```sh title="CLI command example"
oint viber SetWebhook --token %token% --url %url%
```
```json title="Result"
2024-07-10 13:11:17 +02:00
{
2024-06-05 12:19:46 +02:00
"event_types": [
"subscribed",
"unsubscribed",
"webhook",
"conversation_started",
"client_status",
"action",
"delivered",
"failed",
"message",
"seen"
],
"chat_hostname": "SN-CHAT-12_",
"status_message": "ok",
"status": 0
}
```