send_test_notification($test_user_id); if ($notification_sent) { $notification_result = array('success' => true, 'message' => 'Test notification sent successfully!'); } else { $notification_result = array('success' => false, 'message' => 'Failed to send test notification. Check FCM configuration.'); } } // Save settings if (isset($_POST['twp_save_mobile_settings']) && check_admin_referer('twp_mobile_settings')) { update_option('twp_fcm_project_id', sanitize_text_field($_POST['twp_fcm_project_id'])); // Service account JSON — validate it parses as JSON before saving $sa_json_raw = isset($_POST['twp_fcm_service_account_json']) ? wp_unslash($_POST['twp_fcm_service_account_json']) : ''; if (!empty($sa_json_raw)) { $sa_parsed = json_decode($sa_json_raw, true); if ($sa_parsed && isset($sa_parsed['client_email'], $sa_parsed['private_key'])) { update_option('twp_fcm_service_account_json', $sa_json_raw); } else { $sa_json_error = 'Invalid service account JSON — must contain client_email and private_key fields.'; } } else { update_option('twp_fcm_service_account_json', ''); } $settings_saved = true; } // Get current settings $fcm_project_id = get_option('twp_fcm_project_id', ''); $fcm_service_account_json = get_option('twp_fcm_service_account_json', ''); $fcm_sa_configured = !empty($fcm_service_account_json) && !empty($fcm_project_id); // Get mobile app statistics global $wpdb; $sessions_table = $wpdb->prefix . 'twp_mobile_sessions'; $active_sessions = $wpdb->get_var("SELECT COUNT(*) FROM $sessions_table WHERE is_active = 1 AND expires_at > NOW()"); $total_sessions = $wpdb->get_var("SELECT COUNT(*) FROM $sessions_table"); ?>

Settings saved successfully!

Mobile App Overview

API Endpoint:
Active Sessions: active / total
Plugin Version:

Firebase Cloud Messaging (FCM) — HTTP v2 API

Configure FCM using a service account for push notifications. The legacy server key API has been retired by Google.

Found in Firebase Console > Project Settings > General > Project ID

Generate in Firebase Console > Project Settings > Service Accounts > Generate New Private Key. Paste the entire JSON file contents here. Must contain client_email and private_key fields.

✓ Service account configured

Send a test notification to your devices

API Endpoints

Available REST API endpoints for mobile app development:

Endpoint Method Description
/twilio-mobile/v1/auth/login POST Authenticate and get JWT tokens
/twilio-mobile/v1/auth/refresh POST Refresh access token
/twilio-mobile/v1/agent/status GET/POST Get or update agent status
/twilio-mobile/v1/queues/state GET Get all queue states
/twilio-mobile/v1/calls/{call_sid}/accept POST Accept a queued call
/twilio-mobile/v1/stream/events GET Server-Sent Events stream for real-time updates
/twilio-mobile/v1/voice/token GET Get Twilio Voice access token for VoIP

Authentication: All endpoints (except login/refresh) require Authorization: Bearer <access_token> header.

0): ?>

Active Mobile Sessions

get_results(" SELECT s.user_id, s.device_info, s.logged_in_at, s.last_used, u.user_login, u.display_name FROM $sessions_table s JOIN {$wpdb->users} u ON s.user_id = u.ID WHERE s.is_active = 1 AND s.expires_at > NOW() ORDER BY s.last_used DESC LIMIT 20 "); ?>
User Device Last Activity
display_name ?: $session->user_login); ?> device_info ?: 'Unknown device'); ?> last_used), current_time('timestamp')) . ' ago'); ?>