Returns the events belonging to a given Lead ID.
Example
To fetch the events belonging to a lead with the ID "jPlz8TM628rzyCRPqrtcvm", send an authenticated GET request to the following URL:
https://api.yelp.com/v3/leads/jPlz8TM628rzyCRPqrtcvm/events
For the above request, a successful GET call would return the lead events if they exist in our system.
A sample response is shown in the example response box on the right under "200 - Result"
Order
The order of the leads will be as shown on Yelp, following a messaging view where the last message in the list represents the latest message in the conversation.
While the order will mostly follow the time_created, this isn't guaranteed and might deviate for certain events.
The pagination of the events is determined by the parameters older_than_cursor
and newer_than_cursor
.
To fetch events that should be shown before a particular event, use the event's cursor as the value for the parameter older_than_cursor
while calling the API.
Similarly, to fetch events that should be shown after a particular event, use the event's cursor as the value for the parameter newer_than_cursor
while calling the API.
Example
Using simplified API responses.
Assuming the following Message view on Yelp
> Consumer Message 1
Biz Response 1
<
>Consumer Message 2
Biz Response 2
<
>Consumer Message 3
API Responses
No limit
Notice how the latest event is the last entry in the array of events.
["Consumer Message 1", "Biz Response 1", "Consumer Message 2", "Biz Response 2", "Consumer Message 3"]
limit=1
Only the latest event shown on Yelp is returned.
["Consumer Message 3"]
limit=2
Only the latest 2 events shown on Yelp are returned. The latest event is still the last entry in the array of events.
["Biz Response 2", "Consumer Message 3"]
Limit and Cursor
If you specify newer_than_cursor/older_than_cursor you will get events directly following/preceding that cursor.
limit=2&newer_than_cursor=Consumer Message 1
Consumer Message 1
The 2 events directly following Consumer Message 1
are the following:
["Biz Response 1", "Consumer Message 2"]
limit=2&older_than_cursor=Consumer Message 3
Consumer Message 3
The 2 events directly preceding Consumer Message 3
are the following:
["Consumer Message 2", "Biz Response 2"]
limit=2&older_than_cursor=Consumer Message 1
Consumer Message 1
No event was sent before Consumer Message 1
[]
This endpoint is part of the Leads API, visit Leads API to learn more.