Skip to content

bpwhelan/AnkiBeacon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AnkiBeacon

AnkiBeacon posts JSON events from Anki to local or remote HTTP receivers.

The current release emits note_added events when Anki creates notes through Collection.add_note() or Collection.add_notes(). It also sends an optional heartbeat so external apps can prefer push delivery while Anki is running and fall back to polling only when the heartbeat expires.

The add-on package/folder name remains new_card_created for compatibility. The public project name is AnkiBeacon, leaving room for more webhook event types in future releases.

Configuration

Edit the add-on config in Anki from Tools > Add-ons > AnkiBeacon > Config, or edit config.json directly while developing.

{
  "defaults": {
    "timeout_seconds": 5,
    "headers": {},
    "show_error_tooltips": true
  },
  "operations": [
    {
      "operation": "note_added",
      "enabled": true,
      "urls": [
        "http://127.0.0.1:7275/anki/events"
      ],
      "payload_mode": "note_id"
    },
    {
      "operation": "heartbeat",
      "enabled": true,
      "urls": [],
      "fallback_operation": "note_added",
      "interval_seconds": 10,
      "show_error_tooltips": false
    }
  ]
}

Each entry in operations owns the URLs and options for one event stream. If the heartbeat operation has no URLs, it uses fallback_operation to send heartbeats to the note_added URLs, and the receiver should branch on event.

Events

note_added

{
  "addon": "new_card_created",
  "addon_name": "AnkiBeacon",
  "protocol_version": 1,
  "session_id": "9b2b4eb1d7e046b5a2f916f35f2f9ef1",
  "event": "note_added",
  "source": "add_note",
  "created_at": "2026-04-22T23:00:00+00:00",
  "note_id": 1234567890,
  "deck_id": 987654321
}

payload_mode: "note" adds note fields, tags, card IDs, and basic card metadata.

heartbeat

{
  "addon": "new_card_created",
  "addon_name": "AnkiBeacon",
  "protocol_version": 1,
  "session_id": "9b2b4eb1d7e046b5a2f916f35f2f9ef1",
  "event": "heartbeat",
  "status": "ready",
  "sent_at": "2026-04-22T23:00:00+00:00",
  "heartbeat_interval_seconds": 10,
  "payload_mode": "note_id",
  "capabilities": ["heartbeat", "note_added"]
}

See INTEGRATION.md for receiver guidance.

AnkiWeb Upload

Create the .ankiaddon archive from inside this folder so the archive root contains files such as __init__.py, config.json, and manifest.json.

Do not include the containing new_card_created folder, __pycache__ folders, or local meta.json state in the upload archive.

About

An Anki Addon that hooks into various functionality in Anki, and sends out webhook-style events to configurable URLs.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors