export type CreateApiOrgsSaveCrmContactArgs = {body: {crmName: 'hubspot', contact: {firstname: string, lastname: string, pb_linkedin_profile_url: string, email?: (string | null) | undefined, phone?: (string | null) | undefined, jobtitle?: (string | null) | undefined, company?: (string | null) | undefined}}}; export type CreateApiOrgsSaveCrmContactOptions = {baseUrl?: string | undefined, apiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Save new contacts to CRM. * * POST /orgs/save-crm-contact */ export const createApiOrgsSaveCrmContact = async (args: CreateApiOrgsSaveCrmContactArgs, options?: CreateApiOrgsSaveCrmContactOptions) => { const {baseUrl = "https://api.phantombuster.com/api/v2", fetch: fetchFn = fetch, apiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKeyAuth !== undefined) headers.set("X-Phantombuster-Key", apiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/orgs/save-crm-contact${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };