A webhook also called a web callback or HTTP push API, is a way for an app to provide other applications with real-time information. A webhook delivers data to other applications as it happens, unlike typical APIs where you would need to poll for data very frequently in order to get it in real time. This makes webhooks much more efficient for both the provider and the consumer. Webhooks are sometimes referred to as “Reverse APIs”, as they give you what amounts to an API spec, and you must design an API for the webhook to use. The webhook will make an HTTP request to your app (typically a POST) and you are then charged with interpreting it.
Each webhook is configured with the following properties:
- payload_url – this is the location in the client’s app where an HTTP POST request will be sent on the occurrence of an event the client has subscribed for.
- secret – this is a unique string generated by the client, which myPOS will use to sign the payload in the HTTP POST request. The parameter is limited to 32 characters.
- active – by default, the webhook is activated on creation. The client is allowed to update this flag.
- created_on – the UNIX timestamp of the time of creation. The field is auto-generated.
- deleted_on – if the client no longer wants the webhook, it can be soft deleted, otherwise, this value is NULL. The field is not editable by the client.