How to invoke Rest API in prosody

I need to make a REST API call when user leaves the meeting.

API to be added in speaker_stats in /usr/share/jitsi-meet/prosody-plugins/ext_events.lib.lua.

Code Tried:
local h = require “socket.http”
local ltn12 = require(“ltn12”)
local payload = [[ {“meetingId”:*********} ]]
local response_body = {}

local res,code,headers,status =
method = “POST” ,
url = "https://**",
headers = {[“Content-Type”] = “application/json”},
body = {“meetingId”:
print (code, headers, status)

Got 307 redirect when tried in local.
Not able to install luasocket in server.

Please also suggest any alternate techniques to call API.


There already exists a complete example of using Rest with Prosody in Jitsi-meet code, how about reading it and take ideas from it ?

Take a look at this:

If it does not suit your requirements, the code might serve as a guide on how to write your own.