LammaDevelopers Open Lamma

Building

Post into a channel from your own service with a secret URL.

A webhook is a secret URL that posts messages into one server text channel, without signing in and without a bot. It suits alerts, build results, game scores and anything else your own service wants to announce. The request body follows Discord's "Execute Webhook" for the parts Lamma supports, so a script written for a Discord webhook usually works once you swap the URL.

#Making a webhook

People with the Manage webhooks permission in a channel make its webhooks in Server settings › Integrations. Apps can't create webhooks.

The URL looks like this:

Text
https://lammapp.sa/api/webhooks/{webhook_id}/{secret}

It is shown once, when the webhook is made or given a new URL. Lamma keeps only a hash of the secret, so it can't show the URL again.

A webhook can post only as far as the person who made its current URL could. If they leave the server, the webhook stops for good (403, webhook_paused, paused_reason: "maker_left") until someone makes a new URL. While they are timed out or can't send messages in the channel, it is paused (paused_reason: "maker_cannot_send") and works again as soon as they can.

#Executing a webhook

POST/api/webhooks/{webhook_id}/{secret}

Send JSON with Content-Type: application/json. No cookie or token is needed.

Terminal
curl -X POST "https://lammapp.sa/api/webhooks/<id>/<secret>?wait=true" \
  -H "Content-Type: application/json" \
  -d '{"content": "Build 42 passed", "embeds": [{"title": "Release", "description": "Version 2.1 is live", "color": 5164938}]}'

Answers 204 No Content. With ?wait=true it answers 200 with the message: id, channel_id, guild_id, content, author, embeds, timestamp and webhook_id.

FieldNotes
contentUp to 2,000 characters. Mentions use <@user id>, <@&role id>, @username and @everyone. <#channel id> links a channel
usernameOverrides the webhook's name for this post
embedsUp to 10, with Discord's limits: title 256, description 4,096, url, color (a number), timestamp, author.name and author.url, footer.text, up to 25 fields, 6,000 characters in total
cardsUp to 5 link cards, a Lamma feature. Pictures in webhook cards aren't supported yet
allowed_mentionsparse (users, roles, everyone), users, roles. Without it, mentions notify as far as the webhook's maker could mention in that channel

#Accepted but not shown

avatar_url, embed image, thumbnail, video, provider, author.icon_url and footer.icon_url. Lamma never loads pictures from other sites into people's browsers, so the webhook's own picture is used instead.

#Ignored

tts, flags, thread_id, thread_name, components, poll and applied_tags.

#Not supported

File uploads (multipart/form-data) answer 415. Editing or deleting messages through the URL, changing the webhook through the URL, and the /slack and /github variants answer 404 or 405.

#Getting a webhook

GET/api/webhooks/{webhook_id}/{secret}

Returns the webhook's id, name, channel and server. Never the secret or who made it.

#Errors

StatusCodeMeaning
40050035The body is invalid
40050006The message is empty
403200000AutoMod blocked the post
403webhook_paused, see above
40410015Unknown webhook. Also for a wrong secret or a deleted channel, so the URL never says which part was wrong
41550109The body isn't JSON
429Rate limited. See Rate limits

#How posts appear

A post shows the webhook's name (or the username you sent) and picture with a Webhook tag. Nobody can edit it, and deleting it needs Manage messages. AutoMod checks webhook posts, including the text of embeds and cards, unless a rule skips webhooks.