If someone believes that a friend is immediately going to attempt suicide, the most appropriate and urgent response is to:
Call 911
or the local emergency services. It's critical to get professional help immediately.
Other options, such as making an appointment with a healthcare provider or calling a trusted friend for advice, are not sufficient in an immediate crisis situation. Keeping it a secret is never advisable, as it can have dire consequences.
In addition, if it's safe to do so, try to stay with the person and talk to them until help arrives, providing support and reassurance.