Hey everyone,
I’m trying to get the typing indicator working for our web chat widget. I’ve got the basic message sending down, but the status updates aren’t sticking. The goal is to show “Agent is typing…” while they’re working on the response.
I’m following the Guest API docs for /api/v2/conversations/messaging/typing. Here is the code snippet I’m using in the frontend JS:
async function sendTypingStatus(conversationId, participantId, isTyping) {
const endpoint = `/api/v2/conversations/messaging/typing/${conversationId}`;
const payload = {
participantId: participantId,
isTyping: isTyping
};
try {
const response = await fetch(endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${authToken}`
},
body: JSON.stringify(payload)
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
} catch (error) {
console.error('Failed to send typing status:', error);
}
}
The authToken is valid and works fine for sending regular messages via the /messages endpoint. The participantId is definitely the agent’s ID, not the guest’s ID, because the agent is the one typing.
When I call this, I get a 403 Forbidden error back. The response body is empty. I’ve double-checked the permissions on the OAuth client and it has messaging:conversation:write.
Is there a specific scope I’m missing for typing indicators? Or maybe I need to use a different participant ID? I’ve been staring at this for an hour and can’t find the issue. Any pointers would be great.