Publishing webhook
Last update: 2 years ago by luigi mangaReading time: 2 min
Onport makes it possible to publish variants to a custom channel. This is carried out by setting the endpoint URL in the Integrations -> Custom Channels -> Channel Name page.
The payload sent to the Publishing Endpoint is as follows:
{"variant": {"imagesMapped": [{"src": "https://url.com/image.jpg"}],"images": ["https://url.com/image.jpg"],"lowInventoryQuantity": true,"costPrice": 5,"commissionRate": 0,"id": 9281504,"companyId": 123123,"productId": 123123,"vendorId": 123123,"dropshipProviderId": null,"dropshipProviderAddressId": null,"sku": "agjlqetuo-123","name": "Black / Small","dropshipProviderMapping": "brand_name","dropshipProviderAddressMapping": "default","description": "Description goes here","productType": "Trainers","requiresShipping": true,"barcode": null,"hsCode": null,"countryOfOrigin": null,"levels": null,"inventorySync": "channel","inventoryAllocated": 0,"inventoryQuantity": 0,"inventoryFeeds": 0,"minInventoryQuantity": 0,"defaultPurchaseQuantity": 1,"leadTime": null,"totalPurchaseItems": 0,"totalSaleItems": 0,"grams": 3000,"inventoryPolicy": "track","inventoryType": "tracked","position": null,"taxable": true,"serialPrefix": null,"serialSuffix": null,"serialReference": 0,"vendorSku": null,"fulfillmentPolicy": "vendor_default","noInventoryPolicy": "replenish","automaticallyBackorder": "vendor_default","dynamicInventoryPolicy": null,"denyThreshold": 0,"backorderQuantity": 0,"commissionRateRouting": "dropship_provider","commissionRateType": "percentage","tags": ["test api","Man","Black","Shoes","Dark"],"notes": null,"packingHeight": 0,"packingWidth": 0,"packingDepth": 0,"distanceUnit": "in","inventoryRouting": "inventory_feed","orderSplitting": "default","resellerVisibility": "visible","accountingSync": "active","createdAt": "2021-09-27T10:25:32.458Z","updatedAt": "2021-09-27T10:25:32.867Z"},"product": {"id": 123123123,"name": "Test 123","handle": "test-123"},"vendor": {"name": "test api"},"images": ["https://url.com/image.jpg"],"imagesMapped": [{"src": "https://url.com/image.jpg"}],"tags": ["test api","Man","Black","Shoes","Dark"],"price": {"price": 10,"compareAtPrice": 0},"available": 10,"optionValues": [{"variantId": 123123,"variantValue": "Black","option": {"name": "Color","position": 1}},{"variantId": 123123,"variantValue": "Small","option": {"name": "Size","position": 2}}],"customFieldVariants": [],"mapped": {}}
For the variant to be successfully acknowledged as being published, in the publishing webhook you'll need to respond with a JSON object, containing the following values:
externalId
(e.g. the database ID for the variant in your system)externalGroupId
(e.g. the database ID new product in your system)externalSku
(likely just the same SKU as the variant being published, unless this has been changed for any reason)
{"type": "object","additionalProperties": false,"required": ["externalId","externalSku","externalGroupId"],"properties": {"externalId": {"type": ["string"]},"externalSku": {"type": ["string"]},"externalGroupId": {"type": ["string"]}}}
If the above