Member Junction
    Preparing search index...

    Action to create a new SurveyMonkey survey programmatically

    Security: Uses secure credential lookup via CompanyID instead of accepting tokens directly.

    await runAction({
    ActionName: 'Create SurveyMonkey',
    Params: [{
    Name: 'CompanyID',
    Value: 'your-company-id'
    }, {
    Name: 'Title',
    Value: 'Customer Satisfaction Survey'
    }, {
    Name: 'Pages',
    Value: [{
    title: 'Page 1',
    questions: [{
    family: 'single_choice',
    subtype: 'vertical',
    heading: 'How satisfied are you with our service?',
    answers: {
    choices: [
    { text: 'Very Satisfied' },
    { text: 'Satisfied' },
    { text: 'Neutral' },
    { text: 'Dissatisfied' }
    ]
    }
    }]
    }]
    }, {
    Name: 'Language',
    Value: 'en'
    }]
    });

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    AuthorizesCaller: boolean

    True when the action authorizes its caller itself, so a public entry point such as the RunAction mutation may run it for an authenticated user without an MJ: Action Authorizations link. Set it only on an action that either checks an authorization the caller must hold, or reads and writes only with the caller's own permissions. Leave it false for an action that acts with more authority than its caller, or that reaches data or sends messages the caller chooses but could not otherwise reach.

    The engine reads the marker only from the class that runs, never from its parent classes. A subclass that overrides a marked action must declare the marker again.

    Accessors

    Methods

    • Get all responses with automatic pagination

      Parameters

      • surveyId: string
      • accessToken: string
      • Optionaloptions: {
            end_created_at?: string;
            end_modified_at?: string;
            maxResponses?: number;
            sort_by?: "date_modified" | "date_created";
            sort_order?: "ASC" | "DESC";
            start_created_at?: string;
            start_modified_at?: string;
            status?: "completed" | "partial" | "overquota" | "disqualified";
        }

      Returns Promise<SurveyMonkeyResponse[]>

    • Gets credentials from environment variables Format: BIZAPPS_{PROVIDER}{COMPANY_ID}{CREDENTIAL_TYPE} Example: BIZAPPS_TYPEFORM_12345_API_TOKEN

      Falls back to: BIZAPPS_{PROVIDER}_{CREDENTIAL_TYPE} if no company-specific credential found Example fallback: BIZAPPS_TYPEFORM_API_TOKEN

      Parameters

      • companyId: string
      • credentialType: string

      Returns string

    • Helper to securely retrieve API token for a company. This method should be used by all form builder actions instead of accepting tokens as parameters.

      Parameters

      • companyId: string

        The MemberJunction company ID (required)

      • contextUser: UserInfo

        The user context for database queries

      Returns Promise<string>

      The API token for the specified company

      Error if no credentials are found or company integration is not configured

    • Get responses from a SurveyMonkey survey

      Parameters

      • surveyId: string
      • accessToken: string
      • Optionaloptions: {
            end_created_at?: string;
            end_modified_at?: string;
            page?: number;
            per_page?: number;
            sort_by?: "date_modified" | "date_created";
            sort_order?: "ASC" | "DESC";
            start_created_at?: string;
            start_modified_at?: string;
            status?: "completed" | "partial" | "overquota" | "disqualified";
        }

      Returns Promise<SurveyMonkeyResponsesResult>

    • Update survey details

      Parameters

      • surveyId: string
      • accessToken: string
      • updateData: {
            buttons_text?: {
                done_button?: string;
                exit_button?: string;
                next_button?: string;
                prev_button?: string;
            };
            custom_variables?: Record<string, string>;
            language?: string;
            nickname?: string;
            title?: string;
        }

      Returns Promise<SurveyMonkeySurveyDetails>