Skip to main content

Session commands

info

LuaAuth provides a macro that allows you to execute functions on a users client remotely using the session messages endpoints
Check out session endpoints for how to send messages

How to use it

syntax: la_handle(key: string, func: function)

key is the messages id
func the function that will be executed

  • the first argument will be a table of data provided from the message request
  • the function can return a table

Example

la_handle('send_message', function(data)
print(data.message)

return {
random_thing = 'fr'
}
end)

JS example fetch request for above command

const response = await fetch(`https://api.luaauth.com/sessions/${id}/message`, {
headers: { 'Content-Type': 'application/json', token: 'API_KEY' },
method: 'POST',
body: JSON.stringify({
key: 'send_message',
data: {
message: 'test'
}
})
});

Example response body for above fetch request

{
"success": true,
"processed": true,
"response": {
"random_thing": "fr"
}
}