Skip to content

Commit db13373

Browse files
authored
Revise Journeys API receipts documentation
Updated the documentation for the Journeys API receipts, including changes to sections on viewing receipts, receipt fields, upgrade notes, possible outcomes, and important notes.
1 parent f2e2d80 commit db13373

1 file changed

Lines changed: 113 additions & 0 deletions

File tree

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Journeys Receipts
2+
3+
The Devvit Journeys API responses include a **receipt**: a small feedback object that tells you what happened to a telemetry event.
4+
5+
This is not end-user messaging. It's implementation feedback so you can tell whether a Journey event was recorded, skipped, rejected, rate limited, or could not be confirmed.
6+
7+
## Viewing receipts
8+
9+
Every Journey telemetry call now returns a receipt.
10+
11+
`startJourney()` returns:
12+
13+
```ts
14+
{
15+
journeyId: string,
16+
receipt: {
17+
status: string,
18+
message: string
19+
}
20+
}
21+
```
22+
23+
Other Journey calls return:
24+
25+
```ts
26+
{
27+
receipt: {
28+
status: string,
29+
message: string
30+
}
31+
}
32+
```
33+
34+
Covered calls:
35+
36+
- Start Journey
37+
- Journey Progress
38+
- Journey Interaction
39+
- End Journey
40+
- App Ready
41+
42+
## Receipt fields
43+
44+
`status` is the machine-readable outcome. Use this for branching, tests, or tooling.
45+
46+
`message` is the human-readable diagnostic. You can log it or display it during implementation/debugging.
47+
48+
## Upgrade note for existing devs
49+
50+
`startJourney()` changed from returning only the Journey ID information to returning the Journey ID plus a receipt. If you’re upgrading existing code, you may need to update any custom response types, mocks, or destructuring assumptions so they account for the new `receipt` field.
51+
52+
For example, code that only typed the response as `{ journeyId: string }` should now expect:
53+
54+
```ts
55+
{
56+
journeyId: string,
57+
receipt: {
58+
status: string,
59+
message: string
60+
}
61+
}
62+
```
63+
64+
## Possible receipt outcomes
65+
66+
| Status | Meaning | Current Message |
67+
| :---- | :---- | :---- |
68+
| `JOURNEY_RECEIPT_VALID` | Event was accepted and recorded. | `Success: Event was recorded.` |
69+
| `JOURNEY_RECEIPT_DENIED_NOT_ALLOWLISTED` | Event was valid, but the app is not enabled for Journey telemetry yet. | `Denied: Your app is not allowlisted for Journey telemetry yet.` |
70+
| `JOURNEY_RECEIPT_DENIED_RATE_LIMITED` | Event was valid, but skipped because the app sent too many events. | `Denied: Event was rate limited.` |
71+
| `JOURNEY_RECEIPT_DENIED_DUPLICATE` | Event was valid, but skipped because it was already recorded. | `Denied: Event was already recorded.` |
72+
| `JOURNEY_RECEIPT_INVALID` | Event payload was invalid and was not recorded. | `Invalid: Event payload was not recorded.` |
73+
| `JOURNEY_RECEIPT_UNSPECIFIED` | Recording status could not be confirmed. | `Unknown: Telemetry recording status could not be confirmed.` |
74+
75+
##
76+
77+
Example:
78+
79+
```javascript
80+
{
81+
"journeyId": "f7ece033-0247-407c-aede-8b65c7fd645c",
82+
"receipt": {
83+
"status": "JOURNEY_RECEIPT_DENIED_NOT_ALLOWLISTED",
84+
"message": "Denied: Your app is not allowlisted for Journey telemetry yet."
85+
}
86+
}
87+
```
88+
89+
That receipt is an indicator to reach out to the Devvit team for allowlisting. After allowlist, the dev sees:
90+
91+
```javascript
92+
{
93+
"journeyId": "f7ece033-0247-407c-aede-8b65c7fd645c",
94+
"receipt": {
95+
"status": "JOURNEY_RECEIPT_VALID",
96+
"message": "Success: Event was recorded."
97+
}
98+
}
99+
```
100+
101+
## Important notes
102+
103+
A successful API response does not always mean the event was recorded. The receipt is the source of truth for the telemetry outcome.
104+
105+
Denied receipts are still useful: they tell developers the SDK call worked, but the telemetry event was intentionally not ingested.
106+
107+
If the client reuses an already-active Journey, it returns:
108+
109+
```
110+
Already started: Reusing the active Journey; no new start event was recorded.
111+
```
112+
113+
This means no new start event was sent because the client already has an active Journey session.

0 commit comments

Comments
 (0)