Frama - Shopify & HubSpot Integration for draft orders
This integration keeps Shopify draft orders in sync with HubSpot deals and Orders. Process looks like this:
- There are three event listeners registered in both on their Shops (INS & US)
- These listeners are monitoring draft creation event, draft update event and draft removal event
- When any of these events happens, data about the draft that need to be synced with HubSpot is sent to out middleware receiver.
- This receiver will store it in the queue (there are 3 queues, one for each event type)
- Then there are 3 queue processors who's role is to every minute check if any new requests are registered in the queue - if there are, they will ty to process them - either create, update or delete the deal in HubSpot
- These processor will try to process each request for up to 5 times (for the case that it crashes due to some technical glitch)
- Once it gets processed, it will be removed form the queue to prevent further processing
- If it will not be processed correctly, it will stay stuck in the queue and there is an error message page where the client can see what went wrong (usually it is wrong data somewhere)
- System has been designed to check before it creates something & before it updates something if it actually exists in HS
- If you want to create something that already exists, request will be moved to update queue
- If you want to update something that does not exist yet, request will be moved to create queue
- There is one extra processor - every minute, it will check closed deals in Shopify. Every deal that gets closed will be stored in "closed" queue and it will then be marked as closed in HubSpot & associated to related Order. This has been added since Shopify does not consider order creation and closing the draft as update event and it does not fire the update request.