(* Simple Bot Example using core Zulip library *) let () = Eio_main.run @@ fun env -> Eio.Switch.run @@ fun sw -> Printf.printf "OCaml Zulip Bot Example\n"; Printf.printf "=======================\n\n"; (* Create test authentication *) let auth = Zulip.Auth.create ~server_url:"https://example.zulipchat.com" ~email:"bot@example.com" ~api_key:"example-api-key" in Printf.printf "✅ Created authentication for: %s\n" (Zulip.Auth.email auth); Printf.printf "✅ Server URL: %s\n" (Zulip.Auth.server_url auth); (* Create client *) let client = Zulip.Client.create ~sw env auth in let client_str = Format.asprintf "%a" Zulip.Client.pp client in Printf.printf "✅ Created client: %s\n" client_str; (* Test message creation *) let message = Zulip.Message.create ~type_:`Channel ~to_:["general"] ~content:"Hello from OCaml bot!" ~topic:"Bot Testing" () in Printf.printf "✅ Created message to: %s\n" (String.concat ", " (Zulip.Message.to_ message)); Printf.printf "✅ Message content: %s\n" (Zulip.Message.content message); Printf.printf "✅ Message topic: %s\n" (match Zulip.Message.topic message with Some t -> t | None -> "none"); (* Test API call (mock) *) (match Zulip.Client.request client ~method_:`GET ~path:"/users/me" () with | Ok response -> Printf.printf "✅ API request successful: %s\n" (match response with | `O fields -> String.concat ", " (List.map fst fields) | _ -> "unknown format") | Error err -> Printf.printf "❌ API request failed: %s\n" (Zulip.error_message err)); Printf.printf "\n🎉 Bot example completed successfully!\n"; Printf.printf "Note: This uses mock responses since we're not connected to a real Zulip server.\n"