Secure webhooks

LuaAuth provides a macro to securely send discord webhooks

Use this to stop people from stealing your webhook url or viewing what your sending to it

This macro encrypts all data meaning users have no way to get your url or content sent to the webhook

Syntax: la_send_webhook(url: string, data: json): json

Params:

Name Type Description
url String the webhooks url
data JSON the webhook requests body

Return data:

Example:

local result = la_send_webhook('https://discord.com/api/webhooks/example', {
    embeds = {{
        title = 'EMBED_TITLE',
        description = 'EMBED_DESCRIPTION',
    }}
})

if not result.success then
    print('request failed due to ' .. result.reason)
else
    print('webhook sent successfully')
end

Server side verification

LuaAuth provides a macro you can use to verify webhook data
Highly recommend you use this to prevent users from modifying inputs

Syntax: la_verify_input(data: string, regex: string)

Params:

Name Type Description
data String input to verify
regex string regex to verify input against

Example:

la_send_webhook('https://discord.com/api/webhooks/example', {
    content = '',
    embeds = {{
        title = 'EMBED_TITLE',
        description = 'User is in server `' .. la_verify_input(game.JobId, '[0-9]{4,22}') .. '`'
    }}
})

Server side variables

LuaAuth provides some server sided variables when you use secure webhooks
Users cannot modify these values due to them being server sided

Syntax: "#VARIABLE_NAME#"

Available variables

Name Description
LA_DISCORD_ID The users linked discord id or "NULL"
LA_USER_KEY The users key or "NULL"
LA_EXECUTOR The users executor
LA_NOTE The users note or "NULL"
LA_SCRIPT The scripts name

Example:

la_send_webhook('https://discord.com/api/webhooks/example', {
    content = '',
    embeds = {{
        title = '#LA_SCRIPT# was run',
        description = 'Users key: ||#LA_USER_KEY#||'
    }}
})