Live Helper Chat support forum.. Old google groups forum can be found here

You are not logged in.

Announcement

#1 2021-02-24 11:11:29

shrnt
New member
Registered: 2020-10-19
Posts: 9

API to add system message

hello, i have been looking at the API swagger documentation.

For the chat

/restapi/chat 
Creates a new chat

it is possible to pass user_id to specify system message.

However, I would like to add a system message to an already existing chat.

I looked at addmsgadmin

/restapi/addmsgadmin
Add message to chat as an admin

The only parameters for this API are chat_id, msg, sender, meta_msg and operator_name.

How do I add system message to existing chat? Thanks

Offline

#2 2021-02-24 11:26:50

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

Re: API to add system message

Hi,
I just pushed this update https://github.com/LiveHelperChat/liveh … f0fa835e0e if you set sender as 'system' message will appear as a system message. Swagger still not updated to reflect this.

Offline

#3 2021-02-24 11:29:51

shrnt
New member
Registered: 2020-10-19
Posts: 9

Re: API to add system message

Thanks for the quick update. Will update and try it out!

Offline

#4 2021-02-25 11:39:17

shrnt
New member
Registered: 2020-10-19
Posts: 9

Re: API to add system message

UPDATE: Sorry, please ignore this. I had a problem when updating and the filepath for the modules was wrong. It works, thank you for the fix!!

Hi! Sorry but I am having trouble. After updating, I cannot see the changes.

This is a picture of my postman API call and response
1614252813_addmsgadmin.jpg

And this is my code that shows there is the update from yesterday's update
1614252973_addmsgadmincode.jpg

Testing was done after following the update instructions. To be sure, I also disabled and re-enabled caching, and clean cache in settings.

I am not sure if there is something else I can do. I have tried manually overwriting all $messageUserId at the end, but API call does not reflect this change.

if ($form->sender == 'system') {
    $messageUserId = -1;
} else if ($form->sender != 'bot') {
    $messageUserId = $userData->id;
} else {
    $messageUserId = -2;
}

$messageUserId = -1;

Last edited by shrnt (2021-02-25 11:52:49)

Offline

Board footer