Clone "Viber Public Account "Get Weather" folder into your enviropment
Receives webhook-s from Viber Public Account and distributes them according to received value of
"event": "message" divides into types: picture, video, file, contact, url, location, text.
Received messages with
text type are transferred to Main logic.
Manages the logic of message sending.
Requests the weather, sends received air temperature or message about undefined city.
By Viber Public Account token recevies account details (name and link for the avatar) for message sending.
Sends messages, distributes them by sending statuses.
Successful requests are trasferred to Message statuses after receiving message end status.
Distributes successful requests by the states:
"Sent", "Delivered", "Seen", "Not delivered, 14 days", "Not seen, 14 days", "failed - not delivered by Viber".
Connect Resiver to the Viber Webhook:
- go to
Connect to messenger
"Set Webhook"and specify the token of your Public Account
If necessary, set the welcome message for your Public Account:
- After selecting
"Set Welcome message"button
- choose the type of welcome message - text or a picture with text
- fill out required fileds
Welcome message is sent as a reply to the received webhook which contains
This event indicates that user came to the chat with your Puclic Account for the first time (it means, there's no history) или когда чат открыт через deep link.
"conversation_started" is not considered a subscription and does not allow the Public Account to send messages to users.
But it allows you to send one greeting.
Integration with OpenWeatherMap
For user's comfort in Main logic there was a test key added for API OpenWeatherMap.
To get your OpenWeatherMap API access key, go to link and register.
Get weather by city node, replace the test key with the one you received in the
APPID parameter value.
Testing and launch
Just add required Public Account and start dialog.