Knock Log Email API is part of Knock’s effort to expand its API suite to include the ability for 3rd party vendors to log messages to Knock guest cards so that leasing teams in Knock have context and analytics on conversations that took place outside of Knock.

This endpoint does not send an email to a prospect. It only logs an email interaction. An email logged through this endpoint will be identical to how an email is sent through Knock today. This includes prospect being removed from the to-do list if it is the first time a prospect is being contacted, prospect’s being moved from New to Open, prospect response times being updated if it is the first response to a prospect, and email events being logged in analytics in the same way emails are logged in analytics today.

Below is a picture of a sample email that was sent from a manager to a prospect. Note how the vendor that was responsible for the email is also being noted in the very bottom of the picture, the “via Syndication Service - Stage - SSO” text.

This article contains the technical documentation and details for developers to get started using the Log Email API.

The general flow will be:

  1. Partner needs to create a prospect and save the prospectId from the response payload. A prospect can be created via the Knock Prospect Creation API

  2. Note: Currently we do not expose the prospectId, therefore the parter needs to save it from the Prospect Creation API response payload

  3. Now the partner can call the log email using the log email endpoint, POST :/prospect/{prospectId}/email, with the prospectId and fill in the parameters

Log Email Creation

Log a prospect email through our Log Email endpoint. You can use the API endpoint to log prospect email interactions that concern a particular property, which is POST :/prospect/{prospectId}/email. For more details on the parameters, check out our swagger documentation here: stage documentation, production documentation.

The following includes the path parameter in the request endpoint.

  • prospectId (string)

    • The Id of the prospect the manager is communicating with.

The following are a list of the request body parameters. Note, that all these body parameters are required.

  • type (string)

    • Type of message being logged. There are 3 types to choose from:

      • EMAIL_MESSAGE_TO_PROSPECT_SENT, email sent from a leasing agent or contracted representative to the prospect,

      • EMAIL_MESSAGE_FROM_PROSPECT_RECEIVED, email sent from prospect to the property, and

      • EMAIL_AUTOMATED_MESSAGE_SENT automated email sent to prospect.

  • sentTime (iso date-time string)

    • Time the email was sent

  • agent.username (string)

    • Username of the agent interacting with the prospect.

  • subject (string)

    • Subject field of the email.

  • body (string)

    • Message body of the email. HTML is accepted in the body as well. Check example below for clarity.

The following example demonstrates this using the JavaScript fetch API:

const API_KEY = "syndication-appointment-TEST-KEY";

const logEmail = async (prospectId) => {
const req = {
"type": "EMAIL_MESSAGE_TO_PROSPECT_SENT",
"sentTime": "2020-03-31T23:22:06.214Z",
"agent":{
"username": "e5e42ae3-a3fa-48ae-a5c5-92ca704d38ad"
},
"subject": "email subject"
"body": "<html>Hello World Email</html>"
};
const endpoint = `https://stage-syndication.knockrentals.com/prospect/${prospectId}/email`;
const res = await fetch(endpoint, {
body: JSON.stringify(req),
headers: {
"Content-Type": "application/json",
"x-api-key": API_KEY
},
method: "POST"
});

const resp = await res.json();

if (res.status === 200) {
// Success, e.g. `
// `{
// “communicationId: “4WXU6U2J-37444208”
// }`
//
console.log(resp);
} else {
// Failure: details at resp.errorMessage
console.error(resp);
}
};

logEmail(1);

Did this answer your question?