Skip to main content
The dispatch step is the final stage of the workflow. Operators navigate to a category panel, review the news items assigned to that area, and copy a formatted digest to send to the relevant officials via WhatsApp. Each government area has its own panel at:
/controlmedios/panel/:cat
The :cat route parameter is the category name (e.g., Salud, Infraestructura, General). The panel loads only the news items whose topics array includes that category.
Category names in the URL are case-sensitive and must match exactly the area names defined in the Google Sheets keyword source.

The category panel

The panel shows the filtered list of news items for the selected area. Each item displays:
  • The editable summary (iaResume)
  • The media outlet and program
  • The link
  • A guardar / editar toggle
  • A copy single item button
The panel header shows the category name and the total item count.

Copying all items: copyAll()

The Copy all button calls copyAll(), which assembles the complete digest for the category and writes it to the clipboard in a WhatsApp-ready format. Only items that have an iaResume value are included — items without a summary are silently skipped:
copyAll(items): void {
  let TODOS = '\n' + '📍 RESUMEN DE ' + this.categoria.toUpperCase() + '\n\n';

  items.forEach((t) => {
    if (t.iaResume) {
      const topics = t.topic.join(';');
      t.topics = topics;

      // upsert to WordPress
      const noticiaExistente = this.noticiasGuardadas.find(
        (n) => n.acf.id_ === t.id_
      );
      if (noticiaExistente) {
        const dataToUpdate = { ...t, id: noticiaExistente.id };
        this.sharedService.ActualizarNoticias(dataToUpdate);
      } else {
        this.sharedService.guardarNoticias(t);
      }

      const cop =
        '->*' + t.iaResume + '* \n' +
        '-> ' + t.media + ' / ' + t.program + '\n' +
        '🔗 ->' + t.link.trim() + '\n\n \n';
      TODOS += cop;
    }
  });

  navigator.clipboard.writeText(TODOS).then(() => {
    this.toast = true;
    this.cerrarToast();
  });
}
The resulting clipboard text follows this structure:

📍 RESUMEN DE SALUD

->*First story summary* 
-> Radio Nacional / El Informativo
🔗 ->https://example.com/story-1

 
->*Second story summary* 
-> Canal 10 / Noticias Mediodía
🔗 ->https://example.com/story-2

 
Each item block contains:
LineContent
Line 1->*iaResume* — the summary in WhatsApp bold
Line 2-> media / program — outlet and program separated by /
Line 3🔗 ->link — the trimmed URL preceded by a link emoji
Lines 4-5Blank separator lines between items
Paste the clipboard content directly into the WhatsApp group for the relevant government area. The formatting renders as bold text and emoji in WhatsApp.

Toast notification

After copyAll() writes to the clipboard, a toast notification appears in the UI confirming that the digest was copied. The toast auto-dismisses after a few seconds.

Saving items to WordPress

The upsert to WordPress is triggered automatically inside copyAll() — each item with an iaResume is persisted as part of the same action that copies the digest to clipboard. The save logic uses an upsert pattern based on the item’s id_ field:
1

Set topics string

Before saving, copyAll() joins t.topic with semicolons and stores the result in t.topics, which is the field persisted to WordPress ACF.
2

Check for existing record

The method searches noticiasGuardadas (loaded from WordPress at startup) for an entry whose acf.id_ matches the current item’s id_.
3

Update or create

  • If a matching record is found, sharedService.ActualizarNoticias({ ...item, id: existingPost.id }) is called to update the existing WordPress post.
  • If no match exists, sharedService.guardarNoticias(item) is called to create a new WordPress post.
The id_ is derived from the message timestamp during parsing and is stable across re-uploads of the same log. Re-dispatching the same item will update the existing WordPress record rather than create a duplicate.

The “guardar / editar” toggle

Each item in the panel has a guardar / editar control with two states:
StateMeaning
editarThe item is in read mode. Click to enter edit mode and modify iaResume.
guardarThe item is in edit mode. Click to save changes and trigger the upsert to WordPress.
This inline toggle allows operators to make last-minute summary edits before persisting the item, without leaving the category panel.

Curation

How operators refine summaries and manage categories before dispatch.

Ingestion

Return to the start of the workflow.

Build docs developers (and LLMs) love