In order to be able to receive messages, your Sender ID must have 2-way messaging enabled.
The main purpose of Viber Business Messages is as a notification service. Therefore, customers cannot contact you first but they can reply to your previously sent message. This is different from the Viber Bot where the contact must initiate the conversation first.
Receiving messages is technically done using Message Received webhook call which you receive from Amio server whenever someone sends you a reply.
For the purpose of this tutorial, we will use Ngrok to route incoming webhook calls to your local machine.
- Download and install Ngrok.
- (Optional) Create a server app with opened url for Amio webhooks, i.e.
http://localhost:<YOUR_APP_PORT>/webhook/amioand start it.
- Start Ngrok for routing to your local server with command
./ngrok http <YOUR_APP_PORT>.
- Copy the forward url from Ngrok (
https://c25d851e.ngrok.ioin our example) and set this url in Amio app (Administration - Channel Detail - Webhook tab).
- Send a message to your phone number.
- Go to Viber app and send a reply to the message you sent previously.
- Observe your local server has received an HTTP POST request.
- You can see all incoming requests in Ngrok web interface as well
Updated about 4 years ago