CRM
Manage contacts, companies, activities, and CRM data.
Get one activity's description, writing app and JSON data payload
/organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/activities/{activityId}Returns a single CRM activity by ID. Each activity is a natural-language description of something that happened, tagged with the app that wrote it, with optional JSON metadata and linked contact/company objects.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });
const activity = await gc.crm.getCrmActivity({ organizationId: org.id, projectId: projects[0].id, appId: "your-app-id", activityId: "your-activity-id"});
List the activity timeline for a whole CRM app, newest first, searchable
/organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/activitiesReturns a paginated timeline of CRM activities for the specified app, newest first. Each activity is a natural-language description of something that happened for a contact (or company), tagged with the app that wrote it and optionally enriched with a JSON `data` payload. Supports free-text search across the description.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });const { apps } = await gc.projects.listProjectApps({ organizationId: org.id, projectId: projects[0].id,});
const { activities } = await gc.crm.listCrmActivities({ organizationId: org.id, projectId: projects[0].id, appId: apps[0].id,});
Log a past-tense sentence onto a contact or company timeline, append-only
/organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/activitiesAppends an activity to the CRM timeline. `description` is a natural-language sentence ('Viewed pricing page', 'Unsubscribed from newsletter'). `writtenBy` identifies which app wrote it. Optional `data` carries structured metadata for agents to read. Link to a contact and/or company via id.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });
const result = await gc.crm.logCrmActivity({ organizationId: org.id, projectId: projects[0].id, appId: "my-app-id", data: { action: "login", timestamp: Date.now() }});
List a company's activity timeline, newest first, whatever app logged it
/organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/companies/{companyId}/activitiesReturns the natural-language activity timeline for a company, newest first. Each row is a description of something that happened, tagged with the app that wrote it, with optional JSON metadata.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const { id: orgId } = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: orgId });
const { activities } = await gc.crm.listCrmCompanyActivities({ organizationId: orgId, projectId: projects[0].id, appId: "your-app-id", companyId: "your-company-id",});
List contacts linked to one company, paginated, alphabetical by last name
/organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/companies/{companyId}/contactsReturns a paginated list of CRM contacts linked to a specific company, ordered by last name then first name. Each contact includes name, email, phone, title, department, status, source, tags, and linked company object.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });const { apps } = await gc.projects.listProjectApps({ organizationId: org.id, projectId: projects[0].id,});const { companies } = await gc.crm.listCrmCompanies({ organizationId: org.id, projectId: projects[0].id, appId: apps[0].id,});
const { contacts } = await gc.crm.listCrmCompanyContacts({ organizationId: org.id, projectId: projects[0].id, appId: apps[0].id, companyId: companies[0].id,});
Get one company with its profile fields and count of linked contacts
/organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/companies/{companyId}Returns a single CRM company by ID, including name, website, industry, size, annual revenue, contact info, address, tags, custom properties, and a count of associated contacts.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });
const company = await gc.crm.getCrmCompany({ organizationId: org.id, projectId: projects[0].id, appId: "your-app-id", companyId: "your-company-id"});
List companies in one CRM app, alphabetical by name, each with contact count
/organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/companiesReturns a paginated list of all CRM companies for the specified app. Supports search by company name or industry. Each company includes a count of associated contacts.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });const { apps } = await gc.projects.listProjectApps({ organizationId: org.id, projectId: projects[0].id,});
const { companies } = await gc.crm.listCrmCompanies({ organizationId: org.id, projectId: projects[0].id, appId: apps[0].id,});
List a contact's activity timeline, newest first, including rows written by other apps
/organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/contacts/{contactId}/activitiesReturns the natural-language activity timeline for a contact, newest first. Each row is a description of something that happened, tagged with the app that wrote it, with optional JSON metadata.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });
const { activities } = await gc.crm.listCrmContactActivities({ organizationId: org.id, projectId: projects[0].id, appId: "your-app-id", contactId: "your-contact-id"});
Set one key in a contact's custom properties, merging without clobbering siblings
/organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/contacts/{contactId}/fieldsSets a single key on a contact's custom `properties`. Merges at the key level — siblings are preserved. Use this instead of PUT /contacts when only one field needs to change, especially from other apps.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });
const result = await gc.crm.setCrmContactField({ organizationId: org.id, projectId: projects[0].id, appId: "app-123", contactId: "contact-123", data: { customField: "value" }});
Get one contact with all fields, tags and its linked company
/organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/contacts/{contactId}Returns a single CRM contact by ID, including linked company details. Fields include name, email, phone, title, department, status, source, tags, email subscription status, and last activity timestamp.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });
const contact = await gc.crm.getCrmContact({ organizationId: org.id, projectId: projects[0].id, appId: "your-app-id", contactId: "your-contact-id",});
Update contact
/organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/contacts/{contactId}Updates a CRM contact. All fields are optional — only provided fields are updated. Returns 409 if email or phone conflicts with an existing contact.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });
const result = await gc.crm.updateCrmContact({ organizationId: org.id, projectId: projects[0].id, appId: "your-app-id", contactId: "your-contact-id", data: {},});
Tag one contact with a single free-form string, idempotent, returns the contact
/organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/contacts/{contactId}/tagsAdds a tag to a contact. Tags are free-form strings used for segmenting, gating marketing messages, and ad-hoc grouping. Idempotent — adding an existing tag is a no-op.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const { id: organizationId } = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId });
const result = await gc.crm.tagCrmContact({ organizationId, projectId: projects[0].id, appId: "app-123", contactId: "contact-456", data: { tags: ["vip"] }});
Untag one contact, one tag per call, idempotent, returns the updated contact
/organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/contacts/{contactId}/tagsRemoves a tag from a contact. Idempotent — removing a tag the contact doesn't have is a no-op.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });
const result = await gc.crm.untagCrmContact({ organizationId: org.id, projectId: projects[0].id, appId: "app-123", contactId: "contact-123", data: { tagId: "tag-123" }});
List contacts in one CRM app, alphabetical by last name, search supported
/organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/contactsReturns a paginated list of all CRM contacts for the specified app. Supports search by first name, last name, or email. Each contact includes associated company info if linked.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });const { apps } = await gc.projects.listProjectApps({ organizationId: org.id, projectId: projects[0].id,});
const { contacts } = await gc.crm.listCrmContacts({ organizationId: org.id, projectId: projects[0].id, appId: apps[0].id,});
Create contact
/organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/contactsCreates a new CRM contact. Requires firstName and lastName. Optionally link to a company via companyId. Supports email, phone, title, department, status, source, custom properties, and tags.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });
const contact = await gc.crm.createCrmContact({ organizationId: org.id, projectId: projects[0].id, appId: "my-app-id", data: { email: "test@example.com", firstName: "John", lastName: "Doe" }});