Explanation of polling
When you enable a webhook event to be Polling, it means that the event call to your endpoint will be repeated until you reply that the polling can be finished, or the POS user manually cancels the process.
You can also reply with a message to display on the POS screen while your process is still running.
Example
Request
Let’s imagine a line is added to the session, and the
addSessionLine event is configured to be Polling.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
POST https://www.example.com/webhooks/addSessionLine X-Mplus-Subscription-Id: example_subscription X-Mplus-Signature: ... Content-Type: application/json Accept: application/json { "event": { "eventBlocking": true, "eventBlocking": true, "eventCounter": 1, "eventTimestamp": "2018-08-09T16:37:06.225+02:00" }, "sender": { "branchNumber": 1, "workplaceNumber": 1, "employeeNumber": 1, }, "session": { "sessionId": "f2fa2d23-8133-417a-a28c-d35728951ef7", "lines": [ { "lineId": "c686f63d-46a7-498e-b421-c72e5cb7136b", "articleNumber": 1, "priceIncl": 2.50, "quantity": 1, "text": "Coffee" } ] }, "addSessionLine": { "lineId": "c686f63d-46a7-498e-b421-c72e5cb7136b", "articleNumber": 1, "priceIncl": 2.50, "quantity": 1, "text": "Coffee" } } |
Response (continue polling)
In the response, you can tell the POS that polling is done, but you can also opt to return a status update message
1 2 3 4 5 6 7 8 9 |
X-Mplus-Signature: Hw32mfaemYSyRkuGWQigI2HSC9sJx8B7v/uzwy+YuVI= { "polling": { "finished": false, // make this true if you want to finish the Polling process "message": "We're not done yet. Please stand-by, the customer needs to do something.", "customerMessage": "Please do what you have to so the process can continue." } } |
Response (finish polling)
In the response, you can tell the POS that polling is done, but you can also opt to return a status update message
1 2 3 4 5 6 7 8 9 |
X-Mplus-Signature: Hw32mfaemYSyRkuGWQigI2HSC9sJx8B7v/uzwy+YuVI= { "polling": { "finished": true, "message": "We're done. The customer did what he had to do.", "customerMessage": "Thank you!" } } |