Skip to main content

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

Function SetWebhook(Val Token, Val URL) Export

ParameterCLI optionTypeRequiredDescription
Token--tokenStringViber Token
URL--urlStringURL for setting up Webhook

Returns: Map Of KeyAndValue - serialized JSON response from Viber


1C:Enterprise/OneScript code example
    Token = "523b58ba82afffaa-7ef3b426...";
URL = "http://api.athenaeum.digital/hs/viber";

Result = OPI_Viber.SetWebhook(Token, URL);
    oint viber SetWebhook \
--token "***" \
--url "http://api.athenaeum.digital/hs/viber"
Result
{
"status": 1,
"status_message": "URL not valid or not HTTPS",
"chat_hostname": "SN-CHAT-03_"
}