Events API - Search id | Community
Skip to main content

Events API - Search id

  • October 3, 2022
  • 3 replies
  • 0 views

Alex37

Hello. I am interested in using this events API endpoint (https://{domain}/api/v2/users/{user_id}/events) to get a help center search history record for a particular user.

The event type that I am interested in to achieve this is: "help_center_searched".

Once I get the event details in the response, is there another API that I can request to pass the query attribute value or search_id attribute value and get the specific text string passed by the user to search the help center?

Example:

search_id = 7b62bc2a-5a44-4b5b-baa4-166ce5b93fb1

7b62bc2a-5a44-4b5b-baa4-166ce5b93fb1 = "create user"

 

 

{
"id": "01G88Q03N56RS32CHMC4RP6DB6",
"type": "help_center_searched",
"source": "zendesk",
"description": "",
"created_at": "2022-07-18T13:12:12.708580066Z",
"received_at": "2022-07-18T13:12:19.407383223Z",
"properties": {
"channel": "help_center",
"result_count": 0,
"search_query": {
"locale": "en-us",
"page": 1,
"page_size": 10,
"query": "403964161819",
"search_id": "7b62bc2a-5a44-4b5b-baa4-166ce5b93fb1"
}

3 replies

Hi Alex,
 
The query attribute should be the text string that the user provided in search.  Are you seeing a different value for query in your testing?
 

Alex37
  • Author
  • October 10, 2022

Hi Christopher,

Thanks for clarifying that query is the text string used in the help center search.

To answer your question, yes. The response used as an example in the API documentation that you pointed me to for the help_center_searched type of event is different than the response I get in my production environment.

Zendesk API documentation example:

{
"id": "01EADXRV4QC53NCWV38RWPMPJQ",
"type": "help_center_searched",
"source": "zendesk",
"description": "",
"created_at": "2020-06-10T01:33:33.71951541Z",
"received_at": "2020-06-10T01:33:41.173895146Z",
"properties": {
"result_count": 5,
"search_query": {
"locale": "en-us",
"page": 1,
"page_size": 10,
"query": "Help",
"search_id": "8a8a5a55-df2c-445f-9bbd-eacff9bf83b9",
"channel": "help_center"
}
}
}

And here's what I see in the actual API response in my production environment below:

Request:
https://{domain}.zendesk.com/api/v2/users/1265678121909/events

Response:
{
"id": "01G88PPDYV64RP4R9R65K62D9N",
"type": "help_center_searched",
"source": "zendesk",
"description": "",
"created_at": "2022-07-18T13:06:55.579348035Z",
"received_at": "2022-07-18T13:07:04.688585634Z",
"properties": {
"channel": "help_center",
"result_count": 0,
"search_query": {
"locale": "en-us",
"page": 1,
"page_size": 10,
"query": "403964161819",
"search_id": "3df737d6-ecfe-4370-8360-f6d9ddff4f50"
}
}
},

Questions:
1) Is the user's text string expected to show in the query attribute (as shown in the API documentation) or is expected to be a randomly generated number (as shown in my API response).
2) If the text string is expected to show in the query attribute, is there something that I need to configure in my environment to show this value instead?


Alex37
  • Author
  • October 10, 2022

Hi Christopher,

Update - I executed a few more searches on the UI in my help center, ran the events API again, and I'm now seeing the search text string as expected.

It is possible that the numerical value in the API response for the query attribute was a valid text string entered in the help center UI "403964161819" in search of an article with a particular article id. All seems to be working fine and as per the documentation.

Thanks,
Alex Childs