Starting a workflow

Starting a workflow by HTTP request

Starting workflows that begin with a custom trigger can be done by sending an HTTP request to the Flow Companion app.

The request headers are the same for all types of events:

Content-Type: Application/Json
Authorization: bearer {token}

You can create a bearer token for authorization on the application page in the SettingsManage authentication tokens section.

Below are the URLs and request bodies for each type of event. All additional parameters are optional.

Custom trigger

POST https://flow-companion.mivicle.app/rest/1/flow/start

{
  "specifier": "Specifier to use in a workflow condition",
  "additionalParameters": {
    "stringParameter": "some string parameter",
    "numberParameter": 0,
    "booleanParameter": true
  }
}

Order: custom trigger

POST https://flow-companion.mivicle.app/rest/1/flow/start/order

{
  "itemId": "ID (207119551) or legacyResourceId (gid://shopify/Order/207119551) of the order",
  "specifier": "Specifier to use in a workflow condition",
  "additionalParameters": {
    "stringParameter": "some string parameter",
    "numberParameter": 0,
    "booleanParameter": true
  }
}

Customer: custom trigger

POST https://flow-companion.mivicle.app/rest/1/flow/start/customer

{
  "itemId": "ID (207119551) or legacyResourceId (gid://shopify/Customer/207119551) of the customer",
  "specifier": "Specifier to use in a workflow condition",
  "additionalParameters": {
    "stringParameter": "some string parameter",
    "numberParameter": 0,
    "booleanParameter": true
  }
}

Product: custom trigger

POST https://flow-companion.mivicle.app/rest/1/flow/start/product

{
  "itemId": "ID (207119551) or legacyResourceId (gid://shopify/Product/207119551) of the product",
  "specifier": "Specifier to use in a workflow condition",
  "additionalParameters": {
    "stringParameter": "some string parameter",
    "numberParameter": 0,
    "booleanParameter": true
  }
}

Response Codes

  • 200 OK - Workflow started successfully.
  • 400 Bad Request - Error in the request parameters.
  • 400 Bad Request - Failed to start the workflow. The response body will contain a list of errors received from Shopify Flow.
  • 412 Precondition Failed - No active workflow matches the trigger conditions for this HTTP request.
  • 429 Too Many Requests - Too many requests have been made in a short period. Retry the request later.
  • 500 Internal Server Error - An unknown error occurred.

See also: