Skip to content

Commit 018542c

Browse files
authored
docs: Add ticket recovery documentation for Support widget and JavaScript API (#15194)
* docs(support): add ticket recovery across browsers section to widget docs Documents the new "Recover your tickets" feature from PR #48509 that allows end users to restore their support tickets when switching browsers via an email-based recovery link. * docs: add ticket recovery API methods (requestRestoreLink, restoreFromUrlToken) --------- Co-authored-by: inkeep[bot] <257615677+inkeep[bot]@users.noreply.github.com>
1 parent ad5e937 commit 018542c

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

contents/docs/support/javascript-api.mdx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,41 @@ setInterval(async () => {
243243
}, 5000)
244244
```
245245

246+
## Recover tickets across browsers
247+
248+
Tickets are tied to the browser's widget session ID, so switching browsers or clearing storage means losing access. You can recover tickets by requesting a recovery link via email.
249+
250+
### Request a recovery link
251+
252+
```javascript
253+
await posthog.conversations.requestRestoreLink('user@example.com')
254+
```
255+
256+
This sends an email containing a recovery link to the provided address. The link includes a `ph_conv_restore` token as a query parameter and expires after one hour.
257+
258+
**Parameters:**
259+
- `email` (string) - The email address used in previous conversations
260+
261+
The method is rate limited. If you send too many requests, it throws an error with a 429 status.
262+
263+
### Restore tickets from a recovery link
264+
265+
```javascript
266+
const result = await posthog.conversations.restoreFromUrlToken()
267+
```
268+
269+
Reads the `ph_conv_restore` query parameter from the current URL and migrates the associated tickets to the current browser session. After processing, the query parameter is removed from the URL.
270+
271+
**Response:**
272+
```typescript
273+
interface RestoreResult {
274+
status: 'success'
275+
migrated_ticket_ids: string[] // IDs of tickets migrated to this session
276+
}
277+
```
278+
279+
The default widget calls `restoreFromUrlToken()` automatically on load, so you only need to call this yourself if you're building a custom UI.
280+
246281
## Events captured
247282

248283
The conversations module automatically captures these events:
@@ -317,3 +352,5 @@ try {
317352
| `getTickets(options?)` | Fetch tickets list | `Promise<GetTicketsResponse \| null>` |
318353
| `getCurrentTicketId()` | Get current ticket ID | `string \| null` |
319354
| `getWidgetSessionId()` | Get widget session ID | `string \| null` |
355+
| `requestRestoreLink(email)` | Send a recovery email to restore tickets | `Promise<void>` |
356+
| `restoreFromUrlToken()` | Restore tickets from URL recovery token | `Promise<RestoreResult \| null>` |

contents/docs/support/widget.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,19 @@ posthog.init('YOUR_API_KEY', {
7979

8080
This is different from hiding the widget – it completely disables the feature.
8181

82+
## Recover tickets across browsers
83+
84+
Support tickets are tied to the browser session by default. If a user switches browsers or clears their storage, they won't see their previous tickets. The widget includes a **Recover your tickets** link to handle this.
85+
86+
### How recovery works
87+
88+
1. The user clicks **Recover your tickets** in the ticket list
89+
2. They enter the email address used in previous conversations
90+
3. A recovery link is sent to that email (expires in one hour)
91+
4. Clicking the link opens the widget and restores their tickets in the new browser
92+
93+
If the page URL contains a `ph_conv_restore` query parameter (from clicking the recovery link), tickets are automatically restored on page load. The parameter is removed from the URL after processing.
94+
8295
## Email notifications
8396

8497
Configure your team to receive email alerts when new tickets arrive.

0 commit comments

Comments
 (0)