# Tutorial: Multi Channel Delivery
Senders might need to deliver documents through multiple delivery channels, like the Peppol and DICO (opens new window) networks. This page explains the workings of the PSB's multi channel delivery features and provides some examples.
# Setting up multiple delivery channels
Delivery channels are configured using hooks. By default all PSB environments have the Peppol delivery channel enabled. This is the peppol
hook with topic Send*
:
{
"id": "peppol",
"name": "default send via peppol delivery",
"action": "peppol",
"topics": [
"Send*"
],
"isActive": true,
"createdOn": "2020-05-01T00:00:00+00:00"
}
If this is the only hook with a Send
topic, all topics like SendInvoice
and SendOrder
will be routed through the Peppol delivery channel.
To add another delivery channel, another hook needs to be configured. For example this DICO hook:
{
"id": "dico",
"name": "send via dico delivery",
"action": "dico://{endpoint}?applicationId={applicationId}&mode={authMode}&header={authHeader}",
"topics": [
"SendInvoice"
],
"isActive": true,
"createdOn": "2020-05-01T00:00:00+00:00"
}
Now all invoices will be sent via the DICO channel instead of Peppol.
# Selecting a channel
Only one delivery channel can be used per delivery. The selected channel is based on a number of parameters. These parameters are, in order of priority:
- Hooks on PartyId level have higher priority than hooks on environment level.
- Specific topics like
SendInvoice
have higher priority than wildcard topics likeSend*
. - If the previous two parameters are equal the priority will be decided by the id of the hook. We'll first try to order the id's as integers and then as text. For example the following id's are ordered like: 1 - 02 - 10 - dico - peppol.
# Query the recipient
The queryRecipientParty
endpoints can be used to find out which channel will be used when sending to a specific id. Use /api/v1/{partyId}/salesInvoice/queryRecipientParty for invoices and /api/v1/{partyId}/purchaseOrder/queryRecipientParty for orders. In the response the hook id and description can be found for the used delivery channel:
{
"channel": "peppol",
"description": "default send via peppol delivery",
"id": "NL:KVK:54441587"
}
# Force a delivery channel
Sometimes the delivery channel with the highest priority is not the delivery channel that's best for a certain transaction. That's why all the send
endpoints, like /api/v1/{partyId}/salesInvoice/send and /api/v1/{partyId}/purchaseOrder/send, have a channel
query parameter. With this parameter a specific delivery channel can be forced by setting the value to the hook id of the required delivery channel. In the queryRecipientParty
example above the channel with the highest priority was peppol
when sending an invoice to NL:KVK:54441587
. By specifying ?channel=dico
when calling /api/v1/{partyId}/salesInvoice/send
the dico
channel can be forced instead.