// === Register All REST API Routes === add_action('rest_api_init', function () { $routes = [ ['chat', ['GET', 'POST'], 'grobot_chat'], ['login', 'POST', 'grobot_login'], ['signup', 'POST', 'grobot_signup'], ['product-info', 'POST', 'grobot_get_product_info'], ['order', 'POST', 'grobot_place_order'], ['user-info', 'GET', 'grobot_get_user_info'], ['orders', 'GET', 'grobot_get_orders'], ['cancel-order', 'POST', 'grobot_cancel_order'], ['support', 'POST', 'grobot_support_ticket'], ['update-address', 'POST', 'grobot_update_address', true], ['cart/add', 'POST', 'grobot_cart_add'], ['cart', 'GET', 'grobot_cart_view'], ['cart/empty', 'POST', 'grobot_cart_empty'], ['invoice', 'GET', 'grobot_invoice_download', true], ['store-token', 'POST', 'grobot_store_device_token'], ['push', 'POST', 'grobot_send_push_notification', true], ]; foreach ($routes as $r) { register_rest_route('grobot/v1', '/' . $r[0], [ 'methods' => $r[1], 'callback' => $r[2], 'permission_callback' => $r[3] ?? '__return_true' ]); } }); // === grobot Chat Endpoint === function grobot_chat($request) { if ($request->get_method() === 'GET') { return grobot_response('info', '🤖 This is the grobot chat endpoint. Use POST with {"message": "...", "session_id": "..."} to talk to the assistant.'); } $input = sanitize_text_field($request->get_param('message')); $session_id = sanitize_text_field($request->get_param('session_id')); if (empty($input)) { return grobot_response('error', '❌ Empty message.'); } $api_key = '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'; $system_prompt = << 'meta-llama/llama-3-70b-instruct', 'messages' => [ ['role' => 'system', 'content' => $system_prompt], ['role' => 'user', 'content' => $input] ] ]); $response = wp_remote_post('https://openrouter.ai/api/v1/chat/completions', [ 'headers' => [ 'Authorization' => 'Bearer ' . $api_key, 'Content-Type' => 'application/json', 'HTTP-Referer' => 'https://grohunt.com', 'X-Title' => 'grobot-ecommerce-chat' ], 'body' => $body, 'timeout' => 20 ]); if (is_wp_error($response)) { return grobot_response('error', '⚠️ Network error: ' . $response->get_error_message()); } $json = json_decode(wp_remote_retrieve_body($response), true); $reply = $json['choices'][0]['message']['content'] ?? null; if (!$reply) { return grobot_response('error', '🤖 No reply received from model.'); } $reply = grobot_normalize_text($reply); grobot_log_transcript($session_id, $input, $reply); grobot_maybe_send_push($reply); return grobot_response('success', '✅ AI replied', ['reply' => $reply]); } // === Log Chat Transcripts === function grobot_log_transcript($session_id, $query, $reply) { global $wpdb; $table = $wpdb->prefix . 'grobot_transcripts'; $wpdb->insert($table, [ 'session_id' => sanitize_text_field($session_id), 'query' => grobot_normalize_text($query), 'reply' => grobot_normalize_text($reply), 'timestamp' => current_time('mysql') ]); } // === Send Push If Order === function grobot_maybe_send_push($reply) { if (stripos($reply, 'order confirmed') !== false) { $user = wp_get_current_user(); if ($user && $user->ID) { $token = get_user_meta($user->ID, 'grobot_device_token', true); if ($token) { grobot_send_push_notification($token, 'Order Placed', 'Your order has been placed successfully.'); } } } } // === Push Notification Logic === function grobot_send_push_notification($token, $title, $body) { $serverKey = 'YOUR-FIREBASE-SERVER-KEY'; // 🔁 Replace this $url = 'https://fcm.googleapis.com/fcm/send'; $payload = json_encode([ 'to' => $token, 'notification' => [ 'title' => grobot_normalize_text($title), 'body' => grobot_normalize_text($body), ] ]); $headers = [ 'Authorization: key=' . $serverKey, 'Content-Type: application/json', ]; $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT_HTTPHEADER => $headers, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => $payload ]); curl_exec($ch); curl_close($ch); } // === Store Firebase Device Token === function grobot_store_device_token($request) { $user_id = get_current_user_id(); $token = sanitize_text_field($request->get_param('token')); if ($user_id && $token) { update_user_meta($user_id, 'grobot_device_token', $token); return grobot_response('success', 'Token saved'); } return grobot_response('error', 'Missing user or token'); } // === Helper Response Format === function grobot_response($status, $message, $data = []) { return new WP_REST_Response([ 'status' => $status, 'message' => grobot_normalize_text($message), 'data' => $data ], $status === 'success' ? 200 : 400); } // === Normalize Branding === function grobot_normalize_text($text) { return str_ireplace(['Grobot', 'GroHunt.com', 'Grohunt.com'], ['grobot', 'grohunt.com', 'grohunt.com'], $text); } Salt(Namak)
Previous
Previous Product Image

Chini (Shakar, Sugar)

10.0080.00
Next

Black Salt(Kala Namak)

Original price was: ₹50.00.Current price is: ₹30.00.
Next Product Image

Salt(Namak)

20.0040.00

Grohunt White Salt – Pure, Fine & Iodized! 🧂 Perfect for daily cooking & balanced health. Order now for everyday essentials! 🚀

Add to Wishlist
Add to Wishlist
SKU: N/A Category: Tags: , , ,

Description

Grohunt Premium White Salt (Namak) – Pure & Essential! 🧂✨

Experience the natural purity and fine texture of Grohunt White Salt, a kitchen essential for everyday cooking. Perfectly refined and iodized, it enhances the flavor of your meals while supporting good health.

100% Pure & Hygienic – No impurities, just fine-quality salt
Iodized for Health – Helps maintain thyroid function
Fine & Free-Flowing – Easy to mix in all dishes

Order now from Grohunt for premium quality salt! 🍛🧂

Additional information

Weights

1kg, 500g

Reviews

There are no reviews yet.

Be the first to review “Salt(Namak)”

Your email address will not be published. Required fields are marked *

Shopping cart

1

Subtotal: 90.00

View cartCheckout