n8n-nodes-onebot-trigger
v0.1.4
Published
OneBot trigger node for n8n with HMAC-SHA1 webhook verification
Downloads
361
Maintainers
Readme
n8n-nodes-onebot-trigger
OneBot Trigger community node for n8n.
Features
- Receives OneBot webhook events via trigger webhook.
- Verifies fixed
x-signatureheader usingHMAC-SHA1. - Uses credential Secret for signature verification when provided.
- If credential/Secret is empty, signature verification is skipped.
- Returns
401when signature verification fails. - Optional strict mode: invalid signatures return
401with empty body. - Outputs parsed JSON event payload to workflow on success.
- Adds a
onebotobject with commonly used fields (userId,groupId,noticeType, etc.).
Local development
npm install
npm run buildRun n8n with custom extensions:
N8N_CUSTOM_EXTENSIONS=~/source/n8n/dist n8n startSimulate webhook request
Quick way:
SECRET='your-secret' npm run test:webhookYou can also override target URL and request body:
WEBHOOK_URL='http://localhost:5678/webhook/onebot' \
SECRET='your-secret' \
BODY='{"post_type":"message","message_type":"private","user_id":10001,"self_id":20002,"message":"hello"}' \
npm run test:webhookManual curl version:
BODY='{"post_type":"notice","notice_type":"notify","sub_type":"poke","user_id":123,"target_id":456}'
SECRET='your-secret'
SIG=$(printf '%s' "$BODY" | openssl sha1 -hmac "$SECRET" | awk '{print $2}')
curl -i 'http://localhost:5678/webhook/onebot' \
-H "content-type: application/json" \
-H "x-signature: sha1=$SIG" \
--data "$BODY"Node parameters
Credential: optionalOneBot Webhook APIcredential (Secret is read from here).HTTP Method: webhook method, defaultPOST.Path: webhook path, defaultonebot.Event Type: dropdown filter forpost_type, chooseAllto pass all.Message Type: shown whenEvent Type=message.Notice Type: shown whenEvent Type=notice.Request Type: shown whenEvent Type=request.Message Sub Type: shown whenEvent Type=message.Notice Sub Type: shown whenEvent Type=notice.Request Sub Type: shown whenEvent Type=request.User ID: primary filter foruser_id; comma-separated values, leave empty to pass all users.Group ID: primary filter forgroup_id; comma-separated values, leave empty to pass all groups.Self ID,Target ID: optional comma-separated allow-lists.Strict Invalid Signature Response: when enabled, invalid signatures return empty body.Emit Skipped Item On Filter Mismatch: when enabled, unmatched events are forwarded withskipped=true; when disabled (default), unmatched events are acknowledged and dropped.
Filter behavior
- Any empty filter means no restriction for that field.
- For all user IDs to pass, leave
User IDempty. - Same rule applies to
Group ID,Self ID, andTarget ID. - For unmatched events: by default they are dropped (only HTTP 200 response is returned). If
Emit Skipped Item On Filter Mismatchis enabled, an item is still emitted withskipped=truefor debugging/branching.
