How to manually start a wordflow in Temporal.io from an external app

Hi team, I am using Temporal Cloud. Currently, my workflow is a scheduled cron job. However, I also need to add functionality to manually trigger the workflow from another Java application.

I was looking at this example, but in my Java application, I don’t have the Workflow Class. WorkflowClient - temporal-sdk 1.23.0 javadoc

I also found this example. I do have a workflowId, but I have both a dev and prod environment, each using different namespaces but the same workflowId. So, where do I configure the namespace? Otherwise, how does it know to trigger the workflow in the right namespace? Or am I missing anything? samples-java/core/src/main/java/io/temporal/samples/common/QueryWorkflowExecution.java at main · temporalio/samples-java · GitHub

Thanks in advance

I was looking at this example, but in my Java application, I don’t have the Workflow Class. WorkflowClient - temporal-sdk 1.23.0 javadoc

You can use an untyped workflow stub to start the workflow by its string type name.

WorkflowExecution execution = client.newUntypedWorkflowStub("MyWorkflow", options).start(arg1, ...);

Use WorkflowClientOptions.namespace.

    WorkflowClient client =
        WorkflowClient.newInstance(
            service, WorkflowClientOptions.newBuilder().setNamespace(namespace).build());