Skip to main content

Function: isWhatsAppConfigured()

isWhatsAppConfigured(messagingUtils?): Promise<boolean>

Defined in: auth/src/auth/shared.ts:273

Determines whether WhatsApp should currently be offered as a one-time code delivery channel. The OTP routes (BaseAuthDiscoverRoute, BaseAuthOTPRoute, BaseAuthMFARoute and BaseAuthElevationRoute) consult this before listing a WhatsApp option for a verified phone contact and before honoring a request for one, so WhatsApp is never offered on a server that can't deliver over it.

Resolved in order:

  1. The optional isWhatsAppConfigured(): boolean | Promise<boolean> hook on messagingUtils, when it defines one. It is called on every check (nothing is cached here) and its result is authoritative. A hook that throws is treated as false.
  2. Otherwise @rapidrest/core's own state: MessagingUtils keeps its validated whatsapp configuration in a private field named whatsapp, set once init() has accepted the whatsapp config block. That field being truthy means WhatsApp is configured.

Parameters​

messagingUtils?​

WhatsAppAwareMessagingUtils

The messaging service the routes send codes through. false when not provided.

Returns​

Promise<boolean>