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.

Sending notifications with SIGNL4
#2
Try this. Result and/or errors can be seen in the Logs tab.

Code:
secret = '12345'
title = 'alert'
message = 'alert from LM'

http = require('socket.http')
json = require('json')
ltn12 = require('ltn12')

data = json.encode({
  Title = title,
  Message = message,
})

resp = {}
res, code = http.request({
  url = 'https://connect.signl4.com/webhook/' .. secret,
  method = 'POST',
  headers = {
    ['content-type'] = 'application/json',
    ['content-length'] = #data,
  },
  source = ltn12.source.string(data),
  sink = ltn12.sink.table(resp),
})

if res and code == 200 then
  resp = table.concat(tbl)

  log(resp)
else
  log(res, code)
end
Reply


Messages In This Thread
Sending notifications with SIGNL4 - by CarlS - 23.01.2023, 11:25
RE: Sending notifications with SIGNL4 - by admin - 23.01.2023, 11:37

Forum Jump: