Feature Announcement API¶
Overview¶
The Feature Announcement API allows you to automatically create a complete announcement system with a single API call. When you create an announcement, the system automatically: - Creates a drip email template that can be sent to customers - Adds the email to a drip campaign (with a 3-day delay) - Publishes a blog post/KB article immediately
How to Use¶
API Endpoint¶
URL: https://kivalogic.com/api.php
Method: POST
Authentication: API key required
Required Parameters¶
| Parameter | Type | Description |
|---|---|---|
key |
string | Your API authentication key (R5pRmGKJTJbYnS) |
action |
string | Must be: create_announcement |
subject |
string | The title/subject of the announcement (max 128 characters) |
body |
HTML string | The full content of the announcement (HTML formatted) |
Example Usage with cURL¶
curl -X POST "https://kivalogic.com/api.php" \
-d "key=R5pRmGKJTJbYnS" \
-d "action=create_announcement" \
-d "subject=New Feature: Customer Portal" \
-d "body=<h2>Exciting Update!</h2><p>We've launched a new customer portal...</p>"
Example Usage with PHP¶
<?php
$data = array(
'key' => 'R5pRmGKJTJbYnS',
'action' => 'create_announcement',
'subject' => 'New Feature: Customer Portal',
'body' => '<h2>Exciting Update!</h2><p>We\'ve launched a new customer portal...</p>'
);
$ch = curl_init('https://kivalogic.com/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
?>
Response Format¶
Success Response¶
{
"success": true,
"email_template_id": 70,
"drip_campaign_email_id": 10,
"kb_article_id": 59,
"slug": "new-feature-customer-portal",
"blog_url": "blog/new-feature-customer-portal"
}
Success Response Fields¶
| Field | Description |
|---|---|
success |
Boolean indicating if the operation was successful |
email_template_id |
The ID of the created email template |
drip_campaign_email_id |
The ID of the drip campaign email record |
kb_article_id |
The ID of the created knowledge base article |
slug |
The URL-friendly slug for the blog post |
blog_url |
The relative URL to view the blog post |
Error Response¶
{
"success": false,
"error": "Missing required fields: subject and body"
}
What Gets Created¶
1. Email Template¶
- A new email template is created in the system
- Template name and subject are set to your announcement subject
- Body contains your HTML content
- Uses system default design (design = 0)
- Can be edited at:
kiv/admin_email_edit.php?edit=[email_template_id]
2. Drip Campaign Email¶
- Automatically linked to Drip Campaign ID 1
- Set with a 3-day delay before sending
- Status is set to Published (1) - ready to send
- Can be viewed/edited in the drip campaign management interface
3. Knowledge Base Article / Blog Post¶
- Published immediately to the blog
- Accessible at:
blog/[slug] - Categorized as "announcement"
- Timestamp set to current time
- Slug is auto-generated from the subject (lowercase, spaces replaced with hyphens)
FAQ¶
Can I edit the announcement after it's created?¶
Yes! All components can be edited individually:
- Email Template: Edit at kiv/admin_email_edit.php?edit=[email_template_id]
- Drip Campaign: Manage in the drip campaign interface at kiv/drip.php
- Blog Post: Edit the KB article directly in the database or through the admin interface
What if I want to use a different drip campaign?¶
Currently, the API hardcodes Drip Campaign ID 1. To change this, you can either:
- Edit the createAnnouncement() function in api.php and change the campaign ID
- After creation, manually edit the drip campaign email record in the database
How do I format the HTML body?¶
The body accepts standard HTML. For best results:
- Use proper HTML tags like <h2>, <p>, <ul>, <li>
- Avoid complex CSS or JavaScript
- Keep it simple and clean for email compatibility
- Test the email preview after creation
What if the slug already exists?¶
If a blog post with the same slug already exists, the system automatically appends a timestamp to make it unique. For example: new-feature-1730880000
How long is the delay before the drip email sends?¶
The drip email is configured with a 3-day delay. This means it will be sent 3 days after a customer is added to Drip Campaign 1.
Troubleshooting¶
Error: "Missing required fields"¶
Make sure you're including both subject and body parameters in your POST request.
Error: "Failed to create email template"¶
This could be due to: - Database connection issues - Invalid HTML in the body causing SQL errors - Subject line exceeding 128 characters
The blog post shows escaped HTML¶
Make sure you're properly encoding the HTML when sending it via the API. Use URL encoding for the POST data.
Technical Details¶
Database Tables Modified¶
email_templates- Stores the email templatedrip_campaign_emails- Links the email to the drip campaignkb_articles- Stores the blog post/article
Logging¶
All announcements are logged to the system log (syslog table) with details about the created records. Check the logs if you need to audit or troubleshoot announcements.
Security¶
The API uses the same authentication pattern as other API endpoints. Keep your API key secure and never commit it to version control or expose it publicly.