My place in the WordPress community
- I have had a wordpress.org account since 2006.
- I contributed to WordPress core for versions 7.0 and 7.1.
- I maintain 30 plugins on wordpress.org.
- I organise and speak at WordCamps.
- I have attended every WordCamp Europe from 2017 to 2026.
- Local WordPress meetup: WordPress Torino Meetup

The Politecnico di Torino main building. Photo by Gabridelca under CC BY-SA 3.0, from Wikimedia Commons.
Italian public bodies reach citizens in the IO app, the public services app run by PagoPA. A body, or the supplier that builds its portal, sends messages from a back end through the IO API. If that back end is a Next.js application, the integration is a set of server-side route handlers and a small client around the API. I am Mariusz Szatkowski, a solo developer in Gdynia. I work remotely and in writing, and I am not a lawyer. What follows is based on the IO technical guide published by PagoPA. The business and legal side of using IO stays with your organisation.
How do I send a message to a citizen through the IO API?
The guide describes five steps. You publish a service, test the content of the message, check that the recipient can be contacted, send the message, and check the outcome. Messages are personal communications to one citizen identified by fiscal code. The guide states that a single call cannot reach several citizens.
Joining IO happens before any code. The setup page says an organisation joins through the Area Riservata. An aggregating body signs the accession agreement and sends it by certified email, and it lists the bodies it represents in the agreement’s annex. The same page says an aggregator may act only for the services it was mandated for. For a Next.js project this means I need your service key from the organisation, not the other way round.
What must I check before every send?
The guide says that each time you send, you must make sure the recipient exists and has consented to receive communications for that specific service. The profile API does this. You post the fiscal code in the request body, and the answer is positive only when two conditions hold: the HTTP status is 200, and the body contains sender_allowed set to true.
A second API, the subscriptions feed, is named in the same step. I have not read its contract in detail here, so check it in the guide before you rely on it for deliveries to many people.
A server-side function that does the check looks like this:
// lib/io-client.ts
import 'server-only'
const BASE = 'https://api.io.pagopa.it/api/v1'
const KEY = process.env.IO_SUBSCRIPTION_KEY!
export async function canContact(fiscalCode: string): Promise<boolean> {
const res = await fetch(`${BASE}/profiles`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Ocp-Apim-Subscription-Key': KEY,
},
body: JSON.stringify({ fiscal_code: fiscalCode }),
cache: 'no-store',
})
if (res.status !== 200) return false
const body = await res.json()
return body.sender_allowed === true
}The endpoint and header come from the guide’s examples. The server-only import comes from the Next.js data security guide, which uses it to keep a module from running on the client.
Which fields does the message need?
The submit API reference lists them. Constraints I would encode as a validation schema on the server:
| Field | Rule in the reference |
|---|---|
fiscal_code | required, the recipient |
content.subject | required, 10 to 120 characters, no personal data |
content.markdown | required, 80 to 10000 characters, UTF-8, personal data minimised |
require_secure_channels | optional boolean, marks sensitive content so push notifications are anonymised and no email copy is forwarded |
due_date | optional reminder, ISO-8601 in UTC |
time_to_live | marked deprecated in the reference, default 3600 seconds |
feature_level_type | STANDARD by default, ADVANCED only with a Premium subscription |
The reference says the subject cannot contain personal data under article 7.3 of the AgID guidelines. That rules out “Dear Mario Rossi, your permit” as a title. Put the citizen-specific text in the body, and keep that minimal too.
The due date needs care. The reference gives examples: 22:00:00Z on 30 September 2022 is midnight on 1 October in Italy, and a deadline with no stated time usually means the end of the day, so it warns against setting 00:01 for a deadline meant to end on that day. In a form, I would store the local date and convert to UTC on the server with an explicit time zone, not with the server’s clock setting.
How should the Next.js side be structured?
Three rules follow from the Next.js documentation.
- The key stays on the server. The environment variables guide says the browser receives only variables prefixed with
NEXT_PUBLIC_, and that those are inlined into the JavaScript bundle at build time.IO_SUBSCRIPTION_KEYhas no prefix. - Server Actions are public endpoints. The data security guide says an exported Server Action is reachable by a direct POST request, not just through your UI. A sending action therefore needs its own authorisation check, not an assumption that only your form calls it.
- Route handlers fit callbacks. The
route.jsreference listsPOSTamong the supported methods. If your organisation exposes the endpoints IO calls for remote content, a handler is the natural place.
The sending path itself is small:
// app/actions/notify.ts
'use server'
import { canContact, sendMessage } from '@/lib/io-client'
import { requireOperator } from '@/lib/auth'
export async function notifyCitizen(input: unknown) {
await requireOperator() // reject anonymous POSTs
const data = parseMessage(input) // length and field rules from the table
if (!(await canContact(data.fiscalCode))) {
return { ok: false, reason: 'not-reachable' }
}
return sendMessage(data)
}requireOperator, parseMessage and sendMessage are your own code. The point is the order: authorise, validate, check the profile, send.
How do I handle errors and rate limits?
The guide says all IO APIs can return error responses, defined in each API’s specification, and that the client must handle them. It gives one example: any API can return status 429, a signal that the allowed rate was exceeded. In that case you retry and lower the request rate with pauses. For a mass notice that means a queue with a limited concurrency and back-off, not a Promise.all over thousands of fiscal codes.
The submit reference adds a 422 for one case: with the services for minors enabled, a service not authorised to write to a minor gets HTTP 422. I would log that as a distinct outcome, not as a generic failure.
To check delivery, the guide points to the Get Message API, queried with the recipient’s fiscal code and the message id returned at submission. The reference lists email and push notification states: SENT, THROTTLED (a temporary overload, with delivery possible within the time to live and for at most 7 days), EXPIRED and FAILED. Read and payment status are, per the guide, available with the Premium agreement.
When should the content stay on my own systems?
The guide offers a second mode, the remote content message. It exists for communications with personal or sensitive data. IO does not store the title, body, optional opening preconditions or attachments. It fetches them from the sender’s systems each time the citizen opens the message. Your organisation is then responsible for their accuracy and availability.
The guide lists consequences that matter for the build:
- the content can change after sending, and the citizen gets no notice of an update, so a new message is preferable when the situation changes
- the guide says the sender remains data controller and must handle data subject rights itself, with requests redirected to it
- the
require_secure_channelsflag can be set on the message or on the service - attachments are a Premium feature, must be PDF/A-2a, and are retrieved from an endpoint you expose, with a
Third_party_datablock andHas_attachmentsset to true in the send request
Remote content turns your Next.js application into a service that IO calls. It must therefore be available when citizens open messages, which is a hosting requirement and not only a code one. The guide says an OpenAPI contract for those endpoints exists and that you define a remote configuration first. I would read both before estimating that part.
How does an IO integration project run?
- You send the organisation name, whether it is an aggregator, the message types, the expected volumes and the stack. I answer in writing the next working day with the IO pages I would read first.
- I write down the scope, the field rules above and the open questions for your IO contact.
- I build the module and a test harness on a staging copy, with the test messages the guide describes, and you review.
- After written acceptance, I deploy. Updates to the API contract are read from the guide when the version changes.
I need the repository, a hosting target, and the service key through a secure channel. For the general offer, see the Next.js developer page.
Planning citizen messages from a Next.js portal?
Send the message types, the volumes and the hosting target through the contact page. The first written estimate is free, and the reply tells you which parts of the IO guide I would read before quoting anything.
Selected projects
Examples of my work.
Tech platform: VECTOR TECHNOLOGIES
VECTOR Technologies is an international technology company specialising in the development and production of telecommunications systems for providers providers across Europe.
Travel & Tourism Site: kaminski.pl
Kaminski.pl is a website created for traveler and blogger Michał Kamiński, who shared his experiences from exploring the world, inspiring others to discover ...
Vector Solutions - Telecommunications Technology Pioneer
Vector Solutions is a company recognized in Poland and throughout Europe as a pioneer in the technology sector, transforming modern communication with innovative solutions for cable operators and telecommunications companies.
Need this service: Next.js developer in Turin?
Describe your project by e-mail. I reply within 24 hours.
Describe your projectExplore other WordPress services and knowledge base
Migration to Astro, Next.js, and headless WordPress.
WooCommerce sync with ERP and wholesale systems.
Business process automation around WordPress and company systems.
Library of concrete automation use cases.
Headless WordPress, Sanity, Strapi, and Contentful with Astro or Next.js.
Astro, MDX, edge delivery, and Core Web Vitals measured on real traffic.
Custom WordPress engineering and architecture.
Scalable headless, ERP, and AI architecture for enterprise.
Related categories
Supporting articles

Six to sixteen weeks for typical engagements, with a four-phase shape: discovery, scoping, build and cutover, tuning. The variables are catalogue size, integration count, URL preservation, and editorial team readiness, not framework choice.

A definitive 4-year Total Cost of Ownership (TCO) analysis, real-world Core Web Vitals benchmarks, Astro 7 GraphQL APQ architecture, and a 10-point executive decision matrix for choosing between decoupled and traditional WordPress.

The Shopify Plus vs WooCommerce headless decision in 2026 is no longer a binary "platform vs custom" trade-off. Both can run headless, both integrate AI, both ship at the edge. The real axes are control, total cost over five years, and exit strategy. This article walks the matrix with confirmed platform facts.