freescout2ant/README.md
Claude 3c3a092f7a
Track failed Ameise archive attempts and add retry tooling
Previously a thread could be skipped silently in ConversationArchiver
(no customer match, ambiguous match, API/network error, attachment
failure) without any record. Default-off logging hid the cause, and the
queue job swallowed exceptions, so messages "archived" in FreeScout
never surfaced as missing in Ameise.

Now every archive attempt records a row in the new crm_archive_attempts
table with status, sanitized HTTP response, attempt counter and
resolution timestamp. ArchiveThreadsJob retries transient failures up to
5 times with exponential backoff; ameise:list-failed-archives and
ameise:retry-failed-archives expose the queue from the CLI; the Ameise
settings page lists open failures with retry/dismiss buttons.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VU73s4KM5JZqVWQYPpK3cP
2026-06-16 23:06:49 +00:00

53 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Ameise Freescout Package
## Installation
1. Download the latest module zip file via the releases card on the right.
2. Transfer the zip file to the server in the Modules/AmeiseModule folder of FreeScout.
3. Unpack the zip file.
4. Remove the zip file.
5. Activate the module via the Modules page in FreeScout.
Log in to Ameise to connect.
## Update instructions
1. Download the latest module zip file via the releases card on the right.
2. Transfer the zip file to the server in the Modules/AmeiseModule folder of FreeScout.
3. Remove the content of the folder AmeiseModule
4. Unpack the zip file.
5. Remove the zip file.
6. Activate the module via the Modules page in FreeScout.
## Logging
Verbose module logs (including Cron-Logeinträge) are disabled by default to avoid
ein übermäßiges Wachstum der `activity_logs`-Tabelle. Bei Bedarf können Sie sie
über die Umgebungsvariable `AMEISE_LOG_STATUS=true` wieder aktivieren.
## Tracking fehlgeschlagener Archivierungen
Auch bei deaktiviertem `AMEISE_LOG_STATUS` werden Fehlversuche dauerhaft in der
Tabelle `crm_archive_attempts` festgehalten (Grund, HTTP-Status, bereinigte
Response). Konkrete Status:
- `failed_no_customer` / `failed_ambiguous_customer` kein eindeutiger Ameise-Kunde zur Mailadresse
- `failed_api` Ameise hat per HTTP gemeldet, dass die Archivierung nicht klappt
- `failed_token` Tokenfehler beim Aufruf
- `failed_attachment` Hauptnachricht ist angekommen, Anhänge teils nicht
- `failed_exception` unerwartete Exception (nach allen Queue-Retries endgültig)
Tools:
- CLI: `php artisan ameise:list-failed-archives [--since=24h] [--status=failed_api]`
- CLI: `php artisan ameise:retry-failed-archives --conversation=123` oder `--id=456` oder `--all`
- UI: Settings → Ameise → Sektion „Archivierungs-Fehler" listet offene Fälle mit „Erneut versuchen"/„Erledigt"-Buttons
`ArchiveThreadsJob` versucht Exceptions automatisch bis zu 5×
(Backoff 1 min / 5 min / 15 min / 1 h / 4 h) erneut; der Cron `ameise:archive-threads`
greift offene Threads zusätzlich alle 5 Minuten wieder auf.
## Attachment Handling
Image attachments are automatically converted to PDF before being archived.
## Scan Only Modus
Wenn der Betreff einer E-Mail `#scanonly` enthält, werden nur die Anhänge archiviert
die E-Mail selbst wird nicht an Ameise übertragen. Die Erkennung ist case-insensitive
(`#scanonly`, `#SCANONLY`, `#ScanOnly` etc.).