Send Message
In order to be able to send a message to the user, you have to have received a message from that user first (see previous tutorial). When you receive message, you also get contact.id
you can use later for sending.
- In administration, go to Viber channel detail. If you don't have any, connect Viber Bot account first.
- Copy the channel ID in detail page for later use.
- Go to Contacts tab and copy contact ID (there should be at least one since you've sent a message to your channel in previous tutorial).
- As a last attribute you will need
organization_access_token
. Go to Settings - API and copy your secret access token. - Send a text message to the user using Send Text Message API.
curl -X POST \
https://api.amio.io/v1/messages \
-H 'authorization: Bearer {{organization_access_token}}' \
-H 'content-type: application/json' \
-d '{
"channel": {
"id": "{{channel_id}}"
},
"contact": {
"id": "{{contact_id}}"
},
"content": {
"type": "text",
"payload": "Hello world!"
}
}
- Open your Viber app and observe that the message was received.
Postman
Use Postman to test all different message types. Don't forget to set environment properties:
access_token
,viber.channel.id
andviber.contact.id
.
Updated 22 days ago