Submit a Message passing the user fiscal_code in the request body

Descrizione

API per l’invio di messaggi verso un cittadino identificato tramite codice fiscale. Prima di inviare un messaggio è importante verificare che il cittadino sia iscritto ad IO e che il servizio possa inviare comunicazioni al cittadino stesso.

Submit a Message passing the user fiscal_code in the request body

Submits a message to a user with STANDARD or ADVANCED features based on feature_level_type value. On error, the reason is returned in the response payload. In order to call submitMessageforUser, before sending any message, the sender MUST call getProfile and check that the profile exists (for the specified fiscal code) and that the sender_allowed field of the user's profile it set to true.

POSThttps://api.io.pagopa.it/api/v1/messages
Authorization
Body
time_to_liveTimeToLiveSeconds (integer)

This parameter specifies for how long (in seconds) the system will try to deliver the message to the channels configured by the user.

Example: 3600
content*MessageContent (all of)
default_addressesobject

Default addresses for notifying the recipient of the message in case no address for the related channel is set in his profile.

fiscal_codeFiscalCode (string (FiscalCode))

User's fiscal code.

Example: "SPNDNL80R13C555X"
feature_level_typeFeatureLevelType (string)
Example: "STANDARD"
Response

Message created.

Headers
Body
idstring

The identifier of the created message.

Request
const response = await fetch('https://api.io.pagopa.it/api/v1/messages', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "content": {
        "subject": "Welcome new user !",
        "markdown": "# This is a markdown header\n\nto show how easily markdown can be converted to **HTML**\n\nRemember: this has to be a long text."
      }
    }),
});
const data = await response.json();
Response
{
  "id": "text"
}

time_to_live

Questo parametro è deprecato.

Descrizione

Tempo espresso in secondi che specifica il tempo di retry di delivery del messaggio

Obbligatorio

No

Default

3600

Tipo

Intero

Esempio

3600

content

subject

Descrizione

Titolo del messaggio, la cui lunghezza deve essere compresa tra 10 e 120 caratteri

Obbligatorio

Tipo

Stringa

Esempio

Rinnova la tua carta d'identità

markdown

Descrizione

Testo del messaggio in formato markdown la cui lunghezza deve essere compresa tra 80 e 10000 caratteri.

Obbligatorio

Tipo

Stringa

Esempio

This is my first message to the IO app. Use body markdown format with min 80 characters.

Per testare la sintassi in markdown, puoi utilizzare un servizio online come Stackedit.

due_date

Descrizione

Permette di associare al messaggio un promemoria. Il formato data deve essere ISO-8601 e timezone UTC.

Obbligatorio

No

Tipo

Stringa

Esempio

2018-10-13T00:00:00.000Z

Fai attenzione alla data impostata. Se la data di scadenza non prevede un orario specifico, solitamente si fa riferimento alla fine della giornata.

Esempio:

✅ 12 gennaio (23:59:59) --> L'utente può pagare entro la giornata del 12 gennaio

❌ 12 gennaio (00:00:01) --> L'utente può pagare entro la giornata dell'11 gennaio

payment_data

Per l’invio degli avvisi di pagamento è necessario richiedere specifica l’abilitazione.

amount

Descrizione

Importo in centesimi di euro dell’avviso di pagamento emesso su piattaforma pagoPA.

Obbligatorio

Sì, per pagamenti pagoPA

Tipo

Intero

Esempio

100

notice_number

Descrizione

Codice avviso di un avviso di pagamento emesso su piattaforma pagoPA.

Obbligatorio

Sì, per i pagamenti pagoPA

Tipo

Stringa

Esempio

301011100007347557

È importante che il codice fiscale del servizio mittente corrisponda al codice fiscale dell’ente creditore che emette l’avviso pagoPA.

invalid_after_due_date

Descrizione

In app visualizza il pagamento come scaduto se la data attuale è successiva a due_date

Obbligatorio

No

Default

false

Tipo

Booleano

Esempio

false

prescription_data

Questa funzionalità è in sperimentazione interna.

Esempi

### REQUEST
curl --location --request POST 'https://api.io.pagopa.it/api/v1/messages' \
--header 'Content-Type: application/json' \
--header 'Ocp-Apim-Subscription-Key: __YOUR_API_KEY__' \
--data-raw '{
"content": {
"subject": "Welcome new user !",
"markdown": "# This is a markdown header\n\nto show how easily markdown can be converted to **HTML**\n\nRemember: this has to be a long text."
},
"fiscal_code": "AAAAAA00A00A000A"
}'
### RESPONSE
{
"id": "01EM6X4JB9VSZTQ8H16KMQFCEJ"
}

Risorse utili

https://developer.io.italia.it/openapi.html#operation/submitMessageforUserWithFiscalCodeInBody

Last updated