From Lead to Customer Through a Sales Opportunity
In this tutorial, you'll experience a complete sales cycle from first contact to closed deal. You'll work with a prospective company, track a sales opportunity, and convert them into a paying customer. This is where CRM really shines — managing the entire customer journey.
Step 3.1 — Create a Lead
A Lead is a potential customer — an organization you're interested in doing business with, but haven't closed a deal with yet. Creating a lead is almost identical to creating a customer, just using a different relationship type.
/v1/odata/Relationship_Organization_CommercialRelationship_LeadSave the ID from the response — this is the Lead Relationship ID you'll use to create the opportunity.
Step 3.2 — Find an Existing Employee (Recommended)
You need an employee to assign as the sales representative on the opportunity. Rather than creating a new one (employees cannot be deleted via the API), find an existing one.
/v1/odata/Relationship_Person_Contact_Employee?$filter=contains(Name,'chum')&$select=NameReplace 'chum' with part of an employee's name in your environment. Save their ID for the next steps.
Employees cannot be deleted via the API. Creating a test employee will leave permanent data in your CRM. Always use an existing employee for testing.
Step 3.3 — Get an Opportunity Phase ID
Before creating a sales opportunity, you need to choose its starting phase (e.g., Qualification, Proposal, Negotiation). Phases are stored in a Datastore.
/v1/odata/Datastore_Phase_ActivitySalesOpportunity?$filter=Code eq 'Qualification'&$select=CodeSave the ID of the Qualification phase.
The Datastore contains all the dropdown values and predefined options used throughout Tribe CRM — phases, statuses, types, and more. They're read-only reference data that you reference by ID when creating records.
Step 3.4 — Create a Sales Opportunity
Now create a Sales Opportunity linked to Dunder Mifflin. A Sales Opportunity is an Activity — a trackable event in your CRM that moves through phases.
/v1/odata/Activity_SalesOpportunitySave the opportunity ID from the response.
Step 3.5 — Update the Sales Opportunity (Close the Deal)
Great news — the deal progressed and you've closed the sale! Let's update the opportunity to reflect this win.
Updating uses a POST to the same endpoint (not PUT) and you only need to include the fields you want to change.
/v1/odata/Activity_SalesOpportunityStep 3.6 — Convert Lead to Customer
Congratulations on closing the deal! Now let's convert Dunder Mifflin from a Lead to a Customer in your CRM.
In Tribe CRM, relationship subtypes from the same parent type are interchangeable — you can convert between them by changing the _Type field.
/v1/odata/Relationship_Organization_CommercialRelationship_LeadDunder Mifflin is now a Customer in your CRM!
Cleanup — Delete Created Entities
Now that you've completed the tutorial, let's clean up the test data.
1. Delete the Sales Opportunity
/v1/odata/Activity_SalesOpportunity({opportunityId})2. Delete the Lead/Customer Organization
/v1/odata/Relation_Organization({organizationId})Deleting the Relation_Organization also removes all its associated relationships (Lead, Customer, etc.).