{
  "slug": "actions-userpilot-web",
  "name": "Userpilot Web (Actions)",
  "mode": "device",
  "authentication": {
    "scheme": "custom",
    "fields": {
      "token": {
        "label": "App Token",
        "description": "Your Userpilot app token, you can find it in the [Userpilot installation](https://run.userpilot.io/installation) dashboard.",
        "type": "password",
        "required": true,
        "multiple": false,
        "choices": null,
        "default": null,
        "depends_on": null
      },
      "endpoint": {
        "label": "The API endpoint the SDK would connect to",
        "description": "By default, Userpilot would use a service discovery mechanism to determine the API endpoint to connect to. If you are using a proxy or a firewall, you can specify the API endpoint here.",
        "type": "string",
        "required": false,
        "multiple": false,
        "choices": null,
        "default": null,
        "depends_on": null
      },
      "shouldSegmentLoadSDK": {
        "label": "Segment Loads Userpilot JS",
        "description": "By default, Segment will load the Userpilot JS snippet onto the page. If you are already loading the Userpilot JS onto the page then disable this setting and Segment will detect the Userpilot JS on the page",
        "type": "boolean",
        "required": true,
        "multiple": false,
        "choices": null,
        "default": true,
        "depends_on": null
      }
    }
  },
  "audienceConfig": null,
  "actions": {
    "identifyUser": {
      "title": "Identify User",
      "description": "Create or update a user entity in Userpilot. It's mandatory to identify a user by calling identify() prior to invoking other methods such as track(), page(), or group(). You can learn more by visiting the [Userpilot documentation](https://docs.userpilot.com/article/23-identify-users-track-custom-events).",
      "platform": "web",
      "defaultSubscription": "type = \"identify\"",
      "hidden": false,
      "hasPerformBatch": false,
      "syncMode": null,
      "hooks": null,
      "dynamicFields": null,
      "fields": {
        "userId": {
          "label": "User ID",
          "description": "The ID of the logged-in user.",
          "type": "string",
          "required": true,
          "multiple": false,
          "allowNull": false,
          "dynamic": false,
          "default": {
            "@if": {
              "exists": {
                "@path": "$.userId"
              },
              "then": {
                "@path": "$.userId"
              },
              "else": {
                "@path": "$.anonymousId"
              }
            }
          },
          "choices": null,
          "placeholder": null,
          "properties": null,
          "category": null,
          "depends_on": null,
          "readOnly": null,
          "hidden": null,
          "minimum": null,
          "maximum": null,
          "defaultObjectUI": null,
          "disabledInputMethods": null,
          "displayMode": null,
          "format": null,
          "additionalProperties": false
        },
        "createdAt": {
          "label": "User Created At Date",
          "description": "The date the user profile was created at",
          "type": "datetime",
          "required": false,
          "multiple": false,
          "allowNull": false,
          "dynamic": false,
          "default": {
            "@path": "$.traits.createdAt"
          },
          "choices": null,
          "placeholder": null,
          "properties": null,
          "category": null,
          "depends_on": null,
          "readOnly": null,
          "hidden": null,
          "minimum": null,
          "maximum": null,
          "defaultObjectUI": null,
          "disabledInputMethods": null,
          "displayMode": null,
          "format": null,
          "additionalProperties": false
        },
        "traits": {
          "label": "Traits",
          "description": "User traits.",
          "type": "object",
          "required": false,
          "multiple": false,
          "allowNull": false,
          "dynamic": false,
          "default": {
            "@path": "$.traits"
          },
          "choices": null,
          "placeholder": null,
          "properties": null,
          "category": null,
          "depends_on": null,
          "readOnly": null,
          "hidden": null,
          "minimum": null,
          "maximum": null,
          "defaultObjectUI": null,
          "disabledInputMethods": null,
          "displayMode": null,
          "format": null,
          "additionalProperties": false
        }
      }
    },
    "trackEvent": {
      "title": "Track Event",
      "description": "Send an event to Userpilot. It's mandatory to identify a user by calling identify() prior to invoking other methods such as track(). You can learn more by visiting the [Userpilot documentation](https://docs.userpilot.com/article/23-identify-users-track-custom-events).",
      "platform": "web",
      "defaultSubscription": "type = \"track\"",
      "hidden": false,
      "hasPerformBatch": false,
      "syncMode": null,
      "hooks": null,
      "dynamicFields": null,
      "fields": {
        "name": {
          "label": "Name",
          "description": "Event name",
          "type": "string",
          "required": true,
          "multiple": false,
          "allowNull": false,
          "dynamic": false,
          "default": {
            "@path": "$.event"
          },
          "choices": null,
          "placeholder": null,
          "properties": null,
          "category": null,
          "depends_on": null,
          "readOnly": null,
          "hidden": null,
          "minimum": null,
          "maximum": null,
          "defaultObjectUI": null,
          "disabledInputMethods": null,
          "displayMode": null,
          "format": null,
          "additionalProperties": false
        },
        "properties": {
          "label": "Properties",
          "description": "Event properties",
          "type": "object",
          "required": false,
          "multiple": false,
          "allowNull": false,
          "dynamic": false,
          "default": {
            "@path": "$.properties"
          },
          "choices": null,
          "placeholder": null,
          "properties": null,
          "category": null,
          "depends_on": null,
          "readOnly": null,
          "hidden": null,
          "minimum": null,
          "maximum": null,
          "defaultObjectUI": null,
          "disabledInputMethods": null,
          "displayMode": null,
          "format": null,
          "additionalProperties": false
        }
      }
    },
    "pageView": {
      "title": "Page View",
      "description": "Update the content queue designed to trigger on a specific page. It's mandatory to identify a user by calling identify() prior to invoking other methods such as page()",
      "platform": "web",
      "defaultSubscription": "type = \"page\"",
      "hidden": false,
      "hasPerformBatch": false,
      "syncMode": null,
      "hooks": null,
      "dynamicFields": null,
      "fields": {
        "name": {
          "label": "Page Name",
          "description": "The name of the page that was viewed.",
          "type": "string",
          "required": false,
          "multiple": false,
          "allowNull": false,
          "dynamic": false,
          "default": {
            "@path": "$.name"
          },
          "choices": null,
          "placeholder": null,
          "properties": null,
          "category": null,
          "depends_on": null,
          "readOnly": null,
          "hidden": null,
          "minimum": null,
          "maximum": null,
          "defaultObjectUI": null,
          "disabledInputMethods": null,
          "displayMode": null,
          "format": null,
          "additionalProperties": false
        },
        "properties": {
          "label": "Properties",
          "description": "The properties of the page that was viewed.",
          "type": "object",
          "required": false,
          "multiple": false,
          "allowNull": false,
          "dynamic": false,
          "default": {
            "@path": "$.properties"
          },
          "choices": null,
          "placeholder": null,
          "properties": null,
          "category": null,
          "depends_on": null,
          "readOnly": null,
          "hidden": null,
          "minimum": null,
          "maximum": null,
          "defaultObjectUI": null,
          "disabledInputMethods": null,
          "displayMode": null,
          "format": null,
          "additionalProperties": false
        }
      }
    },
    "identifyCompany": {
      "title": "Identify Company",
      "description": "Create or update a company entity in Userpilot",
      "platform": "web",
      "defaultSubscription": "type = \"group\"",
      "hidden": false,
      "hasPerformBatch": false,
      "syncMode": null,
      "hooks": null,
      "dynamicFields": null,
      "fields": {
        "groupId": {
          "label": "Company ID",
          "description": "The ID of the company.",
          "type": "string",
          "required": true,
          "multiple": false,
          "allowNull": false,
          "dynamic": false,
          "default": {
            "@path": "$.groupId"
          },
          "choices": null,
          "placeholder": null,
          "properties": null,
          "category": null,
          "depends_on": null,
          "readOnly": null,
          "hidden": null,
          "minimum": null,
          "maximum": null,
          "defaultObjectUI": null,
          "disabledInputMethods": null,
          "displayMode": null,
          "format": null,
          "additionalProperties": false
        },
        "traits": {
          "label": "Traits",
          "description": "Company traits",
          "type": "object",
          "required": false,
          "multiple": false,
          "allowNull": false,
          "dynamic": false,
          "default": {
            "@path": "$.traits"
          },
          "choices": null,
          "placeholder": null,
          "properties": null,
          "category": null,
          "depends_on": null,
          "readOnly": null,
          "hidden": null,
          "minimum": null,
          "maximum": null,
          "defaultObjectUI": null,
          "disabledInputMethods": null,
          "displayMode": null,
          "format": null,
          "additionalProperties": false
        }
      }
    }
  },
  "presets": [
    {
      "name": "Identify User",
      "type": "automatic",
      "partnerAction": "identifyUser",
      "subscribe": "type = \"identify\"",
      "mapping": {
        "userId": {
          "@if": {
            "exists": {
              "@path": "$.userId"
            },
            "then": {
              "@path": "$.userId"
            },
            "else": {
              "@path": "$.anonymousId"
            }
          }
        },
        "createdAt": {
          "@path": "$.traits.createdAt"
        },
        "traits": {
          "@path": "$.traits"
        }
      },
      "eventSlug": null
    },
    {
      "name": "Identify Company",
      "type": "automatic",
      "partnerAction": "identifyCompany",
      "subscribe": "type = \"group\"",
      "mapping": {
        "groupId": {
          "@path": "$.groupId"
        },
        "traits": {
          "@path": "$.traits"
        }
      },
      "eventSlug": null
    },
    {
      "name": "Track Event",
      "type": "automatic",
      "partnerAction": "trackEvent",
      "subscribe": "type = \"track\"",
      "mapping": {
        "name": {
          "@path": "$.event"
        },
        "properties": {
          "@path": "$.properties"
        }
      },
      "eventSlug": null
    },
    {
      "name": "Page View",
      "type": "automatic",
      "partnerAction": "pageView",
      "subscribe": "type = \"page\"",
      "mapping": {
        "name": {
          "@path": "$.name"
        },
        "properties": {
          "@path": "$.properties"
        }
      },
      "eventSlug": null
    }
  ]
}
