Skip to content

About

Generic OJS 3.4 plugin: HTTP webhooks on submission and publication events. By OJSBR. · Plugin genérico OJS 3.4: webhooks HTTP em eventos de submissão e publicação. Autoral OJSBR.

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

OJSBR Webhook — OJS plugin

OJS Version License

⬇️ Install package: OJS 3.4 — or browse all Releases.

A generic plugin for Open Journal Systems (OJS) that sends HTTP webhooks along the whole editorial workflow — submission started and completed, files, editorial decisions, review steps, participants, publication, versions and issues — so that other systems (a CRM, a message queue, an automation service) can react without polling OJS.

Developed and maintained by OJSBR. See the Credits & authorship section below.

Compatibility & branches

OJS version Branch Plugin release
OJS 3.4.x stable-3_4_0 (default) 4.0.0.0

Upgrade from 1.0.0.x. Earlier versions saved the endpoints and ran the Test button without checking the form's CSRF token, so a page opened by a logged-in journal manager could replace the endpoints and receive the journal's submissions. 1.0.1.0 requires a POST with the token, accepts only http/https endpoints and no longer writes endpoint URLs to the server log. Upgrading is strongly recommended.

1.1.0.0 delivers webhooks from the OJS job queue instead of inside the request that created the submission or published the article, so the editor no longer waits for the endpoints; a failed delivery is tried again twice, a minute apart. The queue must be processed (OJS's job_runner, on by default, or a worker/cron: see the PKP documentation on jobs).

The problem

OJS has no outgoing notification for "a submission arrived" or "an article went public". Systems that need to know either poll the API or depend on e-mail, and both miss the one case that matters: an article scheduled in a future issue only becomes public when the issue is published.

What it does

  • 21 events, chosen per endpoint (or * for all of them, including events added later):

    Group Event When
    Submission submission.created The author starts the submission wizard (or an import/the API creates it). The submission is still incomplete: submission.isSubmitted is false.
    submission.submitted The author finishes the wizard and the submission reaches the journal.
    submission.status_changed The status changes (queued, scheduled, published, declined), with statusChange.previousStatus/status.
    submission.file_uploaded A file is added to the submission: by the author, a revision, a reviewer, a discussion, or a copy made when the file moves to the next stage — file.fileStageName tells them apart.
    submission.deleted The submission is deleted (sent before it leaves the database).
    Editorial workflow decision.recorded An editorial decision (accept, decline, send to review, request revisions…), in decision.
    decision.recommended A recommendation by an editor who can only recommend.
    participant.assigned / participant.removed A user is assigned to / removed from the submission.
    Review review.assigned A reviewer is assigned (also when the request is resent).
    review.accepted / review.declined The reviewer answers the request.
    review.submitted The reviewer submits the review (recommendation in review.recommendationName).
    review.confirmed The editor confirms (acknowledges) the review.
    review.cancelled / review.reinstated The editor unassigns / reinstates the reviewer.
    Publication publication.created The article becomes public — not when it is merely scheduled in a future issue; it fires when that issue is published.
    publication.unpublished A public article is unpublished.
    publication.version_created A new version of a published article is created.
    Issues issue.published / issue.unpublished An issue is published / unpublished (each of its articles also sends its own publication.created).
  • Several endpoints per journal, each one with its events and an Active switch.

  • Signed payloads: with a secret, every request carries X-OJSBR-Webhook-Signature: sha256=<hmac>, computed as hash_hmac('sha256', $body, $secret).

  • Headers: X-OJSBR-Webhook-Event, X-OJSBR-Webhook-Delivery (the id of the payload, the same in every retry, to drop repetitions), X-OJSBR-Webhook-Attempt, X-OJSBR-Webhook-Timestamp and User-Agent: OJSBR-Webhook/<version>.

  • Test button per endpoint: choose the event and it sends a sample in the real format, filled with the latest submission of the journal, and shows the HTTP status.

  • Recent deliveries: the last 50 attempts of the journal (event, host, HTTP status, attempt) in the settings.

  • Delivered from the OJS job queue, up to 5 attempts, 5 minutes apart. A webhook never breaks the editorial action that caused it.

Installation

  1. Install via Settings → Website → Plugins → Upload A New Plugin, or extract the folder into plugins/generic/ so that you get plugins/generic/ojsbrWebhook/. Do not rename the folder: OJS derives the plugin's class namespace from the directory name.
  2. Enable OJSBR Webhook in the Generic plugins list.

The package is also published to GitHub Packages on every push to a stable branch (ghcr.io/ojsbr/ojsbrwebhook:3.4.latest, pulled with ORAS).

Configuration

Open the plugin's Settings: one block per endpoint, with its URL, an optional secret, the Active switch, the events it receives (grouped, or All events), a Test button with the event to test and a Delete button. Only absolute http and https URLs are accepted, and an endpoint with a URL needs at least one event. Below, the recent deliveries of the journal.

Payload (version 2; the fields of version 1 — event, occurredAt, contextId, baseUrl, object — are all still there):

{
  "id": "6f1c2a7e-8b1d-4c55-9f0e-2d7a1b3c4e5f",
  "event": "review.submitted",
  "payloadVersion": 2,
  "occurredAt": "2026-11-29T12:00:00+00:00",
  "test": false,
  "contextId": 1,
  "baseUrl": "https://journal.example.org",
  "context": { "id": 1, "path": "journal", "name": "Journal", "acronym": "JRN", "url": "https://journal.example.org/index.php/journal" },
  "actor": { "id": 9, "username": "reviewer", "fullName": "Rui Costa", "email": "rui@example.org", "orcid": null },
  "submission": {
    "id": 123, "contextId": 1, "locale": "pt_BR",
    "status": 1, "statusName": "queued", "stageId": 3, "stageName": "review",
    "submissionProgress": "", "isSubmitted": true, "dateSubmitted": "2026-11-20 10:00:00",
    "title": "Article title", "titles": { "pt_BR": "Título", "en": "Article title" },
    "currentPublication": { "id": 130, "version": 1, "status": 1, "doi": null, "...": "..." },
    "authors": [ { "fullName": "Ana Silva", "email": "ana@example.org", "orcid": null, "affiliation": "USP", "isPrimaryContact": true } ],
    "urls": { "workflow": "https://…/workflow/access/123", "authorDashboard": "https://…/authorDashboard/submission/123", "public": null }
  },
  "review": {
    "id": 55, "round": 1, "stageName": "review", "reviewMethodName": "doubleAnonymous",
    "recommendation": 2, "recommendationName": "pendingRevisions",
    "dateAssigned": "…", "dateDue": "…", "dateCompleted": "…",
    "reviewer": { "id": 9, "fullName": "Rui Costa", "email": "rui@example.org" }
  },
  "object": { "id": 55, "class": "PKP\\submission\\reviewAssignment\\ReviewAssignment", "submissionId": 123, "contextId": 1, "data": {} }
}

Each event adds its own block: decision (type, label, isRecommendation, stageName, round, editor…), review, participant (user, userGroupName), file (fileStageName, name, genreId, uploaderUserId…), statusChange, publication and issue. actor is the user who did it (null in scheduled tasks and the CLI). Reviewer identities are sent as they are: the endpoint belongs to the journal, so keep it private in double-anonymous review.

The endpoints are stored per journal in the plugin setting webhookEndpoints (JSON), with a site-wide fallback in context 0. The legacy settings webhookUrl / webhookSecret are still read when no endpoint list exists.

How it works (technical)

  • Hooks Submission::add, Submission::updateStatus, Submission::delete::before, SubmissionFile::add, Publication::publish (the status must be STATUS_PUBLISHED; a scheduled publication is skipped and announced when its issue is published), Publication::unpublish, Publication::version, IssueGridHandler::publishIssue and IssueGridHandler::unpublishIssue.
  • The application events SubmissionSubmitted (the author finished the wizard) and DecisionAdded (decisions and recommendations), which have no hook.
  • The review steps and the participants have no hook of their own, but each one is written to the submission event log: EventLog::add turns those entries into review.* and participant.*.
  • The hooks are always registered and each callback checks that the plugin is on in the journal of the submission, so submissions created by imports, the API or scheduled tasks are announced too. An event is queued once per object within a request, and the payload is only built when an active endpoint wants it; a failure while building it is logged and never reaches the editor.
  • Each delivery is a queued job (jobs/SendWebhook.php, on PKP's BaseJob) that posts through the HTTP client of the application (Application::getHttpClient(), which carries the proxy of config.inc.php), with a 5 s connection and 15 s total timeout, HTTP and HTTPS only, without following redirects. A failure fails the job, so the queue tries again (5 attempts, 5 minutes apart), and is logged with the event, the endpoint's host and the status — never the full URL, which can carry a token. Every attempt is kept in the plugin setting deliveryLog (the last 50 per journal) and shown in the settings.
  • Settings form on PKP's Form with FormValidatorPost, FormValidatorCSRF and a check that every URL is absolute http/https and has an event; the Test button requires a POST with the form's CSRF token. Adding, removing and testing rows is done by js/settings.js.

Tests

  • PHPUnit (tests/*Test.php, on PKP\tests\PKPTestCase): the classes against the installed PKP, the plugin found by PKP's plugin registry, the URLs that may receive webhooks, a delivery signed and posted through the application's HTTP client without redirects (mocked), errors naming the host only, a failed delivery failing the job, endpoint normalization (events, wildcard, active), the settings form (validators, rows kept, rows without events refused), webhooks queued only in journals where the plugin is on, only to active endpoints and only for publications that become public, submission.submitted and submission.status_changed with their payloads, the delivery headers, the hooks and events used, the templates and the 38 translations. From the OJS root:

    lib/pkp/lib/vendor/bin/phpunit --configuration lib/pkp/tests/phpunit.xml --no-coverage "$PWD/plugins/generic/ojsbrWebhook/tests"
  • Cypress (cypress/tests/functional/OjsbrWebhook.cy.js): enables the plugin, refuses a file:// endpoint and an endpoint without events in the settings form, runs the Test button against a closed local port (HTTP 0, without showing the URL's token), saves the endpoint and finds it again, checks that a test request without the form's token is refused, and sends a chosen event to a local receiver, checking the signature, the delivery id and the payload version, and finding the attempt among the recent deliveries. The endpoints are put back after the run.

  • Verified on OJS 3.4.0.10, including a delivery job dispatched to the database queue and received by a local receiver with a valid signature.

  • test-server/ holds a small Node/Express receiver for local development.

Tests are kept in the repository and are not part of the release package.

Credits & authorship

  • Developed and maintained by OJSBR — original plugin.
  • Distributed under the GNU GPL v3.

AI use

Generative AI (Claude, by Anthropic) was used to write and run tests, improve the code and bring it in line with PKP standards. Every change is reviewed and tested by OJSBR, which is responsible for the published releases.

Contributing

Issues and pull requests are welcome. See CONTRIBUTING.md.

License

Distributed under the GNU GPL v3. See LICENSE and docs/COPYING.


🇧🇷 Português

Plugin genérico para o Open Journal Systems (OJS) que envia um webhook HTTP quando uma submissão é criada e quando um artigo é de fato publicado, para que outros sistemas (CRM, fila de mensagens, automação) reajam sem ficar consultando o OJS.

Desenvolvido e mantido pela OJSBR. Veja a seção Créditos e autoria abaixo.

Compatibilidade e branches

Versão do OJS Branch Release do plugin
OJS 3.4.x stable-3_4_0 (padrão) 4.0.0.0

Atualização a partir da 1.0.0.x. As versões anteriores salvavam os endpoints e rodavam o botão Testar sem conferir o token CSRF do formulário: uma página aberta por um gestor logado podia trocar os endpoints e passar a receber as submissões da revista. A 1.0.1.0 exige POST com o token, só aceita endpoints http/https e não grava mais a URL do endpoint no log do servidor. A atualização é fortemente recomendada.

A 1.1.0.0 entrega os webhooks pela fila de jobs do OJS, e não mais dentro da requisição que criou a submissão ou publicou o artigo: o editor não espera os endpoints, e uma entrega que falha é tentada mais duas vezes, com um minuto de intervalo. A fila precisa ser processada (job_runner do OJS, ligado por padrão, ou worker/cron; veja a documentação da PKP sobre jobs).

O problema

O OJS não avisa ninguém quando chega uma submissão ou quando um artigo fica público. Quem precisa saber consulta a API ou depende de e-mail, e os dois perdem o caso que importa: o artigo agendado numa edição futura só fica público quando a edição é publicada.

O que faz

  • 21 eventos, escolhidos por endpoint (ou * para todos, inclusive os de versões futuras):
    • Submissão: submission.created (o autor inicia a submissão — ainda incompleta, submission.isSubmitted é false), submission.submitted (o autor conclui a submissão), submission.status_changed, submission.file_uploaded (qualquer arquivo; file.fileStageName diz de onde veio) e submission.deleted.
    • Fluxo editorial: decision.recorded (decisão editorial: aceitar, rejeitar, enviar para avaliação, pedir correções…), decision.recommended, participant.assigned e participant.removed.
    • Avaliação: review.assigned, review.accepted, review.declined, review.submitted, review.confirmed, review.cancelled e review.reinstated.
    • Publicação: publication.created (artigo público — não quando só foi agendado numa edição futura; dispara quando essa edição é publicada), publication.unpublished e publication.version_created.
    • Edições: issue.published e issue.unpublished.
  • Vários endpoints por revista, cada um com seus eventos e a opção Ativo.
  • Payload versão 2, compatível com o anterior: id único, context, actor (quem fez), submission (situação, etapa, título, autores, links) e um bloco por evento (decision, review, participant, file, statusChange, publication, issue).
  • Payload assinado: com segredo, cada requisição leva X-OJSBR-Webhook-Signature: sha256=<hmac>; também X-OJSBR-Webhook-Delivery (igual nas novas tentativas), X-OJSBR-Webhook-Attempt e X-OJSBR-Webhook-Timestamp.
  • Entrega pela fila de jobs do OJS, até 5 tentativas com 5 minutos de intervalo; o webhook nunca quebra a ação editorial que o causou.
  • Botão Testar por endpoint, com o evento escolhido e dados da última submissão da revista.
  • Entregas recentes: as últimas 50 tentativas da revista nas configurações.

Instalação

Instale em Configurações → Website → Plugins → Enviar um novo plugin, ou extraia a pasta em plugins/generic/ (ficando plugins/generic/ojsbrWebhook/). Não renomeie a pasta. Depois ative o OJSBR Webhook na lista de plugins Genéricos. O pacote também sai no GitHub Packages (ghcr.io/ojsbr/ojsbrwebhook:3.4.latest).

Configuração

Nas Configurações do plugin, um bloco por endpoint: URL, segredo opcional, Ativo, eventos (agrupados, ou Todos os eventos), Testar com o evento escolhido e Excluir; abaixo, as entregas recentes. Só são aceitas URLs absolutas http e https, e um endpoint com URL precisa de ao menos um evento. Exemplo de payload na seção em inglês. A lista fica no setting webhookEndpoints (JSON) da revista, com recuo para o contexto 0.

Testes

PHPUnit em tests/ (sobre PKP\tests\PKPTestCase), com o comando da seção em inglês: classes contra o PKP instalado, plugin encontrado pelo registro de plugins, URLs aceitas, entrega assinada e enviada pelo cliente HTTP da aplicação sem seguir redirecionamento (simulado), erro só com o host, entrega que falha derrubando o job, normalização dos endpoints (eventos, curinga, ativo), formulário (validadores, linhas mantidas, linha sem evento recusada), webhook enfileirado só onde o plugin está ligado, só para endpoints ativos e só para publicação que fica pública, submission.submitted e submission.status_changed com seus payloads, cabeçalhos da entrega, hooks usados, templates e as 38 traduções. Cypress em cypress/tests/functional/: liga o plugin, recusa endpoint file:// e endpoint sem evento, roda o botão Testar contra uma porta local fechada (HTTP 0, sem mostrar o token da URL), salva o endpoint e o encontra de novo, confere que o teste sem o token do formulário é recusado e envia um evento escolhido a um receptor local, conferindo assinatura, id da entrega, versão do payload e a tentativa nas entregas recentes; os endpoints voltam ao que eram no fim. Verificado no OJS 3.4.0.10, inclusive um job de entrega na fila database recebido por um receptor local com assinatura válida. test-server/ traz um receptor Node/Express para desenvolvimento local.

Os testes ficam no repositório e não fazem parte do pacote da release.

Créditos e autoria

  • Desenvolvido e mantido pela OJSBR — plugin autoral.
  • Distribuído sob a GNU GPL v3.

Uso de IA

Foi usada IA generativa (Claude, da Anthropic) para escrever e rodar testes, melhorar o código e alinhá-lo aos padrões da PKP. Toda mudança é revisada e testada pela OJSBR, que responde pelas releases publicadas.

Licença

Distribuído sob a GNU GPL v3. Veja LICENSE e docs/COPYING.

About

Generic OJS 3.4 plugin: HTTP webhooks on submission and publication events. By OJSBR. · Plugin genérico OJS 3.4: webhooks HTTP em eventos de submissão e publicação. Autoral OJSBR.

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages