How to Reorder Low MarketMan Inventory Items from Preferred Vendors

Build a Spojit workflow that checks MarketMan inventory items against par levels on a schedule, lets an agent pick the preferred vendor for each shortfall, and creates one replenishment purchase order per vendor.

What This Integration Does

Restaurants and multi-site kitchens lose money two ways when stock runs low: they run out mid-service, or a manager hand-keys rushed orders into the wrong vendor at the wrong price. This workflow watches your MarketMan inventory items, compares each one against a par level you control, and turns the gap into purchase orders without anyone re-typing item codes. Because the same shortfall item can come from more than one supplier, it leans on an Agent-mode Connector node to choose the preferred vendor per item rather than forcing a single hard-coded supplier.

The workflow runs on a Schedule trigger (for example every weekday morning), pulls the current inventory items and the buyer catalog from MarketMan, and computes which items fall below par. The agent groups those shortfalls by preferred vendor and returns structured order lines. The workflow then creates one MarketMan order per vendor and posts a summary to Slack. Nothing is stored between runs: each run reads fresh inventory, so re-runs are safe and simply reflect whatever the counts are at that moment. If no item is below par, the run finishes quietly with no orders created.

Prerequisites

  • A MarketMan connection added in Spojit under Connections, authorised against the buyer account whose inventory you reorder.
  • A Slack connection with permission to post to the channel you want the order summary in.
  • Par levels for the items you want to reorder. This workflow expects par levels to live in MarketMan item data (for example a minimum-on-hand field) or in a small lookup you maintain; decide your source before building.
  • Catalog items set up in MarketMan for each vendor you order from, so every item has a CatalogItemCode the agent can reference.
  • At least one of your items mapped to a preferred vendor (a vendor name or vendor GUID you can identify per item).

Step 1: Start the workflow on a Schedule trigger

Add a Trigger node and set its type to Schedule. Schedules use a 5-field Unix cron expression plus an IANA timezone, so the run lands at the same local time year round. For a weekday 7am check in Sydney, set the cron to 0 7 * * 1-5 and the timezone to Australia/Sydney. A single trigger can hold more than one schedule if you want a morning and afternoon sweep. The trigger output is { scheduledAt }, which you can reference later as {{ input.scheduledAt }} for the order comment.

Step 2: Pull current inventory items from MarketMan

Add a Connector node in Direct mode, choose the MarketMan connector, and select the get-inventory-items tool. This returns every inventory item for the buyer, including stock levels and detail fields. Leave buyerGuid empty to use the connection default, or set it if you manage several buyers. Name the output so you can reference it downstream, for example inventory. If your par levels live somewhere other than the item record, add a second Direct-mode MarketMan call to get-items for the full ingredient and product list, or load your par lookup with an http connector call.

Step 3: Pull the vendor catalog so items can be ordered

Add another Connector node in Direct mode on the MarketMan connector and select get-catalog-items. This returns the vendor catalog items available for ordering, each carrying a CatalogItemCode and the vendor it belongs to. Leave vendorGuid empty to fetch the full catalog across vendors so the next step can choose between suppliers. Name the output catalog. Optionally add a Direct-mode get-vendors call (output vendors) so vendor names and GUIDs are available to the agent for grouping.

Step 4: Let the agent choose the preferred vendor per shortfall

Add a Connector node in Agent mode on the MarketMan connector and give it the inventory, catalog, and vendor data as input. Agent mode lets the agent reason over the data and decide which catalog item and vendor to use for each item that is below par. Use a Response Schema to force clean, structured JSON so the rest of the workflow stays deterministic. A prompt and schema like this work well:

Prompt:
Compare each inventory item in {{ inventory }} against its par level.
For every item whose on-hand quantity is below par, choose the
preferred vendor from {{ catalog }} (prefer the lowest-cost catalog
item from an approved vendor). Group the results by vendor and return
the catalog item code and the quantity needed to reach par.

Response Schema:
{
  "type": "object",
  "properties": {
    "orders": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "vendorGuid": { "type": "string" },
          "vendorName": { "type": "string" },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "CatalogItemCode": { "type": "string" },
                "Quantity": { "type": "number" }
              },
              "required": ["CatalogItemCode", "Quantity"]
            }
          }
        },
        "required": ["vendorGuid", "lines"]
      }
    }
  },
  "required": ["orders"]
}

Name the output plan. Each entry in {{ plan.orders }} is one vendor with the exact catalog lines to order. Agent mode consumes AI credits, so keep the input scoped to the fields the agent actually needs.

Step 5: Create one MarketMan order per vendor

Add a Loop node in ForEach mode over {{ plan.orders }} so each vendor gets its own purchase order. Inside the loop, add a Connector node in Direct mode on the MarketMan connector and select create-order. Map the fields from the current loop item:

vendorGuid:    {{ vendor.vendorGuid }}
orderStatus:   Sent
comment:       Auto-replenishment from Spojit, run {{ input.scheduledAt }}
catalogItems:  {{ vendor.lines }}

The catalogItems array must be objects with CatalogItemCode and Quantity, which is exactly the shape the response schema produced. Set orderStatus to Sent only when you want the order to go to the vendor immediately; leave it off or use a draft status while you are still testing. Optionally set deliveryDateUTC with a date connector value so each order carries a requested delivery date.

Step 6: Post a summary to Slack

After the loop, add a Connector node in Direct mode on the Slack connector and select send-message. Set the channel and a short body that names the vendors and item counts, for example:

channel: #kitchen-ops
text:    Replenishment run complete. Created {{ plan.orders.length }}
         vendor order(s) for items below par. Review them in MarketMan.

If you would rather the team approve large orders before they send, insert a Human node before Step 5 with an Approval slot for your purchasing role, and only set orderStatus to Sent after approval. The Human node halts on reject, so treat rejection as "do not order this run".

Tips

  • Keep the Agent-mode input lean. Pass only the item fields and catalog fields the agent needs to pick a vendor, which lowers AI cost and speeds the run.
  • Use the comment field on create-order to stamp the run time so anyone in MarketMan can trace an order back to a Spojit run.
  • Run two schedules on one trigger (for example morning and mid-afternoon) if a single daily check leaves you short during long services.
  • If you only ever buy an item from one supplier, you can skip Agent mode for that item and map it directly, reserving the agent for items with real vendor choices.

Common Pitfalls

  • Ordering against stale counts. MarketMan inventory reflects the last count entered, not live stock; schedule the run after your usual count time so par comparisons use fresh numbers.
  • Mismatched catalog codes. create-order needs a valid CatalogItemCode per line; if an item has no catalog entry for the chosen vendor, the order line fails. Confirm catalog coverage before turning on orderStatus: Sent.
  • Wrong buyer. If you manage multiple buyer accounts, an empty buyerGuid uses the connection default, which may not be the location you intended. Set it explicitly per node when in doubt.
  • Timezone drift. The Schedule trigger fires on the IANA timezone you set, not the server clock, so use a real zone like Australia/Sydney rather than a UTC offset to stay correct across daylight saving.

Testing

Validate on a small scope before letting orders send. Temporarily set the create-order step to a draft status (or remove orderStatus: Sent) so no order leaves MarketMan, then run the workflow with the Run button instead of waiting for the schedule. Inspect the Agent-mode plan output in the run history to confirm the vendor grouping and quantities look right, and check that the Slack summary names the vendors you expected. Once a dry run produces sensible orders for one or two items below par, switch the status to Sent and enable the schedule.

Learn More

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.