Channel: send messages
Elements in messages
Toggles, inputs, charts and tables right inside a message.
A message can hold more than text and buttons: a button, a toggle, an input, a chart, a table. These elements only exist in messages.
You need: Send a message. For elements people can use, you also need a webhook.
Sending elements
Elements go in the elements field, up to 12 per message. Each one has a type and an id that is unique within the message:
curl https://api.packlets.app/v1/push \
-H "Authorization: Bearer $PACKLETS_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Error rate after deploy",
"text": "Since deploy v2.14, 6% of requests fail.",
"elements": [
{"type": "button", "id": "rollback", "label": "Roll back to v2.13"},
{"type": "toggle", "id": "auto_deploy", "label": "Automatic deploys", "value": true},
{"type": "chart", "id": "fehler", "label": "Error rate", "unit": "%", "chart": "line",
"points": [{"label": "9:00", "value": 0.2}, {"label": "10:00", "value": 6.2}]}
]
}'Which elements exist and which fields they have is covered in the Elements reference.
Reacting to taps
When you tap the button, flip the toggle or submit an input, your webhook gets the ui event:
{
"type": "ui",
"packlet_id": "9d2f7c10-3a5b-4c8e-9f21-6b7d8e9f0a12",
"message_id": "5b0c1a52-7c1e-4a43-9d0b-2f6f0c7d1e11",
"element_id": "auto_deploy",
"value": false,
"changed_at": "2026-11-10T18:00:00.000Z"
}element_id tells you which element it was, value is the new value. For a button, value is null. message_id tells you which message the action came from.
How your tool receives the event is covered in Set up a webhook.
Buttons or elements
Buttons (buttons) | Elements (elements) | |
|---|---|---|
| How often they can be used | once per message | as often as you like |
| What they can do | open a link or send an action | button, toggle, input, plus chart, table, text |
| The message shows afterwards | which button was chosen | the current state, for example the toggle |
You can use both in the same message.
Good to know
- You can't change them afterwards. Values in a message only change when you use them in the app. Your tool can't update them. Send a new message instead. If you need a view that is always up to date, build your own app.
- It's narrow. A message is narrower than the screen. Ideally leave elements at full width (no
width) and keep labels short. More in Element layout. - Ready-made examples to copy are in Templates.
- In the push, only the text appears. You only see elements in the app.