$config['key'], 'camera_secret' => isset( $config['camera_secret'] ) ? $config['camera_secret'] : '', 'source' => 'wp_camera', 'host' => $config['host'], 'event_id' => $row['event_id'], 'path' => $row['path'], 'agent_id' => $row['agent_id'], 'operator' => $row['operator'], 'agent_purpose' => $row['agent_purpose'], 'class' => $verdict['event_class'], 'verification_method' => $verdict['verification_method'], 'verification_result' => $verdict['verification_result'], 'ip_prefix_or_hash' => $config['ip_prefix_or_hash'], 'directory_version' => $config['directory_version'], ); } /** * POST a built payload to the ingest endpoint. * * @param array $payload Payload from build_payload(). * @param string $endpoint_base Base URL of the AI Mention service. * @return bool True on 2xx (accepted / duplicate / ignored). */ public static function send( array $payload, $endpoint_base ) { $url = rtrim( $endpoint_base, '/' ) . '/api/visibility/ingest/'; $resp = wp_remote_post( $url, array( 'timeout' => 15, 'headers' => array( 'Content-Type' => 'application/json' ), 'body' => wp_json_encode( $payload ), ) ); if ( is_wp_error( $resp ) ) { return false; } $code = (int) wp_remote_retrieve_response_code( $resp ); // 202 accepted, 200 duplicate/ignored -> all "handled, drop the row". return $code >= 200 && $code < 300; } }