...
Erweitern | ||||
---|---|---|---|---|
| ||||
You will learn about action buttons. How they enable a task-like-workflow with status updates between both systems and which different varriations exist.
|
...
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 could can be sent . (For details see webhook -> send actions)
Functionality
To attach actions 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:
...
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:
...
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 be 2 buttons created, where the “Accept” button initiates a form with every available type of input.
Codeblock |
---|
{ "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":{ "labelType":"error" }, "required":true, { "type":"acceptboolean", "label":"AcceptSend to guest", "labelDone":"Accepted", "labelTypedefaultValue":"success",true "information":{}, "messageToGuesttime":{ "required":falsetrue, "type":"texttime", "label":"Message to guestTime", "defaultValue":"Thank you for your request, we will contact you as soon as possible.12:00" }, "internalCommentdate":{ "required":falsetrue, "type":"stringdate", "label":"Internal commentDate", "defaultValue":"Right after vacation29.08.2018" }, "booleanValuedateTime":{ "required":true, "type":"booleandateTime", "label":"Send to guestDate/Time", "defaultValue":true"29.08.2018 12:00" }, "timeuser":{ "required":true, "type":"timeuser", "label":"TimeResponsible", "defaultValue":"12:00"[ "7657" ] }, "datenumber":{ "required":true, "type":"datenumber", "label":"DateCosts", "defaultValue":"29.08.2018" },12.4, "dateTimemeta":{ "requiredmin":true10, "type":"dateTime", "labelmax":"Date13, + Time", "defaultValuestep":"29.08.2018 12:00"0.1 } }, "userselect1":{ "required":true, "type":"user"enum", "label":"small selection", "labeldefaultValue":"Responsible1", "defaultValuemeta":[{ "7657options":[ ] { }, "numbervalue":{"1", "requiredlabel":true,"Option 1" "type":"number", }, "label":"Workload", { "defaultValue":12.4, "metavalue":{"21", "minlabel":10,"Option 21" "max":13}, "step":0.1 { } }"value":"31", "select1":{ "requiredlabel":true,"Option 31" "type":"enum", } "label":"small Options", ] "defaultValue":"1", } "meta":{ }, "optionsselect2":[ { { "required": true, "valuetype": "1enum", "label": "Optionlittle 1selection", },"defaultValue": "1", "meta": { "valueoptions":"21", "label":"Option 21" [ }, { { "value": "3111", "label": "Option 3111" } }, ] } { }, "select2":{ "requiredvalue":true, "211", "type":"enum", "label": "enormousOption options",211" "defaultValue":"1", }, "meta":{ "options":[ { { "value": "11311", "label": "Option 11311" }, }, { "value":"211",{ "label":"Option 211" "value": "1", }, { "label": "Option 1" "value":"311", }, "label":"Option 311" }, { { "value": "121", "label":"Option 1" "label": "Option 21" }, { }, "value":"21", { "label":"Option 21" }, "value": "31", { "valuelabel": "Option 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:
Codeblock |
---|
{ "eventName": "requestStatusChange" "responseType":"accept", "hotelkitID":"73014444213", "messageToGuest":"Thank you very much for your request, we willare contacthappy youto asaccept soon as possible.the order", "internalComment":"RightImplement after vacationthe 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" } |
...