⚠️Submit a Message passing the user fiscal_code as path parameter

Attenzione: la seguente API sarà a breve deprecata, pertanto se ne sconsiglia l’uso.

Descrizione

API equivalente a Submit a Message passing the user fiscal_code in the request body

Submit a Message passing the user fiscal_code as path parameter

Submits a message to a user. 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/{fiscal_code}
Authorization
Path parameters
fiscal_code*string

The fiscal code of the user, all upper case.

Example: "SPNDNL80R13C555X"
Pattern: [A-Z]{6}[0-9LMNPQRSTUV]{2}[ABCDEHLMPRST][0-9LMNPQRSTUV]{2}[A-Z][0-9LMNPQRSTUV]{3}[A-Z]
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/{fiscal_code}', {
    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"
}

Esempi

### REQUEST
curl --location --request POST 'https://api.io.pagopa.it/api/v1/messages/AAAAAA00A00A000A' \
--header 'Ocp-Apim-Subscription-Key: __YOUR_API_KEY__' \
--header 'Content-Type: application/json' \
--data-raw '{
"content": {
"subject": "My first IO app message with min 10 character",
"markdown": "This is my first message to the IO app. Use body markdown format with min 80 character"
}
}'
### RESPONSE
{
"id": "01EM6X4JB9VSZTQ8H16KMQFCEJ"
}

Risorse utili

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

Last updated