DRAFT vendors created in Pleo, ready to be created in the Accounting System.
This is the first step in the Vendor Creation workflow.
Implementation
See the corresponding how-to article for API usage and step-by-step instructions:Conceptual Model
Detection identifiesDRAFT vendors that need to be created in the Accounting System.
It must:
- Detect vendors newly created in Pleo with
state: DRAFT - Avoid modifying vendor state in Pleo
- Avoid re-processing a vendor that has already been created in the AS
Detection Mechanisms
Integrations may use one of the following:Webhooks (preferred)
- Subscribe to
v1.vendor.created - Trigger creation processing as soon as the event is received
- Pleo triggers this event the moment a bookkeeper adds a vendor with no matching AS record, so this is the fastest path to a usable vendor
- Even when using webhooks as the primary mechanism, pair them with a low-frequency backstop poll (for example, hourly, using the polling mechanism below): webhook delivery is not guaranteed under all failure conditions, and a stranded
DRAFTvendor with no repair path can otherwise go undetected indefinitely
Polling (fallback, only if webhooks cannot be supported)
- Periodically call
POST /v1/vendors:searchfiltering for vendors inDRAFTstate - Use a controlled interval of every 5 minutes
Single-Item Processing
Unlike Export Jobs, there is no batching concept for Vendor Creation. EachDRAFT vendor is:
- Detected and processed as its own independent unit of work
- Not blocked by, or blocking, any other
DRAFTvendor being processed at the same time, with one narrow exception: the per-company concurrency lock shared with Vendor Sync (see Create and Activate: Failure Handling) is scoped to the whole company, so twoDRAFTvendors for the same company can briefly wait on each other for that lock; vendors in different companies are never affected by each other’s locks
Avoiding Duplicate Processing
Filtering onstate: DRAFT is not sufficient by itself to prevent the same vendor from being processed twice:
- Webhook redelivery: the webhook provider may redeliver the same
v1.vendor.createdevent. Persist the event’seventIdand skip any event already processed. - Overlapping polls, or webhook and polling running together: a poll cycle can re-detect a
DRAFTvendor that is already being created or activated from a previous poll or from the webhook path, because the vendor genuinely still hasstate: DRAFTuntil activation completes. Before beginning creation, check whether that vendor id is already marked in-flight (for example, a persisted “processing” record keyed on the Pleo vendor id), and skip it if so.
Key Rules
- Detection must not change a vendor’s state in Pleo; only creation and activation do
- Prefer webhooks over polling: they notify the integration immediately, rather than after up to 5 minutes of delay
- If polling, filter strictly on
state: DRAFTso already-active vendors are not reprocessed - Treat each detected
DRAFTvendor as an independent item to create and activate
Processing Order
Upstream Dependencies
- A bookkeeper adding a new vendor in Pleo’s Web App
- Integration authentication configured
- Webhook subscription or scheduled polling implemented
Downstream Dependencies
- Vendor creation in the Accounting System
- Vendor activation in Pleo