Help for watch emails module

:bullseye: What is your goal?

I’m trying to set up an automated invoice workflow; I’m at the beginning and I need to retrieve an email attachment to extract the order number.

:thinking: What is the problem & what have you tried?

However, I can’t seem to retrieve the order number using chat gpt because the email bundle is analyzing the wrong email. What should I do?

:clipboard: Error messages or input/output bundles

The prompt for GPT is french so you can translate it if you want : Tu es un système expert d’extraction du NUMÉRO DE COMMANDE
sur des factures fournisseurs françaises (BTP, négoce, matériaux).

Le numéro de commande est l’identifiant de la commande passée
par le client (…). Il fait 7 chiffres et commence par
l’année (2026, puis 2027 les années suivantes).

ÉTAPE 1 — Vérifier le type de document.
Cherche les mots : FACTURE, AVOIR, OFFRE DE PRIX, DEVIS,
BON DE LIVRAISON, BON DE COMMANDE.
Si le document est un DEVIS ou une OFFRE DE PRIX,
réponds exactement : DEVIS

ÉTAPE 2 — Repérer le numéro de commande.
Il est généralement introduit par une mention proche de
(toutes orthographes, accents, ponctuations et espaces variables) :
“CDE”, “CDE N”, “CDE N°”, “N° CDE”, “Commande”, “Commande N°”,
“Réf Cli”, “Réf/Cli”, “Votre commande”, “Bon de commande”,
“N° OF”, “Réf commande”, “Cde n°”, “PO”, “Order”.
Le nombre cherché : exactement 7 chiffres, commençant par 2026.

ÉTAPE 3 — Écarter les faux candidats.
Ne retiens JAMAIS :

  • numéro de facture (souvent 8 chiffres)
  • numéro de client
  • référence chantier (souvent ~6 chiffres, ex 201986)
  • numéro de bon de livraison (très long)
  • numéro de devis
  • codes produits, montants, dates, téléphones, IBAN, SIRET, TVA, code postal
    S’il existe plusieurs nombres de 7 chiffres commençant par 2026,
    choisis celui le plus proche d’une mention de commande de l’étape 2.

ÉTAPE 4 — Raisonne en silence puis donne UNIQUEMENT le résultat.
Réponds par UNE SEULE de ces sorties, sans aucun autre texte :

  • les 7 chiffres du numéro de commande
  • DEVIS (si c’est un devis/offre de prix)
  • INTROUVABLE (si aucun numéro valable)

Document :
{{49.extractedText}}

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

Your prompt looks fine, the issue is upstream. If GPT is “analyzing the wrong email,” then {{49.extractedText}} is already feeding it the wrong text, so no prompt change will fix it.

Some questions to narrow it down:

  • What module is feeding the text? Is your email module returning multiple bundles (several emails / several attachments), and you’re only processing the first one?

  • Can you check the output of module 49 directly — is the extracted text already the wrong document there? If yes, the problem is the email/attachment selection, not GPT.

If the email has multiple attachments, you’ll likely need a filter (or Iterator) to pick the right PDF before extraction. Could you share the scenario flow up to module 49 and that module’s output?