Skip to content

Commit 82ca9c0

Browse files
committed
Content for the context page in the workflow section
1 parent a6ec1aa commit 82ca9c0

File tree

12 files changed

+355
-283
lines changed

12 files changed

+355
-283
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
pageTitle: 'Using contexts for Inbox personalization'
3+
title: 'Inbox with context'
4+
description: 'Learn how to use the data object to extend in-app notifications with custom metadata.'
5+
icon: 'Table'
6+
---
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"title": "Customize and configure",
33
"icon": "SlidersHorizontal",
4-
"pages": ["styling", "icons", "tabs", "preferences", "data-object"],
4+
"pages": ["styling", "icons", "tabs", "preferences", "data-object", "inbox-with-context"],
55
"description": "Learn how to configure your inbox with styling, tabs, preferences, data objects, and snooze functionality"
66
}

content/docs/platform/workflow/contexts.mdx

Lines changed: 0 additions & 282 deletions
This file was deleted.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
pageTitle: 'Personalize workflows and templates in Novu using context'
3+
title: 'Applying context'
4+
description: 'Learn how to use contexts in Novu to personalize notification templates, control workflow logic, and customize the Inbox. Understand supported data formats and how to debug context usage from the activity feed.'
5+
---
6+
7+
Contexts let you personalize how notifications are rendered and delivered by making contextual data available inside template editors, step conditions, and the <Method href="/platform/inbox/configuration/inbox-with-context">{`<Inbox />`}</Method> component.
8+
9+
## How to use context
10+
11+
Once a context is created either through the Novu dashboard or API, its data becomes available for use in your templates editors, step conditions, and for customizing the <Method href="/platform/inbox/configuration/inbox-with-context">{`<Inbox />`}</Method> component.
12+
13+
### Using context data in the template editor
14+
15+
Use the `{{context}}` Handlebars helper to access context data in any template editor. The context key you provide while creating the context (for example, tenant, region) becomes the accessor.
16+
17+
18+
For example, if a context with this data is created:
19+
20+
```json
21+
context: {
22+
tenant: {
23+
id: 'acme-corp',
24+
data: {
25+
name: 'Acme Corporation',
26+
plan: 'enterprise'
27+
}
28+
}
29+
}
30+
```
31+
32+
You can access the `name` and `plan` in your in-app, email, SMS, or push template like this:
33+
34+
```html
35+
<p>Welcome, new user from {{context.tenant.data.name}}!</p>
36+
<p>Your account is on the {{context.tenant.data.plan}} plan.</p>
37+
```
38+
Or
39+
40+
```text
41+
Welcome, new user from {{context.tenant.data.name}}!
42+
Your account is on the {{context.tenant.data.plan}} plan.
43+
```
44+
45+
![Using context data in the template editor](/images/workflows/contexts/context.gif)
46+
47+
<Callout>Refer to the Inbox documentation, to learn how to use context in the <Method href="/platform/inbox/configuration/inbox-with-context">{`<Inbox />`}</Method> component. </Callout>
48+
49+
### Using context in step conditions
50+
51+
You can use context variables in the **Step conditions** tab of a workflow step to add conditional logic to your notifications. For example, only send a "Feature X is now enabled" email if `context.tenant.data.plan` is `enterprise`.
52+
![Context step conditions](/images/workflows/context-step-conditions.png)
53+
54+
To learn how contexts are structured or how to define them, refer to the [Managing Contexts](/platform/workflow/contexts/manage-contexts) documentation.
55+
56+
## Viewing and debugging contexts
57+
58+
Once you start using contexts in your workflows, Novu provides full observability so you can monitor and debug your context usage after a workflow has been triggered.
59+
60+
### Searching for workflow runs
61+
62+
You can filter your workflow runs to find all executions associated with a specific context.
63+
64+
1. Navigate to the **Activity Feed** in your Novu dashboard.
65+
2. Select the **Workflow Runs** tab.
66+
3. In the search bar, click **Context** and enter the context `type` and `id` using the format `type:id`.
67+
68+
![Searching for workflow runs](/images/workflows/search-context-activityfeed.png)
69+
70+
### Verifying the resolved context
71+
72+
To confirm that Novu received and processed your context data correctly, you can inspect the API traces for a specific run.
73+
74+
1. From the **Activity Feed**, select the relevant workflow run from the list in the **Requests** tab.
75+
2. In the workflow run details, go to the **API Traces** tab.
76+
77+
Here, you will see the full context object that was resolved and attached to that specific workflow execution.
78+
79+
![Verifying the resolved context](/images/workflows/resolved-context.png)

0 commit comments

Comments
 (0)