Live Helper Chat support forum.. Forum is locked. New place for questions - Github Discussions
You are not logged in.
Pages: 1
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
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!
PeopleInside - Live helper chat - free limited forum support!
For commercial support or GitHub [see FAQ here]
If you want to support this open source project, just donate [see support page]
Something wrong with the forum? [contact a superhero]
Offline
Try to use sender.id in id field. Also please ping e tomorrow on discord server perhaps i could help more
Offline
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
I’ll look tomorrow how to improve just write on discord server so I’ll inform once it will be improved
Offline
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
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
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
Offline
unfortunately viber keeps types of messages in second level attribute
Offline
That's perfectly fine see this sample
"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
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
That's identical how mesasgeBird implementation looks like...
https://doc.livehelperchat.com/docs/int … d-whatsapp
Offline
in that case I can`t access sender.ID because it in another location
so every message goes to new chat
Offline
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
I pushed related change there. Try to apply and see now
Offline
yeaahhh!!!
Offline
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
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
Pages: 1