简体   繁体   中英

How do I use 'Send' in Roblox's Private Messages Web API?

I've been here trying to send a message with luasocket and it had some problems, being 403: Token Validation Failed and 401: Authorization has been denied for this request.

local socket = require'socket.http'
local json = require'json'

print(os.date('at %c'..', the program starts.'))
-- bottom part is similar to http://lua-users.org/lists/lua-l/2008-07/msg00206.html (not secure)

local result,code,headers,stats = socket.request(
    {
        method = 'POST',
        url = 'https://privatemessages.roblox.com/v1/messages/send',
        headers = ({
            ["Cookie"] =".ROBLOSECURITY=not-showing-to-you",
            ["content-length"]= 10 -- I have no idea how this thing works
        }
    }
)
print(json.encode(result))
print(code)
print(stats)
print(json.encode(headers))

从我可以看到你的问题是你放了“Cookie”,它应该是“cookie”也尝试删除 [] 看看是否有帮助

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM