Overview
This support article will guide you through the process of setting up a Read webhook integration with Salesforce. This is meant mainly as an example for educational purposes - if you are looking to integrate Read with your Salesforce account, we'd recommend checking out Connecting Your Read Account to Salesforce.
This guide requires setting up an Apex API endpoint. If you prefer a no-code solution, we recommend checking out Getting Started with Zapier.
Integration Steps
Follow these steps to set up the webhook integration:
1. Create an Apex API in Salesforce:
- Make sure you have administrator access to your Salesforce account.
- Navigate to Setup by clicking the gear icon the top right corner of the navigation bar, and selecting "Setup."
- In the search bar on the left sidebar, type "Apex" and click on "Apex Classes" in the search results.
- Click the "New" button to create a new Apex class.
- Give your Apex class a name
- Write the code for your Apex API. The code will depend on your specific requirements, but here's a simple example for demonstration purposes:
public class ReadWebhookIntegration {
// This is a wrapper for your Read meeting data
// Feel free to copy this class for your integration
public class ReadMeeting {
public String session_id; //SESSIONID
public String trigger; //meeting_end
public String title; //Meeting Title
public String start_time; //2023-01-01T00:00:00Z
public String end_time; //2023-01-01T01:00:00Z
public Participant[] participants;
public Participant owner;
public String summary; //Meeting summary goes here...
public TextItem[] action_items;
public TextItem[] key_questions;
public TextItem[] topics;
public String report_url; //https://app.read.ai/analytics/meetings/SESSIONID
class Participant {
public String name; //Participant One
public String email; //participant_one@company.com
}
class TextItem {
public String text;
}
public static ReadMeeting parse(String json) {
return (ReadMeeting) System.JSON.deserialize(json, ReadMeeting.class);
}
}
@RestResource(urlMapping='/webhook/*')
global class WebhookListener {
@HttpPost
global static void handleWebhookRequest() {
RestResponse response = RestContext.response;
RestRequest request = RestContext.request;
// This will be a json body with your meeting data
String requestBody = request.requestBody.toString();
// Convert the json requestBody string into an object
ReadMeeting meetingData = ReadMeeting.parse(requestBody);
// Update Salesforce objects, such as contacts or opportunities
// with your meeting data
// Send a successful response back to Read
response.statusCode = 200;
}
}
}
- Save your new Apex class.
- To grant the required permissions, navigate to Setup > search for "Apex REST Services" in the left sidebar search bar > click on "Apex REST Services" in the search results > click "Edit" next to your new Apex class > add desired profiles or permission sets > save the changes.
2. Generate the webhook URL:
- In Salesforce, go to Setup > search for "Named Credentials" in the left sidebar search bar > click on "Named Credentials" in the search results.
- Click the "New Named Credential" button.
- Provide a name and an endpoint URL for the Named Credential. The endpoint URL should be your Salesforce domain followed by the Apex Rest URL, e.g., `https://your-domain.my.salesforce.com/services/apexrest/webhook`.
- Save the Named Credential.
- Copy the endpoint URL for your Named Credential.
3. Set up the webhook integration with Read:
- Log in to your Read account and navigate to the integrations page.
- Create a new webhook and paste the endpoint URL from your Named Credential
- Save the webhook configuration.