Event Details
'; $eventContent .= renderDataAsTable($data); $eventContent .= ''; } $eventTitleSafe = htmlspecialchars($eventTitle, ENT_QUOTES, 'UTF-8'); $emailTitle = "$eventIcon Webex Interact: $eventTitleSafe"; $emailStamp = "$dateSafe"; $body = <<
📋 Event Information
$eventContent HTML; $html = emailShell($emailTitle, $emailStamp, $body, "This Webex Interact webhook was automatically forwarded to your email address."); $subject = "$eventIcon Webex Interact: $eventTitle"; return [ 'html' => $html, 'subject' => $subject ]; } /** * Build content for Outbound SMS Submitted event */ function buildOutboundSmsSubmittedContent($data) { $messageId = htmlspecialchars($data['message_id'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $to = htmlspecialchars($data['to'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $from = htmlspecialchars($data['from'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $message = htmlspecialchars($data['message'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $submittedAt = htmlspecialchars($data['submitted_at'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $campaignId = htmlspecialchars($data['campaign_id'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); return <<
📤 SMS Details
💬 Message Content
$message
HTML; } /** * Build content for Outbound SMS Delivered event */ function buildOutboundSmsDeliveredContent($data) { $messageId = htmlspecialchars($data['message_id'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $to = htmlspecialchars($data['to'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $from = htmlspecialchars($data['from'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $deliveredAt = htmlspecialchars($data['delivered_at'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $campaignId = htmlspecialchars($data['campaign_id'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); return <<
✅ Delivery Details
HTML; } /** * Build content for Outbound SMS Failed event */ function buildOutboundSmsFailedContent($data) { $messageId = htmlspecialchars($data['message_id'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $to = htmlspecialchars($data['to'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $from = htmlspecialchars($data['from'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $failedAt = htmlspecialchars($data['failed_at'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $errorCode = htmlspecialchars($data['error_code'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $errorMessage = htmlspecialchars($data['error_message'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $campaignId = htmlspecialchars($data['campaign_id'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); return <<
❌ Failure Details
⚠️ Error Information
Error Code: $errorCode
Error Message: $errorMessage
HTML; } /** * Build content for Shortlink Clicked event */ function buildShortlinkClickedContent($data) { $shortlink = htmlspecialchars($data['shortlink'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $originalUrl = htmlspecialchars($data['original_url'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $clickedAt = htmlspecialchars($data['clicked_at'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $phoneNumber = htmlspecialchars($data['phone_number'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $messageId = htmlspecialchars($data['message_id'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $campaignId = htmlspecialchars($data['campaign_id'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $userAgent = htmlspecialchars($data['user_agent'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $ipAddress = htmlspecialchars($data['ip_address'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); return <<
🔗 Click Details
🌐 Browser Information
$userAgent
HTML; } /** * Build content for Inbound SMS Received event */ function buildInboundSmsContent($data) { $messageId = htmlspecialchars($data['message_id'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $from = htmlspecialchars($data['from'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $to = htmlspecialchars($data['to'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $message = htmlspecialchars($data['message'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $receivedAt = htmlspecialchars($data['received_at'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $keyword = htmlspecialchars($data['keyword'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); return <<
📥 Inbound SMS Details
💬 Message Content
$message
HTML; } /** * Build content for SMS Opt Out event */ function buildOptOutContent($data) { $phoneNumber = htmlspecialchars($data['phone_number'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $optOutAt = htmlspecialchars($data['opt_out_at'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $keyword = htmlspecialchars($data['keyword'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $messageId = htmlspecialchars($data['message_id'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $from = htmlspecialchars($data['from'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); return <<
🚫 Opt Out Details
HTML; } /** * Build content for Contacts Callback event */ function buildContactsCallbackContent($data) { $contactId = htmlspecialchars($data['contact_id'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $phoneNumber = htmlspecialchars($data['phone_number'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $firstName = htmlspecialchars($data['first_name'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $lastName = htmlspecialchars($data['last_name'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $email = htmlspecialchars($data['email'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $status = htmlspecialchars($data['status'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $createdAt = htmlspecialchars($data['created_at'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $updatedAt = htmlspecialchars($data['updated_at'] ?? 'N/A', ENT_QUOTES, 'UTF-8'); $customFieldsHtml = ''; if (isset($data['custom_fields']) && is_array($data['custom_fields']) && !empty($data['custom_fields'])) { $customFieldsHtml = '
🏷️ Custom Fields
'; foreach ($data['custom_fields'] as $key => $value) { $keySafe = htmlspecialchars($key, ENT_QUOTES, 'UTF-8'); $valueSafe = htmlspecialchars($value, ENT_QUOTES, 'UTF-8'); $customFieldsHtml .= <<
HTML; } $customFieldsHtml .= '
'; } return <<
👤 Contact Details
$customFieldsHtml HTML; }