Public Account "Order Lunch"
Clone folder "Viber PA "Order Lunch" into your environment
Creation Public Account в Viber
Create your Public Account in Viber, more details here.
Public Account authentication token. This is the unique ID which is used for verification of your Public Account in every request to API.
After creation of Public Account, your Account authentication token will appear in settings of the account "Change the information".
In the process Receiver in
Set viber_token node replace test key by the one that you received in
viber_token parameter value.
Connect Receiver to Viber Webhook:
- go to
Connect to messenger
- press on
"Set Webhook"and specify the token of your Public Account
If necessary, set the welcome message for your Public Account:
- after selection
"Set Welcome message"
- select the type of the welcome message - text or a picture with text
- fill out the required fields
Welcome message is sent as a reply to the received webhook which contains
This event indicates that user came to the chat with your Public Account for the first time (it means, there's no history) or when the chat was opened through deep link.
"conversation_started" is not considered as subscription and does not allow the Public Account to send messages to users
But it allows to send one welcome message.
Receives webhooks from Viber Public Account and distributes it depending on received value of
"event": "message" divides into types: picture, video, file, contact, url, location, text.
When receiving any command different from start start, sends appropriate message.
By Viber Public Account token receives account details (message status, name and link to the avatar) for message sending.
Sends messages, distributes them by send statuses (
State diagram Storage orders
Storage and distribution of orders over the states:
- order is made -"ordered pizza","ordered sushi"
- waiting 2 min for order confirmation - "waiting for ordering pizza","waiting for ordering sushi"
- order is not issued - "Pizza wasn't ordered for 2 min", "Sushi wasn't ordered for 2 min"
- received feedback from the client - "feedback received"
Testing and launch
Just add required Public Account and start dialog with start command.
then, choose the food:
After choosing the food, you will be able to Issue the order or continue order or start the order over and also Leave a feedback:
Go to dashboard Dashboard View orders to see the statisctics for orders in real time mode:
Final nodes from the state diagram Storage orders are selected as metrics for constructing this chart: