- You need to create Viber Bot and get Viber Auth Token. Create bot you can here https://partners.viber.com/account/create-bot-account
- Then you need to insert token to the app. Open ViberBot/Properties/launchSettings.json and insert in front of VIBER_AUTH_TOKEN your token
- Run your MSSQL server and insert your data in front of CONNECTION_STRING
- You should use ngrok to connect to app or your own domen if you publish this app. For ngrok you need to download from official web page and insert command ngrok.exe http 5000. Your public ip insert in the next step
- You need to use postman or other API platforms to make one request. Open postman and make this request
- url : https://chatapi.viber.com/pa/set_webhook
- Open Headers and type KEY: X-Viber-Auth-Token, VALUE: your token e.g. 123412341234-12412341243-123412341234
- Open Body => raw => Text to JSON and insert this JSON file. In front of url insert your public ip and in the end type /Viber
{
"url": "https://a1b2-255-255-255-255.eu.ngrok.io/Viber",
"event_types": [
"failed",
"subscribed"
]
}
or you can import this cURL
curl --location --request GET 'https://chatapi.viber.com/pa/set_webhook' \
--header 'X-Viber-Auth-Token: 123412341234-12412341243-123412341234' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "https://a1b2-255-255-255-255.eu.ngrok.io/Viber",
"event_types": [
"failed",
"subscribed"
]
}'
- Type in cmd dotnet database update
- Run an app