{"_id":"589b1a103693080f0034d10f","project":"54eb50e5615ffc1900305a16","version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":27,"createdAt":"2015-02-23T17:30:32.501Z","releaseDate":"2015-02-23T17:30:32.501Z","categories":["54eb63b959b1172100334faf","54eb63b959b1172100334fb0","54eb63b959b1172100334fb1","54eb63b959b1172100334fb2","54ed8dd4ab373e2300f50eae","54ed99b2ab373e2300f50ede","55153a6de68daa2f00cff838","551546edbc466623002afe72","5515472ac28d6125001b8884","55154749c28d6125001b8885","555d9b4106dfec0d00d38ea7","5613e06e433e5735007c7708","5624bbb785a31117001c5403","56669e857cc81e0d00253f8e","568b8d837a42220d00498311","56a632277ef6620d00e2f18a","56d8147c3eb4dd0b00201aac","57a9ce2fac6db30e000d7efd","57a9cf4e944ea60e00dc3f74","58172386715dce0f00da4aa0","582dc59ee1b8692300c0dd03","589b19b4fec2730f0082e040","58b04a023529383900a759b5","58b92d1598157a0f004869bf","592e7685c58275000f20174f","59392839e376d4002f8a0474","59393064e376d4002f8a05a1","5947ae0d4005e2000f3a4fec","594a74df1d1de5001ab3517a","5954bc387a147f001b918915"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"__v":0,"category":{"_id":"589b19b4fec2730f0082e040","version":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-02-08T13:14:28.054Z","from_sync":false,"order":16,"slug":"viber","title":"Viber messaging"},"parentDoc":null,"user":"582ddb2f8653af2d00f5a9c5","updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-02-08T13:16:00.086Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"**Viber messaging API** connects your CRM software, website or an application to Viber's messaging platform.\n\nIt enables direct communication with your customers on Viber using the same platform that they already use when talking to their friends. It allows you to personally interact with them, keep them engaged with your business, and drive them to perform actions. Messages can be personal, informative, transactional, or promotional, and support text, images, buttons, and links.\n\nThere are two account types that support Viber messaging: **Viber Service Messages Account** and **Viber Public Accounts**.\n\n**Viber Service Messages Account** allows you to use Viber's messaging platform to send targeted messages to your users at a competitive cost and high efficiency.\nIt is used to send Viber messages as a part of our [OMNI experience](/docs/omni-channel-viber-example). To open an account you need to apply [here](https://www.viber.com/viber-for-business).\n\nA **Viber Public Account** allows businesses, brands and public figures to interact and form connections with Viber users around the globe. As a channel that encourages both engagement and personal connections, Public Accounts can be used for a wide variety of purposes - including sales, marketing, support, announcements and more.\n\nFor setting up a Viber Public Account follow the instructions below.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Viber Public Account\"\n}\n[/block]\n**Viber Public Account or Viber PA Account** will enable you to interact more closely with your user.\n\nBy using the Infobip API you can integrate your own solution for receiving and sending messages to your users by using two simple API methods:\n  * [Send message](/docs/send-viber-message)\n  * [Receive message](/docs/receive-viber-message)\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Initial setup\",\n  \"body\": \"In order to start using an API for messaging you have to go through the initial setup which consists of:\\n1. Applying for access to Viber Public Accounts [here](https://www.viber.com/en/public-accounts).\\n2. Creating a Viber account - on a platform which supports PA (iOS/Android). This account will automatically be set as the PA administrator during the PA creation process. \\n3. Creating Viber Public Account\\n4. Get Public Account authentication token\\n5. Registering the Viber PA on Infobip's platform.\\n6. Configure a webhook\\n7. Setting up the configuration options for incoming messages\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Create Viber Public Account\"\n}\n[/block]\nStart creating your Public Account by opening the Viber app on your phone and take the following steps:\n1. Open Public Accounts through the Public Accounts icon at the top right of your screen.\n2. Once you're on the Public Accounts home page, tap on the create button at the bottom of the screen.\n3. Tap  'Join' now to start creating your Public Account.\n4. Once your application has been approved you will be sent a message inviting you to start creating your Public Account. In order to begin creating your account you must:\n     a) Restart your device.\n     b) Enter the Public Accounts home-screen. You will now see the Create Public Accounts button.\n     c) Tap the button and get started!\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Authentication token\"\n}\n[/block]\nThe authentication token (also known as the application key) is a unique and secret account identifier. It is used to authenticate requests made inside the Public Accounts API and to prevent unauthorized persons from sending requests on behalf of a Public Account. You will need this token during the integration process.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Authentication token\",\n  \"body\": \"Copy and save your **Authentication token** somewhere handy as you will need it in next steps.\"\n}\n[/block]\nThe authentication token is generated upon Public Account creation and can be viewed by the account admins on the \"edit info\" screen of their Public Account.\n\nNote: Failing to send the authentication token in the header will result in an error with the \"missing auth_token\" message.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Registering the Viber Public Account on Infobip's platform\"\n}\n[/block]\nRegistering Viber Public Account is done by creating the application on Infobip's platform which is associated with the Viber Public Account.\n\nA new application can be created with the single API call. Use **Authentication token** from the previous step as a value of `authenticationToken` parameter.\n\nCreate an Infobip application request example:\n\n###Request example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /viber/1/applications HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\n\\n{\\n  \\\"viber\\\": {\\n    \\\"publicAccount\\\": {\\n      \\\"authenticationToken\\\":\\\"...\\\"\\n    }\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n###Response\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"key\\\": \\\"8F0792F86035A9F4290821F1EE6BC06A\\\",\\n  \\\"viber\\\": {\\n    \\\"publicAccount\\\": {\\n      \\\"id\\\": \\\"pa:1234...\\\",\\n      \\\"authenticationToken\\\": \\\"...\\\",\\n      \\\"name\\\": \\\"Public Account Name\\\",\\n      \\\"imageUrl\\\": \\\"https://...\\\"\\n    }\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n**That's it!** You are now ready to send test messages over an API by performing a [Send message](/docs/send-viber-message) API method. Before you can receive inbound messages you need to go through the [Configuration process for receiving messages](#configuration-process-for-receiving-messages).\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Configure webhook\"\n}\n[/block]\nOnce you have your token you will be able to set your account's webhook. This webhook will be used for receiving callbacks & user messages from Viber.\n\nSetting the webhook will be done by calling the set_webhook API with a valid & certified URL. For security reasons only URLs with valid and official SSL certificate from a trusted CA will be allowed. This action defines the account's webhook and the type of events the account wants to be notified about.\n\nOnce a set_webhook request has been sent Viber will send a callback to the webhook to check its availability and return a response to the user.\n\nNote that once you set your webhook the 1-on-1 conversation with your account will become available.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Configuration process for receiving messages\"\n}\n[/block]\nYou have successfully configured **message sending**, and now it's time to configure **message receiving** options:\n\n###Incoming message setup steps\n1. [**Configuration**](/docs/viber-configuration) represents a container for a set of different Actions.\n2. [**Action**](/docs/viber-action) represents collection of methods used to trigger different HTTP actions. Through the 'Action configuration' you can define how would you like to receive incoming messages - by Pull or Forward method.","excerpt":"","slug":"viber-introduction-and-setup","type":"basic","title":"Introduction and setup"}

Introduction and setup


**Viber messaging API** connects your CRM software, website or an application to Viber's messaging platform. It enables direct communication with your customers on Viber using the same platform that they already use when talking to their friends. It allows you to personally interact with them, keep them engaged with your business, and drive them to perform actions. Messages can be personal, informative, transactional, or promotional, and support text, images, buttons, and links. There are two account types that support Viber messaging: **Viber Service Messages Account** and **Viber Public Accounts**. **Viber Service Messages Account** allows you to use Viber's messaging platform to send targeted messages to your users at a competitive cost and high efficiency. It is used to send Viber messages as a part of our [OMNI experience](/docs/omni-channel-viber-example). To open an account you need to apply [here](https://www.viber.com/viber-for-business). A **Viber Public Account** allows businesses, brands and public figures to interact and form connections with Viber users around the globe. As a channel that encourages both engagement and personal connections, Public Accounts can be used for a wide variety of purposes - including sales, marketing, support, announcements and more. For setting up a Viber Public Account follow the instructions below. [block:api-header] { "type": "basic", "title": "Viber Public Account" } [/block] **Viber Public Account or Viber PA Account** will enable you to interact more closely with your user. By using the Infobip API you can integrate your own solution for receiving and sending messages to your users by using two simple API methods: * [Send message](/docs/send-viber-message) * [Receive message](/docs/receive-viber-message) [block:callout] { "type": "warning", "title": "Initial setup", "body": "In order to start using an API for messaging you have to go through the initial setup which consists of:\n1. Applying for access to Viber Public Accounts [here](https://www.viber.com/en/public-accounts).\n2. Creating a Viber account - on a platform which supports PA (iOS/Android). This account will automatically be set as the PA administrator during the PA creation process. \n3. Creating Viber Public Account\n4. Get Public Account authentication token\n5. Registering the Viber PA on Infobip's platform.\n6. Configure a webhook\n7. Setting up the configuration options for incoming messages" } [/block] [block:api-header] { "type": "basic", "title": "Create Viber Public Account" } [/block] Start creating your Public Account by opening the Viber app on your phone and take the following steps: 1. Open Public Accounts through the Public Accounts icon at the top right of your screen. 2. Once you're on the Public Accounts home page, tap on the create button at the bottom of the screen. 3. Tap 'Join' now to start creating your Public Account. 4. Once your application has been approved you will be sent a message inviting you to start creating your Public Account. In order to begin creating your account you must: a) Restart your device. b) Enter the Public Accounts home-screen. You will now see the Create Public Accounts button. c) Tap the button and get started! [block:api-header] { "type": "basic", "title": "Authentication token" } [/block] The authentication token (also known as the application key) is a unique and secret account identifier. It is used to authenticate requests made inside the Public Accounts API and to prevent unauthorized persons from sending requests on behalf of a Public Account. You will need this token during the integration process. [block:callout] { "type": "warning", "title": "Authentication token", "body": "Copy and save your **Authentication token** somewhere handy as you will need it in next steps." } [/block] The authentication token is generated upon Public Account creation and can be viewed by the account admins on the "edit info" screen of their Public Account. Note: Failing to send the authentication token in the header will result in an error with the "missing auth_token" message. [block:api-header] { "type": "basic", "title": "Registering the Viber Public Account on Infobip's platform" } [/block] Registering Viber Public Account is done by creating the application on Infobip's platform which is associated with the Viber Public Account. A new application can be created with the single API call. Use **Authentication token** from the previous step as a value of `authenticationToken` parameter. Create an Infobip application request example: ###Request example [block:code] { "codes": [ { "code": "POST /viber/1/applications HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\n\n{\n \"viber\": {\n \"publicAccount\": {\n \"authenticationToken\":\"...\"\n }\n }\n}", "language": "json" } ] } [/block] ###Response [block:code] { "codes": [ { "code": "{\n \"key\": \"8F0792F86035A9F4290821F1EE6BC06A\",\n \"viber\": {\n \"publicAccount\": {\n \"id\": \"pa:1234...\",\n \"authenticationToken\": \"...\",\n \"name\": \"Public Account Name\",\n \"imageUrl\": \"https://...\"\n }\n }\n}", "language": "json" } ] } [/block] **That's it!** You are now ready to send test messages over an API by performing a [Send message](/docs/send-viber-message) API method. Before you can receive inbound messages you need to go through the [Configuration process for receiving messages](#configuration-process-for-receiving-messages). [block:api-header] { "type": "basic", "title": "Configure webhook" } [/block] Once you have your token you will be able to set your account's webhook. This webhook will be used for receiving callbacks & user messages from Viber. Setting the webhook will be done by calling the set_webhook API with a valid & certified URL. For security reasons only URLs with valid and official SSL certificate from a trusted CA will be allowed. This action defines the account's webhook and the type of events the account wants to be notified about. Once a set_webhook request has been sent Viber will send a callback to the webhook to check its availability and return a response to the user. Note that once you set your webhook the 1-on-1 conversation with your account will become available. [block:api-header] { "type": "basic", "title": "Configuration process for receiving messages" } [/block] You have successfully configured **message sending**, and now it's time to configure **message receiving** options: ###Incoming message setup steps 1. [**Configuration**](/docs/viber-configuration) represents a container for a set of different Actions. 2. [**Action**](/docs/viber-action) represents collection of methods used to trigger different HTTP actions. Through the 'Action configuration' you can define how would you like to receive incoming messages - by Pull or Forward method.