Click "Use this process" and template of this process "Viber Public Account "Get Weather" will copy in your environment.
Receives webhooks from Viber Public Account and distributes it according to the received value of the " event " parameter.
"event": "message" divides in types: picture, video, file, contact, url, location, text.
Received messages with text type transfers to Main logic.
Manages the logic of message sending
Requests weather, sends received air temperature or a message that city is not found.
By Viber Public Account receives account details (name and link to the avatar) to send message.
Sends messages, distributing it to statuses of sending.
Successful requests are transferred to Message statuses in order to receive messages end status.
Distributes successful requests by states:
"Sent", "Delivered", "Seen", "Not delivered 14days", "Not seen 14 days", "failed - not delivered by Viber".
Connect the Resiver to Viber Webhook:
- go to "Webhook" tab
- press "Connect to messenger"
- choose Viber
- press "Set Webhook" and specify the token of your Public Account
If necessary, set the welcome message for your Public Account:
- after selection of Viber press "Set Welcome message" button
- choose the welcome message type - text or a picture with text
fill out the required fields
Welcome message is sent in reply to received webhook which contains "event": "conversation_started".
This event indicates that user moved to the chat with your Public Account for the first time (ie, no history) or when the chat was opened by deep link.
"conversation_started" It is not considered a subscription and does not allow the Public Account to send messages to users.
But allows to send one welcome message.
Integration with OpenWeatherMap
For user's comfort there's a test access key for OpenWeatherMap API added to Main logic.
In order to receive your access key for OpenWeatherMap API, go to the link and register.
In Get weather by city node, replace test key by a received one in APPID parameter's value.
Testing and launch
Just add a required Public Account and start the dialog.
Go to View mode Resiver or Main logic, in order to see task flow , their moving and distribution by nodes of working processes.