This step is optional. You can browse what was collected and tag messages, for example to mark the ones relevant to the case. Tags can later limit an export (Step 5).
Find conversations and messages
GET /conversation/searchlists the case's conversations. Filter bycaseanddevices(the device id), and page through the results.GET /conversation/search-entrieslists the messages in chosen conversations (caseandconversation). You can filter by date, tags, untagged messages and attachments.GET /conversation/search-fuzzyfinds messages whose text matchessearchText(3 to 100 characters).POST /conversation/search-advancefinds messages matching keyword conditions.
Every conversation and message row carries its id (data.data[].id). Keep the message ids you want to tag.
Message dates are the phone's local clock time, even though they are labelled UTC. Do not convert them to another time zone.
Manage the case's tags
Tags belong to a case. Create them before you apply them.
GET /case/tags/{caseId}lists them, each with itsid. Keep the tag ids if you plan to limit an export by tag.POST /case/tags/{caseId}creates one.nameis required;severity(info,warning,danger),backgroundColorandtextColorare optional.PATCH /case/tags/{caseId}/{tagId}renames it or changes its colors or severity.DELETE /case/tags/{caseId}/{tagId}deletes it.
Apply and remove tags
The tagging calls take tagNames: a list of tag names or tag ids.
- One message:
POST /conversation/entries/tags/{caseId}/{messageId}adds tags;DELETEon the same path removes them. Both taketagNamesin the body. - Many messages:
POST /conversation/entries/tags/{caseId}/bulktags many messages at once, withmessages(the message ids) andtagNames. Prefer it over one call per message; it is faster and stays well under the rate limit. - A whole conversation:
PATCH /case/conversations/{caseId}/{conversationId}/tagsreplaces the conversation's tag list. SendcaseIdand the fulltagslist you want, not just the new tag. An empty list removes every tag. - Counts:
POST /conversation/{caseId}/tags-countreturns how many messages carry each tag.
List the conversations on one phone:
curl "https://api.usehearsay.com/conversation/search?case=$CASE_ID&devices=$DEVICE_ID&page=1" \
-H "Authorization: Bearer $TOKEN" \
-H "organization: $ORG_ID"
Create a tag:
curl -X POST "https://api.usehearsay.com/case/tags/$CASE_ID" \
-H "Authorization: Bearer $TOKEN" \
-H "organization: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{"name": "Relevant", "severity": "info"}'
Tag many messages at once:
curl -X POST "https://api.usehearsay.com/conversation/entries/tags/$CASE_ID/bulk" \
-H "Authorization: Bearer $TOKEN" \
-H "organization: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{
"messages": ["507f1f77bcf86cd799439021", "507f1f77bcf86cd799439022"],
"tagNames": ["Relevant"]
}'