Discover our step-by-step guide to integrating v0 with Freshsales. Boost your CRM efficiency and streamline your sales process with an easy, efficient setup.

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
config.ts in your project’s root folder.
config.ts, add your Freshsales API credentials and domain URL. Replace the example placeholders with your actual credentials.
export const FRESHSALES_DOMAIN = "https://yourdomain.freshsales.io";
export const FRESHSALESAPIKEY = "YOURFRESHSALESAPI_KEY";
freshsalesIntegration.ts.
freshsalesIntegration.ts. This code imports the configuration values, sends a POST request to create a new lead, and handles errors.
import { FRESHSALESDOMAIN, FRESHSALESAPI_KEY } from "./config";
// The createFreshsalesLead function sends a POST request to Freshsales
export const createFreshsalesLead = async (leadData: any) => {
try {
const url = ${FRESHSALES_DOMAIN}/api/leads;
const headers = {
'Authorization': Token token=${FRESHSALES_API_KEY},
'Content-Type': 'application/json'
};
// Using axios which will be loaded via CDN in our HTML file
const response = await axios.post(url, { lead: leadData }, { headers });
return response.data;
} catch (error) {
console.error('Error creating Freshsales lead', error);
throw error;
}
};
index.ts or app.ts).
import { createFreshsalesLead } from "./freshsalesIntegration";
// Example: Handling form submission to create a new lead in Freshsales
const form = document.getElementById("leadForm") as HTMLFormElement;
form.addEventListener("submit", async (event) => {
event.preventDefault();
// Gather form data; adjust selectors as needed
const leadData = {
first_name: (document.getElementById("firstName") as HTMLInputElement).value,
last_name: (document.getElementById("lastName") as HTMLInputElement).value,
email: (document.getElementById("email") as HTMLInputElement).value,
phone: (document.getElementById("phone") as HTMLInputElement).value
};
try {
const response = await createFreshsalesLead(leadData);
alert("Lead successfully created in Freshsales!");
console.log(response);
} catch (error) {
alert("There was an error creating the lead.");
}
});
index.html).
<head> or just before the closing </body> tag to load Axios:
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
leadForm) is located.
config.ts are correct.
When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.