Documentation Index
Fetch the complete documentation index at: https://atp.hypertext.studio/llms.txt
Use this file to discover all available pages before exploring further.
Overview
This tutorial will guide you through the process of creating and sending your first notification using the Agent Triage Protocol (ATP). By the end, you’ll understand how to structure notifications, set appropriate actions, and handle responses.Prerequisites
Before starting this tutorial, make sure you have:- Completed the Quickstart Guide and set up your ATP client
- Registered your service with the ATP server
- Set up a webhook endpoint for receiving responses (for production use)
Understanding Notification Components
A well-structured ATP notification consists of several key components:- Title and Description: Clear, concise information about what the notification is for
- Actions: The possible responses a user can take
- Deadline: When a response is needed by
- Metadata: Additional context for the notification
Step 1: Planning Your Notification
Before writing code, consider what you’re asking the user to do. For this tutorial, we’ll create a notification that asks for approval to run a large database query. Think about:- What information does the user need to make a decision?
- What actions should be available to the user?
- How long should they have to respond?
Step 2: Define Your Actions
Actions are the possible responses a user can provide. Each action needs:- A unique ID
- A descriptive label
- A response type (SIMPLE, TEXT, NUMBER, etc.)
- Optional constraints or flags
- “Approve” - A simple yes button
- “Deny” - With a text field for explaining why
Step 3: Create the Notification
Now let’s create the notification object:Step 4: Send the Notification
Now let’s send the notification to the ATP server:Step 5: Set Up Your Webhook Handler
To receive responses, you need a webhook endpoint. Here’s an example implementation:Step 6: Checking Notification Status (Optional)
If you want to proactively check the status of your notification:Best Practices for Effective Notifications
To ensure your notifications are effective:-
Be Clear and Concise
- Use descriptive titles that quickly convey purpose
- Keep descriptions focused on what the user needs to know
- Avoid technical jargon unless necessary
-
Set Appropriate Deadlines
- Match the deadline to the urgency of the decision
- Consider time zones when setting deadlines
-
Provide Sufficient Context
- Include relevant data in the metadata field
- Explain potential impacts of different actions
- Link to additional information when necessary
-
Design Thoughtful Actions
- Limit options to what’s necessary (2-4 actions is typically ideal)
- Use appropriate response types for the data you need
- Make action labels clear and actionable (e.g., “Approve Query” not just “Yes”)
-
Handle Responses Gracefully
- Acknowledge when a user responds
- Handle webhook failures and retries
- Have fallback plans for expired notifications
Complete Example
Here’s a complete example that puts everything together:Next Steps
Now that you’ve created your first notification, you might want to explore:- Response Types - Learn about all the available response types
- Notification Best Practices - Tips for designing effective notifications
- Error Handling - How to handle errors and edge cases
- Authentication - Advanced authentication options