MDH GROUP · BLOG

Automatic Target Switch via API: Use Webhooks to Activate QR Targets Live at Product Release

You have flyers, product packaging, or POS materials with QR codes that should point to the live page only at product launch. Until then they should lead to staging, test pages, or a “coming soon” page. At release, all codes must be switched reliably and audibly to the live URL

← All posts

Automatic Target Switch via API: Use Webhooks to Activate QR Targets Live at Product Release

Problem: Printed QR codes should go live at release — without a new print run

You have flyers, product packaging, or POS materials with QR codes that should point to the live page only at product launch. Until then, the codes should direct to staging, test pages, or a “Coming soon” page. At release, all codes must be switched reliably and traceably to the live URL — ideally as part of your release workflow. Manual changes are error-prone, slow, and hard to audit.

Why dynamic QR codes with API & webhooks are the better choice

Dynamic QR codes separate the physical code from the target. That means: the printed code remains valid, you only change the target URL via the Linkentra API. Webhooks provide real-time notifications about changes and allow automatic logging, tests, and rollbacks. This creates speed, control, and an auditable process.

In short: Benefits for your team

  • Fast switch from staging → live without reprinting
  • Integration into CI/CD: target switching as a release step
  • Audit trail via webhook events and centralized logs
  • Test hooks before print approval to verify scan target and tracking

Practical case: Release workflow with the Linkentra API and webhooks

The following example describes a typical flow for product teams using Linkentra (cloud or self-hosted):

Step 1 – Preparation (before print approval)

  • Create dynamic QR codes in Linkentra that initially point to staging URLs or a verification page.
  • Define test hooks: a dedicated webhook URL for QA that checks whether target pages are delivered correctly and whether tracking parameters are correct.
  • Define permissions: who is allowed to initiate target switches via the API? Configure API keys or OAuth scopes accordingly.

Step 2 – Automatic test before print approval

Before printing, your CI job automatically triggers a test hook that validates the staging targets (status codes, load time, content checks). Only when all tests pass is printing approved.

Step 3 – Release: Staging → Live via API

During the production release, an API call from your CI/CD pipeline script updates the “target URL” field of the respective QR code. After a successful update, Linkentra sends a webhook with details of the change to your audit log infrastructure and to monitoring jobs that verify the successful switch.

Concrete integration steps and examples

Below are example flows and payloads. Adapt names, paths, and fields to your Linkentra instance.

1) Example: API request to change the target URL

Example request (simplified representation):

PATCH https://your-linkentra-instance/api/v1/links/{qr_id}/target

Payload (JSON): {"target_url":"https://www.meinprodukt.de/live","changed_by":"ci-release-bot@organisation"}

Result: Linkentra confirms the change and returns the new configuration. Your CI checks the response status and logs Time/Actor/ID.

2) Example: Webhook event on target change

After the update, Linkentra sends a webhook event to your configured endpoints. Example payload (simplified representation):

{"event":"link.updated","qr_id":"{qr_id}","old_target":"https://staging.meinprodukt.de","new_target":"https://www.meinprodukt.de/live","changed_by":"ci-release-bot@organisation","timestamp":"2026-11-12T09:00:00Z"}

Use this event for:

  • Audit logs (who, when, before/after)
  • Automatic verification (monitoring checks whether the new URL is reachable)
  • Notifications to stakeholders (e.g. Slack, email)

3) Test hook before print approval

A test hook is a dedicated webhook endpoint that responds when creating a QR code or on a manual trigger. The hook performs automated checks:

  • HTTP status code and content check of the target page
  • Tracking parameters and UTM validation
  • Rendering on mobile user agents

First green result → print approval possible. Error → ticket in your issue tracker with a link to the QR code and the log.

Audit trail & security: best practices

  • Log all API calls with actor, timestamp, qr_id and payload diff (old vs. new).
  • Use webhooks as a secondary source for the audit trail; verify event signatures (HMAC) before accepting events.
  • Keep minimal API keys for release bots and rotate keys regularly.
  • For self-hosted: restrict networks and use TLS; establish access rules for webhooks.

Rollback strategy and fallbacks

Plan for a quick rollback: store the previous target URL in your release job or in the database. In case of a faulty release, another API patch can restore the old URL. Alternatively, use time-based/fallback targets of the QR codes (if configured) to automatically point to an information page in case of failure.

Practical checklist for setup

  • Create QR codes in Linkentra and assign staging targets
  • Create API credentials for the release pipeline
  • Register webhook endpoints for audit, QA and monitoring
  • Implement test hooks: automated checks before print approval
  • Write release job: update → confirmation via webhook → verification
  • Provide and document a rollback job

Example flow in 6 actions (summary)

  1. CI creates QR with staging URL.
  2. QA pipeline triggers test hook and validates the target page.
  3. On success: print approval for the materials.
  4. Product release: CI calls the Linkentra API and sets the live URL.
  5. Linkentra sends a webhook: audit log & monitoring check the change.
  6. If problems occur: call the rollback API or activate a fallback target.

Tips for better traceability

  • Include a changed_by field with a bot or username in every API call.
  • Store diff snapshots in your release repository.
  • Automate Slack notifications for successful switches and rollbacks.
  • Use export formats (e.g., CSV/JSON) to periodically archive historical changes.

Conclusion

With dynamic QR codes in Linkentra, combined with API calls and webhooks, the critical step “Staging → Live” can be integrated into your release workflow in a secure, fast and traceable way. This reduces launch risks, avoids reprints and creates a clean audit trail for compliance and reporting — whether you use Linkentra in the cloud or self‑host it.

Discover Linkentra: Learn more and test the workflow at https://linkentra.de.

Next step

Try Linkentra yourself

Dynamic QR codes with control over hosting and data: change content afterwards, adjust branding, manage media centrally and analyze scans — either on your own infrastructure (Self‑Hosted) or immediately in the Linkentra Cloud. Edition‑dependent features for teams, API and white‑label.

Discover Linkentra