> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apten.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Power Automate

> Connect Apten to Microsoft Power Automate to automate lead engagement workflows

## Overview

The Apten Power Automate connector enables you to automate lead engagement workflows directly from Microsoft Power Automate. You can create leads, send messages, and manage lead status without leaving the Power Platform.

Use cases include:

* Automatically create leads in Apten when new contacts appear in SharePoint, Dynamics 365, or other systems
* Send follow-up messages based on triggers from your CRM or email
* Sync lead status between Apten and your other business applications

## Prerequisites

Before getting started, ensure you have:

1. **Power Automate account with Premium license** - Custom connectors require a Power Automate Premium license (\$15/user/month) or a Per Flow license
2. **Apten account with API access** - Contact your Apten account manager if you need API access enabled
3. **Apten API key** - See the next section for how to obtain one

## Getting Your API Key

To use the Apten connector, you need an API key from your Apten dashboard:

1. Log in to your Apten dashboard at [platform.attent.app](https://platform.attent.app)
2. Navigate to **Developer Portal** in the left sidebar
3. Under "Generate New API Key", give your key a descriptive name (e.g., "Power Automate Integration")
4. Click "Request API Key"
5. Copy the generated API key

<Warning>
  Keep your API key confidential. Do not share it or commit it to version control.
</Warning>

## Importing the Connector

<Steps>
  <Step title="Download the solution">
    Download the Apten connector solution:

    * [Apten\_1\_0\_1\_0\_managed.zip](https://d2i88m1a7sfaw.cloudfront.net/Apten_1_0_1_0_managed.zip)
  </Step>

  <Step title="Open Power Automate">
    Go to [make.powerautomate.com](https://make.powerautomate.com)
  </Step>

  <Step title="Navigate to Solutions">
    In the left navigation, click **Solutions**
  </Step>

  <Step title="Import the solution">
    Click **Import solution** in the top bar
  </Step>

  <Step title="Upload the file">
    Click **Browse**, select the downloaded `Apten_1_0_1_0_managed.zip` file, and click **Next**
  </Step>

  <Step title="Complete the import">
    Review the solution details and click **Import**
  </Step>
</Steps>

The Apten connector is now available in your environment.

## Creating a Connection

Before using the connector in a flow, you need to create a connection with your API key:

1. In Power Automate, go to **Data** > **Connections**
2. Click **+ New connection**
3. Search for "Apten" and select the Apten connector
4. Enter your API key when prompted
5. Click **Create**

You can now use the Apten connector in your flows.

## Available Actions

The Apten connector provides 20 actions organized into four categories.

### Lead Management

<AccordionGroup>
  <Accordion title="Create Lead">
    Creates a new lead in Apten with the specified contact information.

    * **Required:** Customer Profile, First Name, Phone
    * **Optional:** Last Name, Email, Timezone, Additional Info
    * **Returns:** Lead ID
  </Accordion>

  <Accordion title="Get Lead">
    Retrieves details about an existing lead.

    * **Required:** Lead ID
    * **Returns:** Lead details (name, phone, email, status, tags, etc.)
  </Accordion>

  <Accordion title="Update Lead">
    Updates an existing lead's information.

    * **Required:** Lead ID
    * **Optional:** Email, Timezone, Additional Info, Follow-up Config, Follow-up Step
    * **Returns:** Confirmation
  </Accordion>

  <Accordion title="Delete Lead">
    Permanently deletes a lead.

    * **Required:** Lead ID
    * **Returns:** Confirmation
  </Accordion>

  <Accordion title="Lead Lookup">
    Finds a lead by their phone number.

    * **Required:** Phone
    * **Returns:** Lead ID if found
  </Accordion>

  <Accordion title="Resubscribe Lead">
    Resubscribes a lead who previously opted out, allowing messages to be sent again.

    * **Required:** Lead ID
    * **Returns:** Confirmation
  </Accordion>
</AccordionGroup>

### Messaging & Engagement

<AccordionGroup>
  <Accordion title="Send Message">
    Sends a message to a lead via SMS.

    * **Required:** Lead ID, Message
    * **Optional:** Scheduled Time, Send When Off, Override Business Hours
    * **Returns:** Confirmation
  </Accordion>

  <Accordion title="Get Messages">
    Retrieves the message history for a lead.

    * **Required:** Lead ID
    * **Returns:** Array of messages with content, timestamp, and sender
  </Accordion>

  <Accordion title="Turn On Lead">
    Enables AI-powered messaging for a lead.

    * **Required:** Lead ID
    * **Returns:** Confirmation
  </Accordion>

  <Accordion title="Turn Off Lead">
    Disables AI-powered messaging for a lead.

    * **Required:** Lead ID
    * **Returns:** Confirmation
  </Accordion>

  <Accordion title="Add Context">
    Adds contextual information to help the AI better engage with the lead.

    * **Required:** Lead ID, Context
    * **Returns:** Confirmation
  </Accordion>

  <Accordion title="Add Event">
    Records an event that occurred for the lead (e.g., "clicked email link").

    * **Required:** Lead ID, Event
    * **Returns:** Confirmation
  </Accordion>

  <Accordion title="Switch Customer Profile">
    Changes the customer profile (campaign/persona) for a lead.

    * **Required:** Lead ID, New Customer Profile
    * **Optional:** Resend First Touch, Reset Follow-up
    * **Returns:** Confirmation
  </Accordion>
</AccordionGroup>

### Tags

<AccordionGroup>
  <Accordion title="Get Organization Tags">
    Retrieves all tags available in your organization.

    * **Returns:** Array of tags with name and color
  </Accordion>

  <Accordion title="Add Tags">
    Adds tags to a lead.

    * **Required:** Lead ID, Tags (array)
    * **Returns:** Updated tag list
  </Accordion>

  <Accordion title="Replace Tags">
    Replaces all tags on a lead with a new set.

    * **Required:** Lead ID, Tags (array)
    * **Returns:** Updated tag list
  </Accordion>

  <Accordion title="Remove Tags">
    Removes specific tags from a lead.

    * **Required:** Lead ID, Tags (array)
    * **Returns:** Updated tag list
  </Accordion>
</AccordionGroup>

### Do Not Contact (DNC)

<AccordionGroup>
  <Accordion title="Register DNC">
    Adds a phone number to the Do Not Contact list.

    * **Required:** Phone Number
    * **Returns:** Confirmation
  </Accordion>

  <Accordion title="Get DNC">
    Checks if a phone number is on the DNC list.

    * **Required:** Phone Number
    * **Returns:** DNC status and date added (if on list)
  </Accordion>

  <Accordion title="Delete DNC">
    Removes a phone number from the DNC list.

    * **Required:** Phone Number
    * **Returns:** Confirmation
  </Accordion>
</AccordionGroup>

## Example Flow

Here is a simple example flow that creates a lead in Apten when a new item is added to a SharePoint list.

### Scenario

When a new contact is added to a "New Leads" SharePoint list, automatically create a corresponding lead in Apten.

### Steps

1. **Create a new flow** in Power Automate

2. **Add trigger:** Search for "SharePoint" and select **When an item is created**
   * Site Address: Select your SharePoint site
   * List Name: Select your "New Leads" list

3. **Add action:** Search for "Apten" and select **Create Lead**
   * Customer Profile: Enter your Apten profile name (e.g., "sales-outreach")
   * First Name: Select the First Name column from SharePoint (dynamic content)
   * Last Name: Select the Last Name column from SharePoint
   * Phone: Select the Phone column from SharePoint
   * Email: Select the Email column from SharePoint

4. **Save** your flow

Now, whenever a new item is added to your SharePoint list, a lead will automatically be created in Apten with the contact's information.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Invalid API Key (401 Unauthorized)">
    **Solution:**

    * Verify your API key is correct
    * Check that your API key has not been revoked in the Apten dashboard
    * Create a new connection with a fresh API key
  </Accordion>

  <Accordion title="Lead Not Found (404)">
    **Solution:**

    * Verify the Lead ID is correct
    * Ensure the lead has not been deleted
    * Use the Lead Lookup action to find a lead by phone number
  </Accordion>

  <Accordion title="Invalid Phone Number (400)">
    **Solution:**

    * Use E.164 format for phone numbers (e.g., +15551234567)
    * Include the country code
    * Remove spaces, dashes, and parentheses
  </Accordion>

  <Accordion title="Rate Limiting (429)">
    **Solution:**

    * Add a delay between actions in your flow
    * Reduce the frequency of your automated workflows
    * Contact Apten support if you need higher rate limits
  </Accordion>

  <Accordion title="Connection Failed">
    **Solution:**

    * Check your internet connection
    * Verify the Apten API is accessible
    * Ensure your API key is valid and has not expired
    * Try creating a new connection
  </Accordion>

  <Accordion title="Missing Required Fields (400)">
    **Solution:**

    * Review the required fields for the action
    * Ensure all required fields have values (not empty or null)
    * Check that dynamic content is properly mapped
  </Accordion>
</AccordionGroup>

## Support

If you encounter issues not covered in this guide, contact us at [founders@apten.ai](mailto:founders@apten.ai).

When contacting support, please include:

* Your flow ID or screenshot
* The error message you received
* The action that failed
