Get Prospect Events FAQ

Overview

The Get Prospect Events API is part of Knock’s effort to expand its API suite to include the ability for 3rd party vendors to get prospect events of a given prospect.

This API returns the following events related to a prospect: Appointment creation, Knockbot messages, email messages, Facebook messages, SMS messages, and Web messages.

Below is an example response from this API. Note: This endpoint uses a cursor-based pagination pattern. To iterate through the list of pages:

  1. Make a request, and omit the after parameter.

  2. Make subsequent requests, and set the after parameter equal to the value of the previous page's endCursor.

  3. Repeat step 2 until the value  hasNextPage is false, and you have reached the last page.

For more details, please see the example request at the bottom of this page.

 
1{ 2 "edges": [ 3 { 4 "node": { 5 "type": "APPOINTMENT_CREATED", 6 "description": "A tour appointment was scheduled via knock", 7 "eventTime": "2022-01-13T19:27:37.866831+00:00", 8 "createdAt": "2022-01-13T19:27:37.866831+00:00", 9 "source": { 10 "title": "Property Website" 11 }, 12 "agent": { 13 "username": "e5e42ae3-a3fa-48ae-a5c5-92ca704d38ad" 14 }, 15 "data": { 16 "startTime": "2022-01-18T20:00:00+00:00", 17 "endTime": "2022-01-18T20:30:00+00:00", 18 "status": "confirmed", 19 "tourType": "IN_PERSON" 20 } 21 } 22 } 23 ], 24 "pageInfo": { 25 "endCursor": "MQ==", 26 "hasNextPage": true 27 } 28}

 

GET /prospect/:prospectId/events

Path Parameters

 

Parameter

Value

prospect ID

The ID of the Knock Prospect.

(This value can be saved from the response from a successful POST /prospect API call)

Query String Parameters

 

Parameter

Type

Value

first

string

Maximum number of prospect events to return on a page.

After

string

Optional cursor for paginating large queries.

Examples

JavaScript

 
1const API_KEY = 'syndication-prospect-TEST-KEY'; 2 3const prospectId = 500; 4const getProspectEventsEndpoint = `https://stage-syndication.knockrentals.com/prospect/${prospectId}/events?first=10`; 5 6const res = await fetch(getProspectEventsEndpoint, { 7 headers: { 8 "Content-Type": "application/json", 9 "x-api-key": API_KEY 10 }, 11 method: "GET" 12}); 13 14let response = await res.json(); 15console.log(response); 16 17while(response.pageInfo.hasNextPage) { 18 19 const { endCursor } = response.pageInfo; 20 const endpoint = `${getProspectEventsEndpoint}&after=${endCursor}`; 21 22 const res = await fetch(endpoint, { 23 headers: { 24 "Content-Type": "application/json", 25 "x-api-key": API_KEY 26 }, 27 method: "GET" 28 }); 29 response = await res.json(); 30 console.log(response); 31} 32

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.

Articles in this section