01.04.2024, 09:00
(This post was last modified: 01.04.2024, 09:05 by nmedalacabeza.)
Code:
require('ssl.https')
require('json')
local token = 'TU_TOKEN_DE_ACCESO' -- Token de acceso de la aplicación en Microsoft
local team_id = 'ID_DEL_EQUIPO'
local channel_id = 'ID_DEL_CANAL'
-----------------------------------------------------------------------------------------
function send_message(message)
local url = 'https://graph.microsoft.com/v1.0/teams/' .. team_id .. '/channels/' .. channel_id .. '/messages'
local message_data = { body = { content = message } }
local json_data = json.encode(message_data)
local headers = {
["Authorization"] = "Bearer " .. token,
["Content-Type"] = "application/json",
["Content-Length"] = tostring(#json_data)
}
return https.request(url, {
method = "POST",
headers = headers,
source = ltn12.source.string(json_data)
})
end
Hello, would it be something like that?