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

export const getUserSessionAction = createAction({
  name: 'get_user_session',
  classification: 'READ',
  displayName: 'Get User Session',
  description: 'Get details about a specific user session',
  audience: 'both',
  aiMetadata: { description: 'Look up details of a specific Zoo user session by its session token. Read-only and repeatable. Requires the session token of the session you want to inspect.', idempotent: true },
  auth: zooAuth,
  // category: 'Users',
  props: {
    token: Property.ShortText({
      displayName: 'Session Token',
      required: true,
      description: 'The token of the session to retrieve',
    }),
  },
  async run({ auth, propsValue }) {
    const response = await httpClient.sendRequest({
      method: HttpMethod.GET,
      url: `https://api.zoo.dev/user/session/${propsValue.token}`,
      headers: {
        Authorization: `Bearer ${auth.secret_text}`,
      },
    });
    return response.body;
  },
});