Overview
The Tags API allows you to create, manage, and apply tags to mentions for better organization and categorization. Tags support custom colors for visual identification.
Methods
Fetch all tags for an alert.
client.get_tags(
account_id: str,
alert_id: str
) -> TagsResponse
Returns: TagsResponse containing list of tags
Example:
from mention import MentionClient
client = MentionClient(access_token="your-token")
tags_response = client.get_tags("acc_123456", "alert_123")
for tag in tags_response.tags:
print(f"{tag.name} - Color: {tag.color}")
Response:
{
"tags": [
{
"id": "tag_1",
"name": "Customer Feedback",
"color": "#4CAF50"
},
{
"id": "tag_2",
"name": "Bug Report",
"color": "#F44336"
},
{
"id": "tag_3",
"name": "Feature Request",
"color": "#2196F3"
}
]
}
Create Tag
Create a new tag for an alert.
from mention import CreateTagRequest
client.create_tag(
account_id: str,
alert_id: str,
request: CreateTagRequest
) -> Tag
Request Fields:
Tag color (hex color code, e.g., #4CAF50)
Returns: Created Tag object
Example:
from mention import MentionClient, CreateTagRequest
client = MentionClient(access_token="your-token")
request = CreateTagRequest(
name="Customer Feedback",
color="#4CAF50"
)
tag = client.create_tag("acc_123456", "alert_123", request)
print(f"Created tag: {tag.id} - {tag.name}")
Response:
{
"id": "tag_456",
"name": "Customer Feedback",
"color": "#4CAF50"
}
Update Tag
Update an existing tag’s name or color.
from mention import UpdateTagRequest
client.update_tag(
account_id: str,
alert_id: str,
tag_id: str,
request: UpdateTagRequest
) -> Tag
Tag update request (all fields optional)
Returns: Updated Tag object
Example:
from mention import UpdateTagRequest
request = UpdateTagRequest(
name="Customer Feedback (Updated)",
color="#8BC34A"
)
tag = client.update_tag(
"acc_123456",
"alert_123",
"tag_456",
request
)
print(f"Updated tag: {tag.name} - {tag.color}")
Delete Tag
Delete a tag permanently.
client.delete_tag(
account_id: str,
alert_id: str,
tag_id: str
) -> bool
Returns: True if deletion was successful
Example:
success = client.delete_tag(
"acc_123456",
"alert_123",
"tag_456"
)
if success:
print("Tag deleted successfully")
Tags can be applied to mentions using the curate_mention method:
Example:
from mention import CurateMentionRequest
# Apply tags to a mention
request = CurateMentionRequest(
tags=["tag_1", "tag_2", "tag_3"]
)
mention = client.curate_mention(
"acc_123456",
"alert_123",
"mention_789",
request
)
print(f"Tags applied: {len(mention.tags)}")
for tag in mention.tags:
print(f" - {tag.name} ({tag.color})")
Models
Tag
Represents a tag associated with an alert.
| Field | Type | Description |
|---|
id | string | Tag ID |
name | string | Tag name |
color | string | Hex color code (e.g., #4CAF50) |
CreateTagRequest
Request for creating a new tag.
| Field | Type | Required | Description |
|---|
name | string | Yes | Tag name |
color | string | No | Hex color code |
UpdateTagRequest
Request for updating an existing tag.
| Field | Type | Description |
|---|
name | string | New tag name |
color | string | New hex color code |
Color Recommendations
Popular hex color codes for tags:
| Color | Hex Code | Use Case |
|---|
| Green | #4CAF50 | Positive feedback, success |
| Red | #F44336 | Issues, bugs, negative |
| Blue | #2196F3 | Information, general |
| Orange | #FF9800 | Priority, attention needed |
| Purple | #9C27B0 | Feature requests |
| Yellow | #FFEB3B | Pending, waiting |
| Teal | #009688 | Questions |
| Pink | #E91E63 | Important |