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, Doorway 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:
Make a request, and omit the
after
parameter.Make subsequent requests, and set the
after
parameter equal to the value of the previous page'sendCursor
.Repeat step 2 until the value of
hasNextPage
isfalse
, and you have reached the last page.
For more details, please see example request on 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 |
prospectID | The ID of the Knock Prospect. (This value can be saved from the response from a successful |
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