Status Management
To process status changes in hotelkit the partner can attach actions to a request. Those actions will be presented to the customer as buttons.
As soon as the customer hits the button, the result will be sent back to the partner via the defined webhook, and new actions can be sent in the response.
Requirements
To attach actions to a request, the partner must be granted the functionality hasActions.
To confirm your functionalities you can use GET /setup/partner.
Definition
Attributes
Every action will be presented to the customer as a button. Therefore all information for displaying the button must be sent:
Attributes | Data type | Description |
---|---|---|
type* | string | Identifer of the action. Will be sent back to the partner to identify the hit action. |
label* | string | Label of the button before the action will be triggered. |
labelDone* | string | Label of the action, after it was triggered. |
labelType* | enum [“string”, “text”, “number”, “boolean”, “date”, “time”, “dateTime”, “user”, “enum”] | Gives information about the style of the button. See Bootstrap Buttons |
isDone* | boolean | Says whether a request can be closed after the action. This is the case whenever there is no further immediate action of the customer required. |
information | information{} | Additional information the customer has to insert before sending the action. Those information will be sent to the partner and are giben in detail in the next section. |
Information types
Whenever additional information is submitted, the customer will be presented with a form with all the requested information. Every information is given as one input. To define those inputs, these attrbiutes are available:
Attributes | Data type | Description |
---|---|---|
required* | string | Describes whether the input has to be set before the action can be sent to the partner. |
type* | enum [“string”, “text”, “number”, “boolean”, “date”, “time”, “dateTime”, “user”, “enum”] | Defines the type of the information. Determines how the input will be displayed to the customer. Details are shown below. |
label* | string |
Label of the information. Customer should know what information is requested after presented with this label. |
defaultValue | string |
A pregiven value for the information. Must be a valid input for the type. |
meta | object | Additional information that define the input. Possible attributes are set by the type and are described below. |
Given the type of information the presentation of the input is set:
string
The customer should insert a short text.
text
The input will be presented to the customer as a textbox. This is suitable whenever the customer should insert a longer string than a single sentence.
number
The customer should insert a number. To specify this number, the following meta information can be made:
Information | Description |
---|---|
min | The minimum value of the inserted number. |
max | The minimum value of the inserted number. |
step | Defines the interval for valid numbers (starting with the min value). |
If all meta information are given, the customer will be presented with a slider for assisting the input.
boolean
A checkbox will be presented to the customer.
date/time/dateTime
The customer will be presented with a datepicker. The value and defaultValue will be in the format “dd.mm.YYYY HH:ii” (or subsets)
user
The customer will be asked for a (or multiple) user of hotelkit. The valid values are all hotelkitIDs the partner gets with GET /users
The value and defaultValue will be an array of those hotelkitIDs.
For this option, the partner must be granted the functionality userList as otherwise there are no hotelkitIDs available.
See the example for an implementation.
enum
The customer will have a set of options to choose from.
Are there more than 3 options available, the customer will see a dropdown instead of a radio button.
The options will be given as an array via the meta attribute. Each option consist of:
Key | Description |
---|---|
value | The value that will be sent to the partner. |
label | The string that will be presented to the customer. |
Example
There will be 2 buttons created, where the “Accept” button initiates a form with every available type of input.
{
"actions":[
{
"type":"decline",
"label":"Decline",
"labelDone":"Declined",
"labelType":"error"
},
{
"type":"accept",
"label":"Accept",
"labelDone":"Accepted",
"labelType":"success",
"information":{
"messageToGuest":{
"required":false,
"type":"text",
"label":"Cover letter to guest",
"defaultValue":"Thank you very much for your request, we are happy to accept the order"
},
"internalComment":{
"required":false,
"type":"string",
"label":"Internal comment",
"defaultValue":"Implement after the holiday"
},
"booleanValue":{
"required":true,
"type":"boolean",
"label":"Send to guest",
"defaultValue":true
},
"time":{
"required":true,
"type":"time",
"label":"Time",
"defaultValue":"12:00"
},
"date":{
"required":true,
"type":"date",
"label":"Date",
"defaultValue":"29.08.2018"
},
"dateTime":{
"required":true,
"type":"dateTime",
"label":"Date/Time",
"defaultValue":"29.08.2018 12:00"
},
"user":{
"required":true,
"type":"user",
"label":"Responsible",
"defaultValue":[
"7657"
]
},
"number":{
"required":true,
"type":"number",
"label":"Costs",
"defaultValue":12.4,
"meta":{
"min":10,
"max":13,
"step":0.1
}
},
"select1":{
"required":true,
"type":"enum",
"label":"small selection",
"defaultValue":"1",
"meta":{
"options":[
{
"value":"1",
"label":"Option 1"
},
{
"value":"21",
"label":"Option 21"
},
{
"value":"31",
"label":"Option 31"
}
]
}
},
"select2": {
"required": true,
"type": "enum",
"label": "little selection",
"defaultValue": "1",
"meta": {
"options": [
{
"value": "11",
"label": "Option 11"
},
{
"value": "211",
"label": "Option 211"
},
{
"value": "311",
"label": "Option 311"
},
{
"value": "1",
"label": "Option 1"
},
{
"value": "21",
"label": "Option 21"
},
{
"value": "31",
"label": "Option 31"
}
]
}
}
}
}
]
}
This is how the buttons will be displayed to the customer:
As soon as the customer triggers the action “Accept” a form with the information pops up:
After clicking “Send”, a request is sent to the webhook of the partner:
{ "eventName": "requestStatusChange"
"responseType":"accept",
"hotelkitID":"73014444213",
"messageToGuest":"Thank you very much for your request, we are happy to accept the order",
"internalComment":"Implement after the holiday",
"booleanValue":true,
"time":"12:00",
"date":"29.08.2018",
"dateTime":"29.08.2018 12:00",
"user":[
7657
],
"number":12.4,
"select1":"1",
"select2":"1"
}