Messages

EPASS has an internal messaging system that can be used to send messages to each user. The Messages resource can retrieve messages from the system, as well as add or delete messages.

Retrieve Messages


GET /system/services/messages/message


This endpoint returns one or more messages and their details based on the parameters you use.

Parameters

Name Description
id The message ID, which is found in the internal ID field in the EPASSMessagesUsers table.
usercode A EPASS user’s unique ID. This is found in the ID field of the User record. This is also the User Name that an EPASS user uses to log into EPASS. Searching for messages by usercode returns all messages sent or received by this user.
folder The EPASS Message system folder. Can be Inbox, Sent%Items, Deleted%Items, or Reminders.
msgtype Can be either Message or Reminder. A message acts like an email and is sent to and read from a user’s inbox. Reminders appear on the recipients screen at a specified time.
status Can be either Read or Unread.
mindate Use with maxdate to create a date range. Messages that were sent within the date range are returned.
maxdate Use with mindate to create a date range. Messages that were sent within the date range are returned.
mintime Use with maxtime to create a time range. Messages that were sent within the time range are returned.
maxtime Use with mintime to create a time range. Messages that were sent within the time range are returned.

Sample: Retrieving a Message by ID


GET /system/services/messages/message?id=123456

{
  "Result": {
    "Success": true,
    "Warning": false,
    "HttpStatusCode": 200,
    "GeneralMessage": "Returned 1 record",
    "ExceptionMessage": null,
    "Keys": [],
    "Messages": [],
    "Warnings": []
  },
  "Values": [
    {
      "Fields": {
        "UserTo": "1111",
        "CreationDate": "2021-06-17T00:00:00",
        "CreationTime": "13:07:11:075",
        "UserFrom": "EPASS",
        "RemindDate": "2021-06-17T00:00:00",
        "RemindTime": "13:07:11:075",
        "Viewed": false,
        "ViewedDateStamp": "1980-01-01T00:00:00",
        "ViewedTimeStamp": "00:00:00:000",
        "RequestReply": false,
        "Replied": false,
        "Subject": "Invoice : 123456 Your Product is Here",
        "MessageType": "Message",
        "ImportanceDegree": "5",
        "Deleted": false,
        "DeletedDate": null,
        "DeletedTime": "",
        "RelevantMessageUserDateTime": "",
        "Frequency": "O",
        "LastRemindedDate": "1980-01-01",
        "Archived": false,
        "PopUp": false,
        "FolderName": "Inbox",
        "MessageMode": "R",
        "ReadCode": false,
        "MessageOwner": "01130",
        "Reference": "Invoice # 123456",
        "SnoozeDate": "1899-12-30T00:00:00",
        "SnoozeTime": "",
        "SessionReminder": false,
        "Message": "\u0000\r\n\r\nModel 12457889 ordered for invoice #123456 just arrived.\r\n"
      }
    }
  ]
}

Add a Message


POST /system/services/messages/message


This endpoint adds a message to the EPASS Messaging system. If no payload is provided in the request, a sample JSON payload is returned.

Payload

Name Type Description
MessageType string Required. Message type can be Message or Reminder. A message acts like an email and is sent to and read from a user’s inbox. Reminders appear on the recipients screen at a specified time.
Subject string The message subject.
UserFrom string Required. The user sending the message. This must be a valid EPASS user code.
UserList array Required. The list of message recipients. These must be valid EPASS user codes.
Message string The message body.
RemindDate string Format: YYYY-MM-DDThh:mm:ss.sssZ
Message reminder date. If this is set, the message recipient receives a reminder to read the message at the specified date and time.
Frequency string The frequency of the reminder. Can be Once, Daily, Weekly, Monthly, or Yearly.
ReferenceType string ReferenceType (along with ReferenceNumber) is used to create a link to an invoice or purchase order in EPASS. When the message recipient reads the message, they can click a hyperlink that opens the document that is referenced. ReferenceType can be Invoice orPO.
ReferenceNumber string The invoice or PO number of the doucment type indicated in ReferenceType.

Sample: Adding a Message


POST v1/system/services/messages/message
{
    "MessageType": "Message",
    "Subject": "Part ordered",
    "UserFrom": "Pei",
    "UserList" : ["CHRIS"],
    "Message": "The part you ordered is in. Check the purchase order.",
    "RemindDate": "2021-06-15T00:00:00",
    "Frequency": "O",
    "ReferenceType": "PO",
    "ReferenceNumber": "RE12345"
}

{
    "success": true,
    "warning": false,
    "httpStatusCode": 201,
    "generalMessage": null,
    "exceptionMessage": null,
    "keys": [
        {
            "table": "ePassMessages",
            "keys": [
                {
                    "key": "ID",
                    "fields": [
                        {
                            "fieldName": "ID",
                            "fieldValue": 123456
                        }
                    ]
                }
            ]
        },
        {
            "table": "ePassMessagesUsers",
            "keys": [
                {
                    "key": "ID",
                    "fields": [
                        {
                            "fieldName": "ID",
                            "fieldValue": 123456
                        }
                    ]
                }
            ]
        },
        {
            "table": "ePassMessagesUsers",
            "keys": [
                {
                    "key": "ID",
                    "fields": [
                        {
                            "fieldName": "ID",
                            "fieldValue": 123456
                        }
                    ]
                }
            ]
        }
    ],
    "messages": [],
    "warnings": []
}

{
    "success": false,
    "warning": false,
    "httpStatusCode": 422,
    "generalMessage": "One or more of the fields has an invalid or missing value.",
    "exceptionMessage": null,
    "keys": [],
    "messages": [
        {
            "code": "MSG-01002",
            "message": "The UserFromCode DAVE does not exist."
        }
    ],
    "warnings": []
}

Delete a Message


DEL /system/services/messages/message


This endpoint deletes a message based on its internal ID field and user code. This is a logical delete.

Parameters

Name Type Description
id integer Required. The message ID, which is found in the internal ID field in the ePassMessagesUsers table.
usercode string Required. A EPASS user’s unique ID. This is found in the ID field of the User record. This is also the User Name that an EPASS user uses to log into EPASS. Searching for messages by usercode returns all messages sent or received by this user.

Sample: Deleting a Message


DEL /system/services/messages/message?id=486071


{
    "success": false,
    "warning": false,
    "httpStatusCode": 400,
    "generalMessage": null,
    "exceptionMessage": null,
    "keys": [],
    "messages": [
        {
            "code": "MSG-00012",
            "message": "Message ID does not exist."
        }
    ],
    "warnings": []
}