﻿---
sidebar_position: 1
description: Set Webhook and other functions to work with Viber in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Viber]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# 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`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | Token | --token | String | &#x2714; | Viber Token |
  | URL | --url | String | &#x2714; | URL for setting up Webhook |

  
  Returns:  Map Of KeyAndValue - serialized JSON response from Viber

<br/>




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

    Result = OPI_Viber.SetWebhook(Token, URL);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            oint viber SetWebhook \
             --token "***" \
             --url "http://api.athenaeum.digital/hs/viber"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            oint viber SetWebhook ^
             --token "***" ^
             --url "http://api.athenaeum.digital/hs/viber"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "status": 1,
 "status_message": "URL not valid or not HTTPS",
 "chat_hostname": "SN-CHAT-03_"
}
```
