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.5 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { talkableAuth } from '../../..';
import { TALKABLE_API_URL } from '../../common/constants';

export const anonymizePerson = createAction({
  name: 'anonymize_person', // Must be a unique across the piece, this shouldn't be changed.
  classification: 'DESTRUCTIVE',
  auth: talkableAuth,
  displayName: 'Anonymize person',
  description: 'Anonymize person by email',
  audience: 'both',
  aiMetadata: { description: 'Permanently anonymize a Talkable person\'s personal data, identified by email, for privacy/GDPR-style erasure requests. Use only when a customer\'s identifying information must be scrubbed. Destructive and irreversible; repeating leaves the record anonymized (no further effect). The email is required.', idempotent: true },
  props: {
    email: Property.ShortText({
      displayName: 'Person email',
      description: undefined,
      required: true,
    }),
  },
  async run(context) {
    const { site, api_key } = context.auth.props;
    const personAnonymizeResponse = await httpClient
      .sendRequest<string[]>({
        method: HttpMethod.POST,
        url: `${TALKABLE_API_URL}/people/${context.propsValue['email']}/anonymize`,
        headers: {
          Authorization: `Bearer ${api_key}`,
          'Content-Type': 'application/json',
        },
        body: {
          site_slug: site,
        },
      });
    return personAnonymizeResponse.body;
  },
});