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.

  1. In administration, go to Viber channel detail. If you don't have any, connect Viber Bot account first.
  2. Copy the channel ID in detail page for later use.
  3. 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).
676
  1. As a last attribute you will need organization_access_token. Go to Settings - API and copy your secret access token.
  2. 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!"
  }
}
  1. 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 and viber.contact.id.


What’s Next

See all available entry points for Viber platform.