This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

MS Teams integration
#9
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?
Reply


Messages In This Thread
MS Teams integration - by Thomas - 11.12.2020, 15:38
RE: MS Teams integration - by admin - 17.12.2020, 08:55
RE: MS Teams integration - by Thomas - 17.12.2020, 11:02
RE: MS Teams integration - by maavcrusoe - 15.10.2021, 11:07
RE: MS Teams integration - by nmedalacabeza - 24.03.2024, 11:57
RE: MS Teams integration - by admin - 25.03.2024, 11:14
RE: MS Teams integration - by nmedalacabeza - 26.03.2024, 06:05
RE: MS Teams integration - by admin - 26.03.2024, 08:36
RE: MS Teams integration - by nmedalacabeza - 01.04.2024, 09:00
RE: MS Teams integration - by admin - 02.04.2024, 06:55

Forum Jump: