Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

1.4 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { veroAuth } from '../common/auth';
import { makeRequest } from '../common/client';
import { HttpMethod } from '@activepieces/pieces-common';

export const aliasAUser = createAction({
  auth: veroAuth,
  name: 'aliasAUser',
  displayName: 'Alias a User',
  description:
    "Change a user's identifier by merging two user identities into one",
  audience: 'both',
  aiMetadata: {
    description:
      "Re-identifies a Vero user by remapping an existing record from an old user ID to a new user ID, merging the two identities. Use when a user's stable identifier has changed and their history must be preserved under the new ID. Both the old and new IDs are required; re-running with the same pair is effectively idempotent.",
    idempotent: true,
  },
  props: {
    id: Property.ShortText({
      displayName: 'Old User ID',
      description: 'The old unique identifier of the user',
      required: true,
    }),
    new_id: Property.ShortText({
      displayName: 'New User ID',
      description: 'The new unique identifier of the user',
      required: true,
    }),
  },
  async run(context) {
    const { id, new_id } = context.propsValue;

    const response = await makeRequest(
      context.auth.secret_text,
      HttpMethod.PUT,
      '/users/reidentify',
      {
        id,
        new_id,
      }
    );

    return response;
  },
});