My flow chart goes like this:
• Is anyone buying what you’re building?
• Is what you’re building providing a unique competitive advantage?
• Can you not buy a solution that fits your needs?
If the answers are no, buy.
If any of the answers are yes, do the ROI math and build a business case, and build if you still think it’s worth your time.