A webhook is a method of data transfer that enables web developers to define custom HTTP callbacks that are triggered by certain events.
The Webhooks extension will be removed in October 2022
Existing applications implemented with Webhooks remain operational, but creating new ones is not recommended.
Available as a replacement, there is the new Webhooks API incorporated in the MyCashflow API.
Currently, MyCashflow's Webhooks extension enables you to:
- Get order data
- Processing orders
- Add order comments
The extension can be used to integrate your online store's orders with external software. Integrations can also be implemented by using MyCashflow REST API.
Extensions are not available in MyCashflow Free plan.
Pricing
Using the extension is free of charge.
Basic principles
Webhooks are used by sending HTTP requests in a programming language (usually by using the cURL software) to the online store's Webhooks address. From the address, MyCashflow's Webhooks extension returns an answer to the request in XML format.
Webhooks commands of the GET
type can also be used by entering the desired Webhooks address in the browser's address bar. In this way you can easily test Webhooks requests in your online store.
Whenever an order arrives at your online store, an automatic POST request is sent to the address defined in the extension settings (apart from orders created via MyCashflow API).
Below you can see descriptions of all parts of a Webhooks request:
- The connecting point of all Webhooks requests is
https://STOREADDRESS.mycashflow.fi/webhooks/
- The desired action is then added after the connecting point (see the list of permitted actions):
https://STOREADDRESS.mycashflow.fi/webhooks/get
- Next the request is supplemented with the relevant
GET
orPOST
parameters:https://STOREADDRESS.mycashflow.fi/webhooks/get?order=n
- At the end, the online store's individual API key is added to the request:
https://STOREADDRESS.mycashflow.fi/webhooks/get?order=n&key=jyghji765rfghji
- When performing a Webhooks request in the browser's address bar, there is no need to add the API key to the address as long as you are logged in to your online store's admin panel.
The example below illustrates a Webhooks request in which a public order comment is sent to the customer:
https://STOREADDRESS.mycashflow.fi/webhooks/process
action=add_comment
order=23
message="Public comment's contents"
public_message=1
key=kjhbnko987654e
Installation and setup
Read also the general instructions for installing and deploying extensions.
Extensions are not available in MyCashflow Free plan.
In the extension settings, define the address to which Webhooks callbacks should be sent from the online store as well as the API key used for authentication.
When a new order is placed in the online store, an automatic POST request with order details will be sent to the Webhooks address.
After defining the Webhooks settings, make sure that the extension works properly by sending a request to the address you've indicated (see the section below for permitted actions). For instance, you can place a test order so than an automatic order notification is sent.
Webhooks actions
You can see below all actions enabled by MyCashflow's Webhooks extension and their parameters.
See also the examples that illustrate how the actions can be used in practice.
For more information about the structure of the answer in XML format, see #concept_eyp_zpg_4db.
POST /webhooks/process action=deliver | ||
---|---|---|
Marks the order as shipped. | ||
order | Integers | Processed order ID |
send_email | 0 / 1 | The value "1" sends shipping confirmation via email to the customer and shipping address. By default, no confirmation is sent (value 0). |
POST /webhooks/process action=add_comment | ||
---|---|---|
Adds a comment to the order. | ||
order | Integers | Processed order ID |
public_message | 0 / 1 | Defines whether a comment is public, and a comment notification should be sent via email to the customer and delivery address (a value of 1). Comments are private by default (value 0). |
message | Text | The order comment's content in text format. |
GET /webhooks/get | ||
---|---|---|
Used for fetching one or more orders based on their ID numbers. | ||
order | Integers | ID number of the order to be fetched |
order_ids | Integer table | Used for fetching multiple orders based on their ID numbers. E.g. |
GET /webhooks/changes | ||
---|---|---|
Used for fetching orders based on their creation and edit dates. Returns 100 orders at a time starting from the indicated date. | ||
created_after_ts | String | A starting point in time in the Unix timestamp format for fetching orders that were created after that point. E.g. |
updated_after_ts | String | A starting point in time in the Unix timestamp format for fetching orders that were updated after that point. |
GET /webhooks/send | ||
---|---|---|
Used for resending a Webhooks message that failed. | ||
order | Integers | Order ID number |
Return values
All data returned by Webhooks is in XML format. You can see a Webhooks' response below in XML format.
Examples
You can see examples below of successful actions that can be carried out by using the Webhooks extension.
See all the detailed descriptions of all actions and the available parameters.