Send Message

Sending a message through Viber Business Messages channel is straightforward. The only thing you need is a user's phone number. If you haven't created a Viber Business Messages channel yet, connect Viber Business Messages first.

📘

Channel Approval

You need to have your channel approved before you will be able to send a message. If you have any questions regarding the approval process, please contact us at [email protected].

  1. In administration, go to your Viber Business Messages channel detail.
  2. Copy the "Channel ID" in detail page for later use.
607
  1. You will also need organization_access_token. Go to Settings - API on the left and copy your secret access token.
  2. Send a text message to your phone number using Send Text Message API (note that the phone number in response is in E.164 format).
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": {
    "phone_number": "{{phone_number}}"
  },
  "content": {
    "type": "text",
    "payload": "Hello world!"
  }
}
// full setup in https://github.com/amio-io/amio-sdk-js
const AmioApi = require('amio-sdk-js').AmioApi

const amioApi = new AmioApi({
  accessToken: '{{organization_access_token}}'
})

async function sendMessage() {
  const message = await amioApi.messages.send({
    channel: {id: '{{channel_id}}'},
    contact: {phone_number: '{{phone_number}}'},
    content: {
      "type": "text",
      "payload": "Hello world!"
    }
  })
  
  return message
}
  1. The message will appear in your Viber app soon.

What’s Next