manual_check_for_updates(); } // Handle test notification if (isset($_POST['twp_test_notification']) && check_admin_referer('twp_mobile_settings')) { require_once TWP_PLUGIN_DIR . 'includes/class-twp-fcm.php'; $fcm = new TWP_FCM(); $test_user_id = get_current_user_id(); $notification_sent = $fcm->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_server_key', sanitize_text_field($_POST['twp_fcm_server_key'])); update_option('twp_auto_update_enabled', isset($_POST['twp_auto_update_enabled']) ? '1' : '0'); update_option('twp_gitea_repo', sanitize_text_field($_POST['twp_gitea_repo'])); update_option('twp_gitea_token', sanitize_text_field($_POST['twp_gitea_token'])); update_option('twp_twilio_api_key_sid', sanitize_text_field($_POST['twp_twilio_api_key_sid'])); update_option('twp_twilio_api_key_secret', sanitize_text_field($_POST['twp_twilio_api_key_secret'])); update_option('twp_fcm_push_credential_sid', sanitize_text_field($_POST['twp_fcm_push_credential_sid'])); $settings_saved = true; } // Get current settings $fcm_server_key = get_option('twp_fcm_server_key', ''); $auto_update_enabled = get_option('twp_auto_update_enabled', '1') === '1'; $gitea_repo = get_option('twp_gitea_repo', 'wp-plugins/twilio-wp-plugin'); $gitea_token = get_option('twp_gitea_token', ''); $twilio_api_key_sid = get_option('twp_twilio_api_key_sid', ''); $twilio_api_key_secret = get_option('twp_twilio_api_key_secret', ''); $fcm_push_credential_sid = get_option('twp_fcm_push_credential_sid', ''); // Get update status require_once TWP_PLUGIN_DIR . 'includes/class-twp-auto-updater.php'; $updater = new TWP_Auto_Updater(); $update_status = $updater->get_update_status(); // 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)

Configure FCM to enable push notifications for the mobile app.

Get your server key from Firebase Console > Project Settings > Cloud Messaging > Server Key

Create an API Key in Twilio Console > Account > API Keys. Required for mobile VoIP tokens.

The secret associated with the API Key SID above. Shown only once when key is created.

Twilio Push Credential SID. Create in Twilio Console > Messaging > Push Credentials using your FCM server key. Required for incoming call push notifications.

Send a test notification to your devices

Automatic Updates

Current Version ⚠ Update available: ✓ Up to date

Format: organization/repository (e.g., wp-plugins/twilio-wp-plugin)

Optional. Required only for private repositories. Create token at: Gitea Settings > Applications

Last Update Check 0) { echo esc_html(human_time_diff($last_check, current_time('timestamp')) . ' ago'); } else { echo 'Never'; } ?>

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'); ?>