Send a Viber message from MuleSoft using UChat

Zoran Đukić
Another Integration Blog
3 min readApr 25, 2023

Hello everyone, today I decided to do something a bit different. I was thinking about what to do for my next blog and I thought that it would be cool to have an error handler that sends a you message when an error occurs in your implementation.

Viber

At first I was discouraged because Viber only allows communication if you have a valid CA certificate. To do this in a proper way I would need a CA certificate, hosting etc. and that is not what I had in mind. So, I decided to build a free version using UChat.

Table of contents:

  1. Login to Viber Admin Panel
  2. Create a Viber bot
  3. Get Viber token and QR code
  4. Open chat with bot
  5. Create account on UChat
  6. Create a bot on UChat
  7. Get User Ns (ID)
  8. Create API token
  9. Create a simple Mule app for test

Lets start from the beginning:

Step 1:

Go to: https://partners.viber.com/login and register your phone number.

Step 2:

Click on the right “Create a Viber bot”. You will get a token after you create a bot.

Step 3:

MuleSoft Viber Bot

Go to your Info page. Copy your token and your QR code.

Token will look something like this: 50ee66d39fe7dc17-df7e635b3e9b935b-b2b7a7845d9cfd23

QR code is in the top right corner.

Step 4:

Open Viber on your phone. Go to “More”. Click the QR code icon in the top right corner. Scan the QR code with your phone.

Scan QR code

Now, you have an open chat with your bot.

Step 5:

Go to https://www.uchat.com.au/ and create an account.

Step 6:

After you login, click Viber in menu bar on the right and create a bot.

UChat Viber bot

Note: You don’t need to add flows. You can play around with that later if you want.

Step 7:

Go to Bot Users. Click on the bot. Find the ID under “User Ns”. It will go something like this: “f43574u21033730”.

Step 8:

Click on your account name in the top right corner. In the menu, click on API Keys. Create an API key for your bot. Copy it into your notepad.

Step 9:

Create a simple Mule application. Add a Listener so you can trigger the flow, add a Transform Message with payload and a Request to Viber.

Payload (body) you are going to use:

Request:

Trigger the flow and this is it. :)

You can download the code from my GitHub account.

In summary, this is an easy way to send a message from MuleSoft to your Viber. Hope you enjoyed the blog and if you are interested you can check some of my previous blogs on my home page.

--

--