@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
245 lines • 12.2 kB
TypeScript
import type { SlackClient } from '../client';
import type { WebHookCreateParams, WebHookResponse, WebHookRefreshParams, WebHookRefreshResponse } from '../schemas';
type ExecuteRequest = SlackClient['executeRequest'];
/**
* Creates the webHook resource methods
* OpenAPI Path: /web-hook → webHook.*
* @description Webhook management and message delivery functionality
*/
export declare function createWebHookResource(executeRequest: ExecuteRequest): {
/**
* Send messages and manage Slack webhooks
*
* @fullPath api.slack.webHook.create
* @service slack
* @domain communication-and-notifications
* @dataMethod webHookData.create
* @discoverable true
* @searchTerms ["slack", "webhook", "message", "notification", "send", "channel", "team communication", "alerts", "blocks", "attachments"]
* @relatedEndpoints ["api.slack.webHook.refresh.get", "api.joomla.users.notifications", "api.commerce.orders.notifications", "api.customers.alerts.create"]
* @commonPatterns ["Send Slack message", "Team notification", "Alert delivery", "Webhook integration", "Channel broadcast", "User notification"]
* @workflow ["notification-delivery", "team-communication", "alert-management", "webhook-integration", "message-broadcasting", "incident-response"]
* @prerequisites ["Valid Slack webhook URL", "Channel permissions", "Valid authentication token", "x-site-id header", "Message content"]
* @nextSteps ["Monitor delivery status", "Handle webhook responses", "Update notification preferences", "Track message engagement"]
* @businessRules ["Supports Slack Block Kit and legacy attachments", "Requires webhook URL or channel", "Message formatting follows Slack standards", "Delivery status tracking", "Retry logic for failed deliveries"]
* @functionalArea "communication-and-notifications"
* @crossSite "Multi-site webhook configuration and message routing"
* @caching "No caching - real-time message delivery required"
* @performance "Async delivery with status tracking, batch messages for high volume, use blocks for rich formatting"
*
* @param params Webhook request parameters including message content, formatting, and delivery options
* @returns Promise<WebHookResponse> Webhook delivery status and message metadata
*
* @example
* ```typescript
* // Send simple text message
* const simpleMessage = {
* text: "Hello from the API!",
* channel: "#general",
* 'x-site-id': 'SITE123'
* };
* const response = await client.webHook.create(simpleMessage);
* console.log(response.data.delivery_status); // 'sent', 'delivered', 'failed'
*
* // Send rich message with blocks (modern Slack formatting)
* const richMessage = {
* channel: "#alerts",
* blocks: [{
* type: "section",
* text: {
* type: "mrkdwn",
* text: "*Order Alert* :warning:\nNew high-value order received"
* }
* }, {
* type: "section",
* fields: [{
* type: "mrkdwn",
* text: "*Order ID:*\n#12345"
* }, {
* type: "mrkdwn",
* text: "*Amount:*\n$1,250.00"
* }]
* }],
* 'x-site-id': 'SITE123'
* };
* const alertResponse = await client.webHook.create(richMessage);
*
* // Send message with legacy attachments
* const attachmentMessage = {
* text: "Order Processing Update",
* channel: "#orders",
* attachments: [{
* color: "good",
* title: "Order #12345 Processed",
* text: "Customer order has been successfully processed and shipped.",
* fields: [{
* title: "Customer",
* value: "John Doe",
* short: true
* }, {
* title: "Total",
* value: "$299.99",
* short: true
* }],
* footer: "Order System",
* ts: Date.now() / 1000
* }],
* 'x-site-id': 'SITE123'
* };
* const orderUpdate = await client.webHook.create(attachmentMessage);
*
* // Get just the webhook data
* const deliveryStatus = await client.webHookData.create(simpleMessage);
* console.log(deliveryStatus); // Direct webhook data access
*
* // Configure webhook for automated notifications
* const webhookConfig = {
* url: "https://hooks.slack.com/services/YOUR/WEBHOOK/URL",
* channel: "#automation",
* username: "API Bot",
* icon_emoji: ":robot_face:",
* webhook_type: "incoming",
* 'x-site-id': 'SITE123'
* };
* const configResponse = await client.webHook.create(webhookConfig);
* ```
*/
create: (params: WebHookCreateParams) => Promise<WebHookResponse>;
/**
* WebHook refresh operations
* OpenAPI path: /web-hook/refresh
*/
refresh: {
/**
* Refresh Slack webhook configurations and connectivity
*
* @fullPath api.slack.webHook.refresh.get
* @service slack
* @domain communication-and-notifications
* @dataMethod webHookData.refresh.get
* @discoverable true
* @searchTerms ["webhook", "refresh", "configuration", "update", "sync", "connectivity", "channels", "integration refresh"]
* @relatedEndpoints ["api.slack.webHook.create", "api.slack.healthCheck.get", "api.joomla.configuration.refresh", "api.commerce.settings.sync"]
* @commonPatterns ["Refresh webhook config", "Update integration", "Sync channels", "Reconnect webhooks", "Configuration update"]
* @workflow ["webhook-management", "integration-maintenance", "configuration-sync", "connectivity-restoration", "channel-discovery"]
* @prerequisites ["Valid authentication token", "x-site-id header", "Webhook configurations exist", "Slack API connectivity"]
* @nextSteps ["Verify refreshed configurations", "Test webhook delivery", "Update channel mappings", "Monitor integration health"]
* @businessRules ["Refreshes all webhook configurations", "Discovers new channels", "Validates existing webhooks", "Updates connectivity status", "Handles configuration errors"]
* @functionalArea "communication-and-notifications"
* @crossSite "Multi-site webhook configuration refresh"
* @caching "Cache refreshed configuration for 1 hour"
* @performance "May take several seconds for full refresh, run periodically to maintain connectivity"
*
* @param params Webhook refresh parameters including force refresh option
* @returns Promise<WebHookRefreshResponse> Refresh results with configuration status and channel information
*
* @example
* ```typescript
* // Standard webhook refresh
* const refreshResponse = await client.webHook.refresh.get({ 'x-site-id': 'SITE123' });
* console.log(refreshResponse.data.refreshed); // true/false
* console.log(refreshResponse.data.active_webhooks); // Count of active webhooks
* console.log(refreshResponse.data.channels); // Available channels
*
* // Force refresh (bypasses cache)
* const forceRefresh = await client.webHook.refresh.get({
* 'x-site-id': 'SITE123',
* force: true
* });
* console.log(forceRefresh.data.configuration_status); // 'valid', 'invalid', 'partial'
*
* // Get just the refresh data
* const refreshData = await client.webHookData.refresh.get({ 'x-site-id': 'SITE123' });
* console.log(refreshData); // Direct refresh data access
*
* // Handle refresh errors
* const refreshResult = await client.webHook.refresh.get({ 'x-site-id': 'SITE123' });
* if (refreshResult.data.errors && refreshResult.data.errors.length > 0) {
* console.log('Refresh errors:', refreshResult.data.errors);
* // Handle configuration issues
* }
*
* // Monitor webhook health after refresh
* if (refreshResult.data.inactive_webhooks > 0) {
* console.log(`${refreshResult.data.inactive_webhooks} webhooks need attention`);
* // Investigate inactive webhooks
* }
* ```
*/
get: (params: WebHookRefreshParams) => Promise<WebHookRefreshResponse>;
};
};
/**
* Creates the webHookData resource methods (data-only versions)
*/
export declare function createWebHookDataResource(webHook: ReturnType<typeof createWebHookResource>): {
/**
* Send Slack webhook and get data without full response metadata
*
* @fullPath api.slack.webHookData.create
* @service slack
* @domain communication-and-notifications
* @dataMethod webHookData
* @discoverable true
* @searchTerms ["webhook data", "message data", "delivery status", "notification result"]
* @relatedEndpoints ["api.slack.webHook.create", "api.slack.webHook.refresh.get"]
* @commonPatterns ["Send message data", "Get delivery status", "Direct webhook access"]
* @workflow ["notification-delivery", "team-communication", "alert-management"]
* @prerequisites ["Valid webhook configuration", "Message content", "Valid authentication token"]
* @nextSteps ["Monitor delivery status", "Handle webhook responses", "Track message engagement"]
* @businessRules ["Returns only webhook data", "No response metadata included", "Direct access to delivery status"]
* @functionalArea "communication-and-notifications"
* @caching "No caching - real-time delivery tracking"
* @performance "Direct data access, optimal for webhook status monitoring"
*
* @param params Webhook request parameters
* @returns Promise<WebHookData> Direct webhook delivery data without response wrapper
*/
create: (params: WebHookCreateParams) => Promise<{
webhook_id?: string | undefined;
} & {
[k: string]: unknown;
}>;
/**
* WebHook refresh data operations
* OpenAPI path: /web-hook/refresh (data only)
*/
refresh: {
/**
* Refresh webhooks and get data without full response metadata
*
* @fullPath api.slack.webHookData.refresh.get
* @service slack
* @domain communication-and-notifications
* @dataMethod webHookRefreshData
* @discoverable true
* @searchTerms ["refresh data", "webhook config", "integration status", "channel data"]
* @relatedEndpoints ["api.slack.webHook.refresh.get", "api.slack.webHook.create"]
* @commonPatterns ["Get refresh data", "Configuration status", "Channel information"]
* @workflow ["webhook-management", "integration-maintenance", "configuration-sync"]
* @prerequisites ["Valid authentication token", "x-site-id header", "Webhook configurations"]
* @nextSteps ["Verify configurations", "Test webhook delivery", "Update channel mappings"]
* @businessRules ["Returns only refresh data", "No response metadata included", "Direct access to configuration status"]
* @functionalArea "communication-and-notifications"
* @caching "Cache for 1 hour after refresh"
* @performance "Direct data access, optimal for configuration monitoring"
*
* @param params Webhook refresh parameters
* @returns Promise<WebHookRefreshData> Direct refresh data without response wrapper
*/
get: (params: WebHookRefreshParams) => Promise<{
refreshed: boolean;
webhook_count: number;
active_webhooks: number;
inactive_webhooks: number;
refresh_timestamp: string;
configuration_status: "valid" | "invalid" | "partial";
errors?: string[] | undefined;
channels?: string[] | undefined;
}>;
};
};
export type WebHookResource = ReturnType<typeof createWebHookResource>;
export type WebHookDataResource = ReturnType<typeof createWebHookDataResource>;
export {};
//# sourceMappingURL=web-hook.d.ts.map