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.
Request
POST {{Tribe CRM domain}}/v1/odata/Relationship_Organization_CommercialRelationship_Lead
Authorization: Bearer {{access_token}}
Content-Type: application/json
Body
{
"Relation": {
"ID": "{{your_organization_relation_id}}"
},
"Organization": {
"Name": "Dunder Mifflin Paper Company",
"Website": "www.dundermifflin.com",
"NumberOfEmployees": 10
}
}
Save 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.
Request
GET {{Tribe CRM domain}}/v1/odata/Relationship_Person_Contact_Employee?$filter=contains(Name,'chum')&$select=Name
Authorization: Bearer {{access_token}}
Replace '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.
Request
GET {{Tribe CRM domain}}/v1/odata/Datastore_Phase_ActivitySalesOpportunity?$filter=Code eq 'Qualification'&$select=Code
Authorization: Bearer {{access_token}}
Save 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.
Request
POST {{Tribe CRM domain}}/v1/odata/Activity_SalesOpportunity
Authorization: Bearer {{access_token}}
Content-Type: application/json
Body
{
"Subject": "Jell-O encased stapler",
"SalesRepresentative": {
"ID": "{{employee_id}}"
},
"Phase": {
"ID": "{{qualification_phase_id}}"
},
"ExpectedOrderDate": "2030-06-29",
"Relationship": {
"ID": "{{dunder_mifflin_lead_id}}"
}
}
Save 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.
Request
POST {{Tribe CRM domain}}/v1/odata/Activity_SalesOpportunity
Authorization: Bearer {{access_token}}
Content-Type: application/json
Body
{
"ID": "{{opportunity_id}}",
"EstimatedAmount": 100.00,
"Phase": {
"ID": "{{won_phase_id}}"
}
}
Step 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.
Request
POST {{Tribe CRM domain}}/v1/odata/Relationship_Organization_CommercialRelationship_Lead
Authorization: Bearer {{access_token}}
Content-Type: application/json
Body
{
"ID": "{{dunder_mifflin_lead_id}}",
"_Type": "Relationship.Organization.CommercialRelationship.Customer"
}
Dunder 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
DELETE {{Tribe CRM domain}}/v1/odata/Activity_SalesOpportunity({{opportunity_id}})
Authorization: Bearer {{access_token}}
2. Delete the Lead/Customer Organization
DELETE {{Tribe CRM domain}}/v1/odata/Relation_Organization({{dunder_mifflin_relation_id}})
Authorization: Bearer {{access_token}}
Deleting the Relation_Organization also removes all its associated relationships (Lead, Customer, etc.).