Member Junction
    Preparing search index...

    Base class for communications. This class can be sub-classed if desired if you would like to modify the logic across ALL actions. To do so, sub-class this class and use the

    decorator from the @memberjunction/global package to register your sub-class with the ClassFactory. This will cause your sub-class to be used instead of this base class when the Metadata object insantiates the ActionEngine.

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    • get GlobalKey(): string

      Returns string

    Methods

    • Creates a draft message using the specified provider

      Parameters

      • message: Message

        The message to save as a draft

      • providerName: string

        Name of the provider to use

      • OptionalcontextUser: UserInfo

        Optional user context for server-side operations

      • Optionalcredentials: ProviderCredentialsBase

        Optional credentials override for this request. Provider-specific credential object (e.g., MSGraphCredentials). If not provided, uses environment variables. Set credentials.disableEnvironmentFallback = true to require explicit credentials.

      Returns Promise<CreateDraftResult>

      Promise - Result containing draft ID if successful

    • The Global Object Store is a place to store global objects that need to be shared across the application. Depending on the execution environment, this could be the window object in a browser, or the global object in a node environment, or something else in other contexts. The key here is that in some cases static variables are not truly shared because it is possible that a given class might have copies of its code in multiple paths in a deployed application. This approach ensures that no matter how many code copies might exist, there is only one instance of the object in question by using the Global Object Store.

      Returns GlobalObjectStore

    • Sends multiple messages using the specified provider. The provider must be one of the providers that are configured in the system.

      Parameters

      • providerName: string

        Name of the communication provider to use

      • providerMessageTypeName: string

        Type of message to send

      • message: Message

        Base message (To will be replaced with each recipient). Set message.DryRun = true for a DRY RUN: every per-recipient copy keeps the flag, so the full pipeline (run + per-message audit log lifecycle, template processing, provider payload construction) executes but no provider contacts its external service; each MessageResult comes back with DryRun: true and the Communication Log rows carry a DryRun: true marker in MessageContent.

      • recipients: MessageRecipient[]

        Array of recipients to send to

      • previewOnly: boolean = false

        If true, only preview without sending (stops BEFORE the provider and writes no Communication Log — see Message.DryRun for the deeper no-external-send rehearsal that still exercises provider + audit)

      • Optionalcredentials: ProviderCredentialsBase

        Optional credentials override for this request. Provider-specific credential object (e.g., SendGridCredentials). If not provided, uses environment variables. Set credentials.disableEnvironmentFallback = true to require explicit credentials.

      Returns Promise<MessageResult[]>

    • Sends a single message using the specified provider. The provider must be one of the providers that are configured in the system.

      Parameters

      • providerName: string

        Name of the communication provider to use

      • providerMessageTypeName: string

        Type of message to send

      • message: Message

        The message to send. Set message.DryRun = true for a DRY RUN: the message is processed, the Communication Log is written (marked DryRun: true in its MessageContent), and the provider constructs its full payload — but never contacts its external service; the returned MessageResult has DryRun: true.

      • Optionalrun: MJCommunicationRunEntity

        Optional communication run entity for logging

      • OptionalpreviewOnly: boolean

        If true, only preview without sending (stops BEFORE the provider and writes no Communication Log — see Message.DryRun for the deeper no-external-send rehearsal that still exercises provider + audit)

      • Optionalcredentials: ProviderCredentialsBase

        Optional credentials override for this request. Provider-specific credential object (e.g., SendGridCredentials). If not provided, uses environment variables. Set credentials.disableEnvironmentFallback = true to require explicit credentials.

      Returns Promise<MessageResult>

    • Returns the singleton instance of the class. If the instance does not exist, it is created and stored in the Global Object Store. If className is provided it will be used as part of the key in the Global Object Store, otherwise the actual class name will be used. NOTE: the class name used by default is the lowest level of the object hierarchy, so if you have a class that extends another class, the lowest level class name will be used.

      Type Parameters

      Parameters

      • this: new () => T
      • OptionalclassName: string

      Returns T