Integrate a manufacturing execution system (MES) with NetSuite work-order completions using an MQTT broker as a bridge and a NetSuite RESTlet as the receiver
Configure the MES to publish machine completion events to an MQTT broker topic (e.g., plant/line1/workorder/complete) in a JSON payload containing workOrderId, completedQty, scrapQty, and operationSequence.
Deploy a bridge service (Node.js or Python) that subscribes to the MQTT topic; on message receipt, validate the payload schema and construct a NetSuite REST API request.
The bridge authenticates to NetSuite using OAuth 2.0 M2M (client credentials) or TBA; call the RESTlet via POST https://<accountId>.restlets.api.netsuite.com/app/site/hosting/restlet.nl?script=<scriptId>&deploy=<deployId> with the JSON payload.
In the NetSuite RESTlet, load the work order record by the external workOrderId, update the quantity completed and scrap fields, and call the complete action or update status to 'Closed'.
Write back the NetSuite transaction ID to the MQTT broker on a response topic (e.g., plant/line1/workorder/complete/ack) so the MES can confirm the update was persisted.
Handle MQTT QoS level 1 (at least once) by making the RESTlet idempotent — check if the work order is already completed before re-processing, using the externalId field for deduplication.
Known gotchas
MQTT is a fire-and-forget protocol at QoS 0 — if the bridge service is down when the MES publishes, messages are lost; use QoS 1 with a persistent broker (retained messages or durable sessions) to ensure no completions are dropped.
NetSuite RESTlets have a 5-minute execution timeout and governance limit of 5,000 units per call; if the work order update logic triggers complex calculations (standard cost rollup, WIP journal entries), it may time out — offload heavy logic to a scheduled script queued from the RESTlet.
Work order records in NetSuite may be locked by an in-progress SuiteScript job or a user edit at the time the RESTlet fires; implement retry logic with exponential backoff in the bridge service to handle RCRD_HAS_BEEN_CHANGED_ERR contention errors.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp