Live Helper Chat support forum.. Forum is locked. New place for questions - Github Discussions

You are not logged in.

Announcement

#1 2021-12-01 19:43:38

panariga
New member
Registered: 2021-12-01
Posts: 8

Viber integration

Hi.
Trying to integrate Viber bot using REST API

Hook regstered and I can recieve messages.

But I can`t figure out how i can access viber chat id

In Incoming webhook I need to fill field Chat ID field location.
But parser not accept second level attributes.

Viber format is

{
   "event":"message",
   "timestamp":1457764197627,
   "message_token":4912661846655238145,
   "sender":{
      "id":"01234567890A=",
      "name":"John McClane",
      "avatar":"http://avatar.example.com",
      "country":"UK",
      "language":"en",
      "api_version":1
   },
   "message":{
      "type":"text",
      "text":"a message to the service",
      "media":"http://example.com",
      "location":{
         "lat":50.76891,
         "lon":6.11499
      },
      "tracking_data":"tracking data"
   }
}

So i need acces sender.id and set it as external shat id.

What format should I use for "Chat ID field location"?

Offline

#2 2021-12-01 20:05:23

PeopleInside
Administrator
From: Italy
Registered: 2014-04-10
Posts: 4,046
Website

Re: Viber integration

Hi and welcome to the live helper chat forum!
Unfortunately this is a question for a developer and I'm not.

Have you looked at the official documentation?
https://doc.livehelperchat.com/docs/install

Free support can be limited here on the forum and the developer can be busy and take more time than me to reply to request,
you can try to wait if you still need help or you can also take a look at the links on my forum signature and try to reach the dev in discord,
if no reply will be posted here.

The documentation can resolve many questions or issues.

Welcome again in the live helper chat forum!
cool  cool  smile


lol PeopleInside - Live helper chat - free limited forum support!
wink For commercial support or GitHub [see FAQ here]
ops If you want to support this open source project, just donate [see support page]
glasses Something wrong with the forum? [contact a superhero]

Offline

#3 2021-12-01 20:06:44

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: Viber integration

Try to use sender.id in id field. Also please ping e tomorrow on discord server perhaps i could help more

Offline

#4 2021-12-01 20:13:10

panariga
New member
Registered: 2021-12-01
Posts: 8

Re: Viber integration

Unfortunately this is not working
Got php error:
PHP Notice:  Undefined index: sender.id


this format works for other fields (like nickname) but not for Chat ID

Last edited by panariga (2021-12-01 20:14:24)

Offline

#5 2021-12-01 20:18:14

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: Viber integration

I’ll look tomorrow how to improve just write on discord server smile so I’ll inform once it will be improved smile

Offline

#6 2021-12-02 05:38:53

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: Viber integration

Hi,

Try to apply this fix https://github.com/LiveHelperChat/liveh … 95c88946f5

This will find previous chat if it exists by external id. As you did not wrote on what line you were getting this error.

Offline

#7 2021-12-02 09:06:54

panariga
New member
Registered: 2021-12-01
Posts: 8

Re: Viber integration

Thank you.
Solution seems to be working.

I assume same changes need to be done to extract sub level attributes for condition "For message being considered text message should have attribute value equal to"?

Offline

#8 2021-12-02 09:10:01

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: Viber integration

Based on your sample it should not need any additional job. as they access first level of message attribute. Just take a look at messageBird integration smile

Offline

#9 2021-12-02 18:03:49

panariga
New member
Registered: 2021-12-01
Posts: 8

Re: Viber integration

unfortunately viber keeps types of messages in second level attribute

Offline

#10 2021-12-02 18:06:56

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: Viber integration

That's perfectly fine see this sample
1638468362_integration.png

"Messages attribute location" defines where message is stored.

and "For message being considered text message should have attribute value equal to" is just "type=text||direction=received" and it's second level attribute...

Offline

#11 2021-12-02 18:12:12

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: Viber integration

In your structure you would need to check
"This attribute contains direct message and NOT a messages array"

and in
"Messages attribute location"

enter
"message"

and you can write just
type=text

Offline

#12 2021-12-02 18:13:16

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: Viber integration

That's identical how mesasgeBird implementation looks like...
https://doc.livehelperchat.com/docs/int … d-whatsapp

Offline

#13 2021-12-02 18:33:47

panariga
New member
Registered: 2021-12-01
Posts: 8

Re: Viber integration

in that case I can`t access sender.ID because it in another location
so every message goes to new chat

Offline

#14 2021-12-02 18:48:57

panariga
New member
Registered: 2021-12-01
Posts: 8

Re: Viber integration

sender.id works if change proposed commit

                'chat_external_id' => self::extractAttribute('chat_id',$conditions,$payloadMessage),

to

                'chat_external_id' => self::extractAttribute('chat_id',$conditions,$payloadAll),

but I`m not shure what it can brake in other cases

Offline

#15 2021-12-02 18:58:41

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: Viber integration

I pushed related change there. Try to apply and see now smile

https://github.com/LiveHelperChat/liveh … 7cf8e71188

Offline

#16 2021-12-02 19:12:45

panariga
New member
Registered: 2021-12-01
Posts: 8

Re: Viber integration

yeaahhh!!!

Offline

#17 2022-10-04 07:15:38

iamshykhirfan
New member
From: New York
Registered: 2021-06-16
Posts: 2

Re: Viber integration

Would it be possible to send messages on Viber from the computer and view notifications? The process will be similar to SMS.

My SMS Provider: SMSala Technologies LLC

Offline

#18 2022-10-04 07:48:23

panariga
New member
Registered: 2021-12-01
Posts: 8

Re: Viber integration

iamshykhirfan wrote:

Would it be possible to send messages on Viber from the computer and view notifications? The process will be similar to SMS.

My SMS Provider: SMSala Technologies LLC

not really
Acting as Viber Bot, you can`t use phone number, only internal viber user ID.
so you need database with user IDs <=> phone numbers  to contact people

Offline

Board footer