This article presents a possible use case and corresponding sample flow that you can support. This can be a helpful jumping off point as you plan your implementation.
When Wix calls Invoke to execute your action, you can return a response telling the site to wait before running subsequent actions. This is useful if certain actions take time to process on your end.
Let's say your app provides booking services to gyms. When a new customer signs up for their first training session, they must be approved by a trainer based on health forms and other data. Your app provides an action that notifies trainers of a new member and awaits their approval to confirm a session.
A new customer signs up and Wix sends an Invoke request like this:
Since it may take some time for a trainer to respond, your app requires a waiting period of 1 day from the time the notification is sent. Your app sends a default response and the needed timeout length (in this case the maximum possible length):
Note that if you needed a longer period of time, you could use the TIMEOUT_DATE
option and set a date up to a year from the date the request was made.
After a few hours, a trainer reviews and approves the health form. Your app then calls Report Action Invocation Completed indicating that the action has completed successfully. This call includes the action data defined in your action's output schema, as well as the invocation token received in the original Invoke call:
Once Wix receives this response, the automation continues to the next action. Let's say that next action is sending a confirmation code to the customer. In this case, that action is executed successfully because it has received the approval from the previous action.
If a trainer fails to approve the health form before 1 day is up, your app doesn't send a Report Action Invocation Completed request. Wix then marks the approval action as timed out, and continues on to the confirmation code action. In this case, the second action fails because it hasn't received the output data from the first action, and the customer isn't set a confirmation code.