> ## Documentation Index
> Fetch the complete documentation index at: https://mikting.docs.komo.moe/llms.txt
> Use this file to discover all available pages before exploring further.

# Examples

> Complete scripts you can copy into your configuration.

The `examples/` directory contains complete scripts. Copy a file to
`configs/Mikting/scripts/` (or the folder selected by `scripts.dir`), then
reload the addon. These examples use `follow-up-actions` for work after an
action and `not-met-actions` for a false condition.

## Count messages

[examples/kv-counter.yml](https://gitlab.com/komomori/mikting/-/blob/main/examples/kv-counter.yml) keeps a per-user message
count in the persistent store and runs a branch at a milestone. See
[Key-value store](https://mikting.docs.komo.moe/key-value-store.md) for scopes and expiration.

## Read a JSON response

[examples/http-get.yml](https://gitlab.com/komomori/mikting/-/blob/main/examples/http-get.yml) sends a GET request with a
query string, then replies with `echo_json_args_hello`. It branches on the HTTP
status so the script can handle failures.

## Receive a webhook

[examples/webhook-relay.yml](https://gitlab.com/komomori/mikting/-/blob/main/examples/webhook-relay.yml) handles an inbound
webhook and reacts to the message. A local request can be sent with:

`curl -X POST localhost:3000/mikting/hooks/deploys -d '{"repo":"x"}'`

Set `MIKTING_HOOK_DEPLOYS` to require a signature. See
[HTTP and webhooks](https://mikting.docs.komo.moe/http-and-webhooks.md) for signing details.

## Assign a role after a poll

[examples/poll-vote-role.yml](https://gitlab.com/komomori/mikting/-/blob/main/examples/poll-vote-role.yml) uses
`miktingPollVote` and gives a role to the voter.

## Branch on an API result

[examples/api-flag-gate.yml](https://gitlab.com/komomori/mikting/-/blob/main/examples/api-flag-gate.yml) authenticates with
`MIKTING_API_TOKEN`, checks a JSON flag, and deletes a message when the result
is true. It skips bots. Read [External APIs](https://mikting.docs.komo.moe/external-apis.md) before
using the pattern with a real provider.

[Documentation home](https://mikting.docs.komo.moe/index.md) · [Source Markdown](https://gitlab.com/komomori/mikting/-/blob/main/docs/mikting-examples.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.