Print

ePUAP_ReceiveMessages()

ePUAP_ReceiveMessages() function fetches messages from the queue in the selected ePUAP mailbox and creates new cases fulfilled with the content of messages. Function also extracts all attachments inside the message and adds them into the attachment list of the created case.

Syntax

ePUAP_ReceiveMessages(userName, mailboxName, mailboxAddress, map);
ePUAP_ReceiveMessages(userName, mailboxName, mailboxAddress, map, options);

Function arguments

  • userName – (String) a user’s name (login) of ePUAP user (an owner of the mailbox where messages are fetched from);
  • mailboxName – (String) a name of the ePUAP mailbox where messages are fetched from;
  • mailboxAddress – (String) a full address of the ePUAP mailbox where messages are fetched from;
  • map – (Object) a definition of the mapping object that defines fields on the newly created case where particular parts (properties) of message should be saved. Available mandatory properties:
    • ’messageContent’ (raw XML content of message, Document field),
    • ’sendingDate’ (date when message was sent, DateWithTime type),
    • ’responseAddress’ (address where can reply to, any text field),
    • ’receiverMailboxName’ (name of receiver’s mailbox, text type),
    • ’receiverMailboxAddress’ (address of receiver’s mailbox, text type),
    • ’senderName’ (username of sender, text type),
    • ’userId’ (id of sender, text type),
    • ’userType’ (type of sender, text type),
    • ’userFirstNameShortCompanyName’ (fistname or shortname of sender, text type),
    • ’userLastNameFullCompanyName’ (lastname or fullname of sender, text type),
    • ’userNIP’ (Polish tax number NIP of sender, text type),
    • ’userPESEL’ (PESEL number of sender, text type),
    • ’userREGON’ (REGON number of sender, text type),
    • ’userConsent’ (info whether user accepted consent, boolean type),
    • ’CID’ (important id which collects messages in threads, text type),
    • ’templateName’ (name of template of received xml message, text type),
    • ’correctnessFlag’ (info whether messages was fetched successfully, boolean type);
  • options – (Object) [Optional] an additional options to customize receiving messages and creating new cases. Available properties to set:
    • ’messageLimit’ (max. number of messages to fetch, default: 10),
    • ’processStage’ (stage for a newly created case, default: the first stage that can be a starting stage)
    • ’caseOwner’ (owner for a newly created case, default: systemuser).

Return value

This function returns Object.
ePUAP_ReceiveMessages() returns a JSON object with following properties:

  • ’Status’ (only allowed values are 'OK’ and 'Error’),
  • ’Description’ (an error description),
  • ’NumOfMessagesInQueueBefore’,
  • ’NumOfReceivedMessages’,
  • ’NumOfMessagesInQueue’ (a number of messages that are still in the queue).

Examples

Example 1:
Function tries to fetch the next 20 messages (or less if there is not 20) from the queue from ePUAP mailbox 'mainMailbox’ (a full address of mailbox is '/amoditoffice/mainMailbox’) on behalf of the user 'amoditoffice’. The 'map’ object defines which fields on a newly created case should be filled with the received data. For instance, 'messageContent’ (a raw file of the message content) will be saved in a field named 'MessageFile’ and so on for other properties. The 'options’ object increases max. message limit to 20 and determines that case owner for new cases will be user named 'someAmoditUser’.

map.messageContent = "MessageFile";
map.sendingDate = "SendingDate";
map.responseAddress = "ResponseAddress";
map.receiverMailboxName = "ReceiverMailboxName";
map.receiverMailboxAddress = "ReceiverMailboxAddress";
map.senderName = "SenderName";
map.userId = "UserId";
map.userType = "UserType";
map.userFirstNameShortCompanyName = "FirstNameOrShortCompanyName";
map.userLastNameFullCompanyName = "LastNameOrFullCompanyName";
map.userNIP = "NIP";
map.userPESEL = "PESEL";
map.userREGON = "REGON";
map.userConsent = "Consent";
map.CID = "CID";
map.templateName = "templateName";
map.correctnessFlag = "correctnessFlag";
options.messageLimit = 20;
options.caseOwner = 'someAmoditUser';
res = ePUAP_ReceiveMessages("amoditoffice", "mainMailbox", "/amoditoffice/mainMailbox", map, options);
Czy artykuł był pomocny?
0 na 5 gwiazdek
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
How Can We Improve This Article?