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.2 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { timelinesAiAuth, timelinesAiCommon } from '../common';

export const findMessageStatus = createAction({
  auth: timelinesAiAuth,
  name: 'findMessageStatus',
  classification: 'READ',
  displayName: 'Find Message Status',
  description: 'Lookup a message’s delivery status by message ID.',
  audience: 'both',
  aiMetadata: { description: 'Returns the delivery status of a TimelinesAI WhatsApp message identified by its message UID. Use to check whether a previously sent message was delivered or read. Requires the exact message_uid. Read-only and idempotent.', idempotent: true },
  props: {
    message_uid: Property.ShortText({
      displayName: 'Message UID',
      description: 'The unique identifier of the message to look up.',
      required: true,
    }),
  },
  async run({ auth: apiKey, propsValue: { message_uid } }) {
    const response = await timelinesAiCommon.getMessage({
      apiKey,
      message_uid,
    });
    if (response.status !== 'ok') {
      throw new Error(
        `Error fetching message: ${response.message || 'Unknown error'}`
      );
    }
    return response.data.status;
  },
});