Overview
- Hublify integrates an option to exchange order- or orderitem-specific messages with a customer
- Each orderitem can have multiple messages from the customer and Hublify-users
- The Hublify system can inform the customer about new messages
- Messages can have attachments
Creating Order-Messages
To save a new message from a customer, you simply use the standard data-create endpoint.
Request URL
https://{your hublify url}/api/eos_10/data_create
Request parameter if the message relates to a specifc item
{
"dataset": "order_message",
"fields": {
"fk_omsg_oiid": 12345, // this is the internal id ("oiid") for the specific orderitem this relates to
"fk_omsg_persid": 1234, // this is the internal id ("persid") for the customer who wrote this message
"omsg_message": "A Message" // the actual message from the customer
}
}
or
Request parameter if the message relates to an order in general
{
"dataset": "order_message",
"fields": {
"fk_omsg_oid": 123, // this is the internal id ("oid") for the specific order this relates to
"fk_omsg_persid": 1234, // this is the internal id ("persid") for the customer who wrote this message
"omsg_message": "A Message" // the actual message from the customer
}
}
Response
{
"status": true
}
Getting messages
You can use the data from the orderitem-, the order- and the person-records to filter your list of of messages and to display them.
Request URL
https://{your hublify url}/api/eos_10/data_getList
Request parameter
Example: All messages for a specific item
{
"dataset": "order_message",
"filter": {
"fk_omsg_oiid": 12345
},
"fields": [
"omsg_id",
"omsg_insert_time",
"omsg_author_ref",
"drvd_author",
"omsg_message"
]
}
Response
{
"data": [
{
"omsg_id": 10, // The internal ID for this specific message
"omsg_insert_time": "2021-09-13 14:15:00", // Time the message was written
"omsg_author_ref": "person", // "person" means the customer wrote this message
"drvd_author": "Max Muster", // the displayable name for the author, here "firstname lastname" from the person-record
"omsg_message": "A message from the Customer" // the actual message
},
{
"omsg_id": 20, // The internal ID for this specific message
"omsg_insert_time": "2021-09-13 16:17:00", // Time the message was written
"omsg_author_ref": "user", // "user" means a Hbulify-User wrote this message
"drvd_author": "Customer-Service", // the displayable name for the author, username or specifically set name from the Hublify-User
"omsg_message": "<p>A <strong>reply<\/strong>.<\/p>" // the actual message
}
],
"status": true
}
Getting attached files
To access the attached files for a message you need the internal id for that message.
You can use the "ref_id" in data to access the files through the following URL
https://{your hublify url}/hfy/file?ref_id={ref_id}
Request URL
https://{your hublify url}/api/eos_10/volumeFile_getList
Request parameter
{
"filter": {
"omsg_id": "10",
"dataset": "order_message"
}
}
Response
{
"status": true,
"msg": null,
"data": [
{
"dtype": "file",
"name": "example.pdf",
"basename": "example.pdf",
"filename": "example",
"file_ext": "pdf",
"file_size": 164020,
"file_size_human": "160,2 KB",
"atime": "2021-09-21 12:58:25",
"mtime": "2021-09-21 12:58:25",
"dirname": "\/items\/1668--PC0002\/msg\/10\/",
"vol_label": "order_documents",
"ref_key": "A00002693",
"ref_id": "order_documents::A00002693||items|1668--PC0002|msg|10|example.pdf",
"ref_data": {
"ref_id": "order_documents::A00002693||items|1668--PC0002|msg|10|example.pdf",
"ref_key": "A00002693",
"vol_label": "order_documents"
},
"url": "\/hfy\/file?ref_id=order_documents%3A%3AA00002693%7C%7Citems%7C1668--PC0002%7Cmsg%7C10%7Cexample.pdf"
},
{
"dtype": "file",
"name": "my-logo.svg",
"basename": "my-logo.svg",
"filename": "my-logo",
"file_ext": "svg",
"file_size": 6528,
"file_size_human": "6,4 KB",
"atime": "2021-09-21 12:59:18",
"mtime": "2021-09-21 12:59:18",
"dirname": "\/items\/1668--PC0002\/msg\/10\/",
"vol_label": "order_documents",
"ref_key": "A00002693",
"ref_id": "order_documents::A00002693||items|1668--PC0002|msg|10|my-logo.svg",
"ref_data": {
"ref_id": "order_documents::A00002693||items|1668--PC0002|msg|10|my-logo.svg",
"ref_key": "A00002693",
"vol_label": "order_documents"
},
"url": "\/hfy\/file?ref_id=order_documents%3A%3AA00002693%7C%7Citems%7C1668--PC0002%7Cmsg%7C10%7Cmy-logo.svg"
}
]
}
Adding an attachment
To add a file to the message you need the internal id for that message.and a URL from where hublify can fetch the file
Request URL
https://{your hublify url}/api/eos_10/volumeFile_add
Request parameter
{
"filter": {
"omsg_id": "10",
"dataset": "order_message"
},
"sourceUrl": "https:\/\/hublify.io\/assets\/site\/hublify-logo.svg"
}
Response
{
"status": true,
"data": {
"dtype": "file",
"basename": "hublify-logo.svg",
"name": "hublify-logo.svg",
"filename": "hublify-logo.svg",
"file_ext": "svg",
"file_size": 6545,
"file_size_human": "6,4 KB",
"atime": "2022-01-11 15:57:38",
"mtime": "2022-01-11 15:57:38",
"uid": 33,
"gid": 33,
"dirname": "\/items\/1668--PC0002\/msg\/10\/",
"vol_label": "order_documents",
"ref_key": "A00002693",
"ref_id": "order_documents::A00002693||items|1668--PC0002|msg|10|hublify-logo.svg",
"ref_data": {
"ref_id": "order_documents::A00002693||items|1668--PC0002|msg|10|hublify-logo.svg",
"ref_key": "A00002693",
"vol_label": "order_documents"
},
"url": "\/hfy\/file?ref_id=order_documents%3A%3AA00002693%7C%7Citems%7C1668--PC0002%7Cmsg%7C10%7Chublify-logo.svg"
}
}
Removing an attachment
If you want to physically remove a file again, you need the "ref_id" for that file.
Request URL
https://{your hublify url}/api/eos_10/volumeFile_delete
Request parameter
{
"filter": {
"ref_id": "order_documents::A00002693||items|1668--PC0002|msg|10|hublify-logo.svg",
},
}
Response
{
"status": true,
"data": {
"cnt_found":1,
"cnt_deleted":1
},
"msg":null
}