Pipedrive Integration
Pipedrive is a powerful customer relationship management (CRM) software designed to help businesses streamline their sales processes and manage leads effectively.
Integrating Pipedrive with Kommunicate can enhance customer communication and support by allowing seamless access to CRM data within the chat interface. With this integration, support agents can view customer details, sales history, and interactions directly from Pipedrive while engaging with customers in real-time conversations.
Follow these steps to integrate Pipedrive with Kommunicate, collect leads from customers, & then manage them on the Pipedrive dashboard.
Login to Kommunicate and navigate to Integrations> Pipedrive
Navigate to your Profile on the Pipedrive dashboard, then select Personal Preferences and API.
In the Kommunicate dashboard, enter your API Key along with your Subdomain. For instance, if your URL is
https://Kommunicate.io.pipedrive.com
, useKommunicate.io
as the Subdomain.Now go to the Kompose bot builder and create a form to collect user details.
Create an intent with a form, for example, Bulk Order in this screenshot:
{
"platform": "kommunicate",
"message": "Please enter the details to get in touch ",
"metadata": {
"templateId": "12",
"contentType": "300",
"payload": [
{
"type": "text",
"data": {
"placeholder": "Enter your name",
"label": "Name"
}
},
{
"type": "text",
"data": {
"label": "Phone",
"placeholder": "Enter your Phone No",
"validation": {
"regex": "^(?:[+])?[0-9]{5,15}$",
"errorText": "Invalid Phone Number"
}
}
},
{
"type": "text",
"data": {
"label": "Email",
"placeholder": "Enter your email",
"validation": {
"regex": "^(([^<>()\\[\\]\\.;:\\s@\"]+(\\.[^<>()[\\]\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$",
"errorText": "Invalid Email"
}
}
},
{
"data": {
"name": "Submit",
"type": "submit",
"action": {
"message": "Your information is being sent to our team",
"requestType": "postBackToBotPlatform"
}
},
"type": "submit"
}
]
}
}
- Create an intent for transmitting the collected data to Pipedrive through the inline code (snippet provided below).
- Go to the new Pipedrive intent and activate Dynamic Messaging. Then, choose Inline code and add this code.
exports.responseHandler = async (input, callback) => {
try {
const metadata = input.metadata;
const formData = metadata?.KM_CHAT_CONTEXT.formData;
// Extract data from formData
const name = formData?.Name;
const email = formData?.Email;
const phone = formData?.Phone;
const activityDate = formData?.Date; // Extract the date from formData
const activityTime = formData?.Time; // Extract the time from formData
const activityLocation = formData?.Region; // Extract the region from formData
const meetingDuration = formData["Meeting Duration"]; // Extract Meeting Duration
const query = formData?.Query; // Extract Query
// Pipedrive API Configuration
const apiKey = "4165b095d47bc21a02e52c45bddf55bfb7981652";
const domain = "Kommunicate.io";
// Create a new person
const createPerson = async () => {
const person = {
name: name,
email: email,
phone: phone,
};
const url = `https://${domain}.pipedrive.com/v1/persons?api_token=${apiKey}`;
try {
const response = await axios.post(url, person);
const newPersonId = response.data.data.id; // Get the ID of the newly created person
// Create an activity with additional fields
const activityData = {
"due_date": activityDate, // Use the extracted date
"due_time": activityTime, // Use the extracted time
"location": activityLocation, // Use the extracted location
"person_id": newPersonId, // Associate the activity with the new person
"duration": meetingDuration, // Meeting Duration
"note": query, // Query
// Include "project_id" and "user_id" as needed
// "project_id": <integer>,
// "user_id": <integer>,
// Other activity data as needed
};
const activityUrl = `https://api.pipedrive.com/v1/activities?api_token=${apiKey}`;
try {
const activityResponse = await axios.post(activityUrl, activityData);
// Handle the response from the activity API as needed
} catch (activityError) {
console.error(
"Error while creating an activity in Pipedrive",
activityError.response.data
);
throw activityError.response.data;
}
return newPersonId;
} catch (err) {
console.error(
"Error while creating a person in Pipedrive",
err.response.data
);
throw err.response.data;
}
};
const newPersonId = await createPerson();
callback([
{
"message": "Your data has been successfully submitted to the company",
},
]);
} catch (error) {
// Handle errors and send an error message in the callback
const errorMsg = error.message || "An error occurred";
callback([{ "message": errorMsg }]);
}
};
Note: Replace your own API Key & domain on line 17 & 18.
Note: Keep the Form submit message as a training phrase in Pipedrive intent, for example, Your information is being sent to our team
With this step, the integration is completed. You can now proceed to test the bot and the Pipedrive activities page.