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

# Schedule LinkedIn Action

> Schedule LinkedIn actions like connection requests and messages with smart timing

# Schedule LinkedIn Action

Schedule various LinkedIn actions including connection requests, messages, and data retrieval operations. The system automatically handles timing delays and rate limiting to ensure safe automation.

<Note>
  Requires the `linkedin:schedule` permission and an active LinkedIn integration
  in your account.
</Note>

## Request

<ParamField header="x-api-key" type="string" required>
  Your API key with `linkedin:schedule` permission
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Must be `application/json`
</ParamField>

### Body Parameters

<ParamField body="actionType" type="string" required>
  Type of LinkedIn action to perform. See [action types](#action-types) for
  available options.
</ParamField>

<ParamField body="profileUrl" type="string" conditional>
  LinkedIn profile URL. Required for actions targeting specific profiles.
  Format: `https://linkedin.com/in/username`
</ParamField>

<ParamField body="message" type="string" conditional>
  Message content for connection requests or direct messages. Required for
  messaging actions.
</ParamField>

<ParamField body="participantName" type="string" conditional>
  Name of conversation participant. Required for conversation-specific actions.
</ParamField>

<ParamField body="threadId" type="string" conditional>
  LinkedIn thread identifier. Required for thread-specific actions.
</ParamField>

<ParamField body="voiceSettings" type="object" conditional>
  Voice message configuration. Required for `sendVoiceMessage` action type.

  <Expandable title="Voice Settings">
    <ParamField body="voiceId" type="string" required>
      ID of the voice clone to use for generating voice message
    </ParamField>

    <ParamField body="voiceText" type="string" required>
      Text to convert to voice message (1-500 characters)
    </ParamField>

    <ParamField body="voiceParams" type="object">
      Optional voice generation parameters

      <Expandable title="Voice Parameters">
        <ParamField body="stability" type="number" default="0.5">
          Voice stability (0.0-1.0)
        </ParamField>

        <ParamField body="clarity" type="number" default="0.75">
          Voice clarity and similarity boost (0.0-1.0)
        </ParamField>

        <ParamField body="use_speaker_boost" type="boolean" default="true">
          Enhance speaker similarity
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<Info>
  LinkedIn integration settings (timezone, account details) are automatically
  detected from your connected LinkedIn account. No additional configuration
  required.
</Info>

## Action Types

<AccordionGroup>
  <Accordion title="Connection Actions">
    **`sendConnectionRequest`** - Send a connection request - Requires:
    `profileUrl` - Optional: `message` (connection note)
    **`getAcceptedConnections`** - Retrieve accepted connections - No additional
    parameters required
  </Accordion>

  <Accordion title="Messaging Actions">
    **`sendMessageToFirst`** - Send first message to a connection - Requires:
    `profileUrl`, `message` **`sendFirstMessage`** - Send initial message -
    Requires: `profileUrl`, `message` **`sendVoiceMessage`** - Send message with
    voice attachment - Requires: `profileUrl`, `message`, `voiceSettings`
  </Accordion>

  <Accordion title="Data Retrieval">
    **`getLinkedInMessages`** - Get LinkedIn messages - No additional parameters
    required **`getSpecificConversationMessages`** - Get specific conversation -
    Requires: `participantName` **`accessConversationByThreadId`** - Access
    conversation by thread - Requires: `threadId`
  </Accordion>
</AccordionGroup>

## Examples

### Send Connection Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.buena.ai/api/v2/linkedin/scheduleLinkedInAction" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "actionType": "sendConnectionRequest",
      "profileUrl": "https://linkedin.com/in/johndoe",
      "message": "Hi John, I'd love to connect and discuss potential collaboration opportunities!"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.buena.ai/api/v2/linkedin/scheduleLinkedInAction",
    {
      method: "POST",
      headers: {
        "x-api-key": "YOUR_API_KEY",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        actionType: "sendConnectionRequest",
        profileUrl: "https://linkedin.com/in/johndoe",
        message:
          "Hi John, I'd love to connect and discuss potential collaboration opportunities!",
      }),
    }
  );

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.buena.ai/api/v2/linkedin/scheduleLinkedInAction',
      headers={
          'x-api-key': 'YOUR_API_KEY',
          'Content-Type': 'application/json'
      },
      json={
          'actionType': 'sendConnectionRequest',
          'profileUrl': 'https://linkedin.com/in/johndoe',
          'message': "Hi John, I'd love to connect and discuss potential collaboration opportunities!"
      }
  )

  print(response.json())
  ```
</CodeGroup>

### Send First Message

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.buena.ai/api/v2/linkedin/scheduleLinkedInAction" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "actionType": "sendFirstMessage",
      "profileUrl": "https://linkedin.com/in/janedoe",
      "message": "Hi Jane, thank you for connecting! I noticed your expertise in AI and would love to discuss potential synergies."
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.buena.ai/api/v2/linkedin/scheduleLinkedInAction",
    {
      method: "POST",
      headers: {
        "x-api-key": "YOUR_API_KEY",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        actionType: "sendFirstMessage",
        profileUrl: "https://linkedin.com/in/janedoe",
        message:
          "Hi Jane, thank you for connecting! I noticed your expertise in AI and would love to discuss potential synergies.",
      }),
    }
  );

  const data = await response.json();
  console.log(data);
  ```
</CodeGroup>

### Send Voice Message

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.buena.ai/api/v2/linkedin/scheduleLinkedInAction" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "actionType": "sendVoiceMessage",
      "profileUrl": "https://linkedin.com/in/johndoe",
      "message": "Hi John! I wanted to reach out personally about an exciting opportunity.",
      "voiceSettings": {
        "voiceId": "voice_abc123",
        "voiceText": "Hi John! I hope you're having a great week. I came across your profile and was really impressed by your experience in AI. I wanted to reach out personally about an exciting opportunity that I think could be a perfect fit for your background. Would love to chat more about it!",
        "voiceParams": {
          "stability": 0.6,
          "clarity": 0.8,
          "use_speaker_boost": true
        }
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.buena.ai/api/v2/linkedin/scheduleLinkedInAction",
    {
      method: "POST",
      headers: {
        "x-api-key": "YOUR_API_KEY",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        actionType: "sendVoiceMessage",
        profileUrl: "https://linkedin.com/in/johndoe",
        message:
          "Hi John! I wanted to reach out personally about an exciting opportunity.",
        voiceSettings: {
          voiceId: "voice_abc123",
          voiceText:
            "Hi John! I hope you're having a great week. I came across your profile and was really impressed by your experience in AI. I wanted to reach out personally about an exciting opportunity that I think could be a perfect fit for your background. Would love to chat more about it!",
          voiceParams: {
            stability: 0.6,
            clarity: 0.8,
            use_speaker_boost: true,
          },
        },
      }),
    }
  );

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.buena.ai/api/v2/linkedin/scheduleLinkedInAction',
      headers={
          'x-api-key': 'YOUR_API_KEY',
          'Content-Type': 'application/json'
      },
      json={
          'actionType': 'sendVoiceMessage',
          'profileUrl': 'https://linkedin.com/in/johndoe',
          'message': 'Hi John! I wanted to reach out personally about an exciting opportunity.',
          'voiceSettings': {
              'voiceId': 'voice_abc123',
              'voiceText': 'Hi John! I hope you\'re having a great week. I came across your profile and was really impressed by your experience in AI. I wanted to reach out personally about an exciting opportunity that I think could be a perfect fit for your background. Would love to chat more about it!',
              'voiceParams': {
                  'stability': 0.6,
                  'clarity': 0.8,
                  'use_speaker_boost': True
              }
          }
      }
  )

  print(response.json())
  ```
</CodeGroup>

### Get Accepted Connections

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.buena.ai/api/v2/linkedin/scheduleLinkedInAction" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "actionType": "getAcceptedConnections"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.buena.ai/api/v2/linkedin/scheduleLinkedInAction",
    {
      method: "POST",
      headers: {
        "x-api-key": "YOUR_API_KEY",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        actionType: "getAcceptedConnections",
      }),
    }
  );

  const data = await response.json();
  console.log(data);
  ```
</CodeGroup>

## Response

<ResponseField name="success" type="boolean">
  Always `true` for successful requests
</ResponseField>

<ResponseField name="message" type="string">
  Confirmation message indicating the action was scheduled successfully,
  including delay information
</ResponseField>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "message": "sendConnectionRequest action scheduled successfully with delay of 75000 ms."
  }
  ```
</ResponseExample>

## Smart Scheduling

The system automatically applies intelligent delays to ensure safe automation:

<AccordionGroup>
  <Accordion title="Delay Calculation">
    Delays are calculated based on: - Your current activity level - LinkedIn's
    rate limits - Time of day and timezone (from your LinkedIn account) -
    Account safety guidelines - Previous action history
  </Accordion>

  <Accordion title="Timezone Considerations">
    Actions are scheduled considering: - Business hours in your LinkedIn account
    timezone - Weekend vs weekday patterns - Regional LinkedIn usage patterns -
    Your account's historical activity
  </Accordion>

  <Accordion title="Safety Features">
    Built-in safety mechanisms: - Automatic rate limiting - Human-like timing
    patterns - Activity distribution across time - Compliance with LinkedIn
    terms
  </Accordion>
</AccordionGroup>

## Advanced Use Cases

### 1. Automated Outreach Campaign

```javascript theme={null}
async function runOutreachCampaign(prospects) {
  for (const prospect of prospects) {
    try {
      const response = await fetch(
        "https://api.buena.ai/api/v2/linkedin/scheduleLinkedInAction",
        {
          method: "POST",
          headers: {
            "x-api-key": process.env.BUENA_API_KEY,
            "Content-Type": "application/json",
          },
          body: JSON.stringify({
            actionType: "sendConnectionRequest",
            profileUrl: prospect.linkedinUrl,
            message: personalizeMessage(prospect),
          }),
        }
      );

      const result = await response.json();

      if (result.success) {
        console.log(`✅ Scheduled connection request for ${prospect.name}`);
        await logActivity(prospect.id, "connection_scheduled");
      } else {
        console.error(
          `❌ Failed to schedule for ${prospect.name}:`,
          result.message
        );
      }

      // Small delay between scheduling requests
      await new Promise((resolve) => setTimeout(resolve, 1000));
    } catch (error) {
      console.error(`Error scheduling for ${prospect.name}:`, error);
    }
  }
}

function personalizeMessage(prospect) {
  return `Hi ${prospect.firstName}, I noticed your work at ${prospect.company} and would love to connect to discuss ${prospect.industry} trends!`;
}
```

### 2. Follow-up Message Sequence

```python theme={null}
import asyncio
import requests
from datetime import datetime, timedelta

class LinkedInSequence:
    def __init__(self, api_key):
        self.api_key = api_key
        self.base_url = 'https://api.buena.ai/api/v2'

    async def schedule_followup_sequence(self, profile_url, sequence_config):
        """Schedule a series of follow-up messages"""

        for step in sequence_config['steps']:
            response = requests.post(
                f'{self.base_url}/linkedin/scheduleLinkedInAction',
                headers={
                    'x-api-key': self.api_key,
                    'Content-Type': 'application/json'
                },
                json={
                    'actionType': step['action_type'],
                    'profileUrl': profile_url,
                    'message': step['message']
                }
            )

            if response.status_code == 200:
                result = response.json()
                print(f"✅ Scheduled {step['action_type']}")
            else:
                print(f"❌ Failed to schedule {step['action_type']}: {response.text}")

            # Wait between scheduling requests
            await asyncio.sleep(2)

# Example usage
sequence = LinkedInSequence('your-api-key')

campaign_config = {
    'steps': [
        {
            'action_type': 'sendConnectionRequest',
            'message': 'Hi! I'd love to connect.'
        },
        {
            'action_type': 'sendFirstMessage',
            'message': 'Thanks for connecting! How's your week going?'
        }
    ]
}

await sequence.schedule_followup_sequence(
    'https://linkedin.com/in/prospect',
    campaign_config
)
```

### 3. Connection Acceptance Monitoring

```javascript theme={null}
async function monitorConnections() {
  const response = await fetch(
    "https://api.buena.ai/api/v2/linkedin/scheduleLinkedInAction",
    {
      method: "POST",
      headers: {
        "x-api-key": process.env.BUENA_API_KEY,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        actionType: "getAcceptedConnections",
      }),
    }
  );

  const result = await response.json();

  if (result.success) {
    console.log("✅ Connection monitoring scheduled");

    // Schedule follow-up messages for new connections
    // This would typically be handled by a webhook or polling system
  }

  return result;
}

// Run daily to check for new connections
setInterval(monitorConnections, 24 * 60 * 60 * 1000);
```

## Error Responses

### Permission Denied (403)

```json theme={null}
{
  "error": true,
  "code": "PERMISSION_DENIED",
  "message": "Insufficient permissions for LinkedIn scheduling",
  "version": "2.0",
  "timestamp": "2024-01-20T15:30:00Z",
  "permissionHelp": {
    "required": "linkedin:schedule",
    "available": ["linkedin:read"],
    "documentation": "https://docs.buena.ai/authentication"
  }
}
```

### LinkedIn Not Connected (400)

```json theme={null}
{
  "error": true,
  "code": "LINKEDIN_NOT_CONNECTED",
  "message": "LinkedIn account not connected",
  "version": "2.0",
  "timestamp": "2024-01-20T15:30:00Z",
  "details": {
    "action": "Connect your LinkedIn account in the dashboard",
    "dashboardUrl": "https://app.buena.ai/integrations/linkedin"
  }
}
```

### Invalid Profile URL (400)

```json theme={null}
{
  "error": true,
  "code": "INVALID_LINKEDIN_URL",
  "message": "Invalid LinkedIn profile URL format",
  "version": "2.0",
  "timestamp": "2024-01-20T15:30:00Z",
  "details": {
    "providedUrl": "https://example.com/profile",
    "expectedFormat": "https://linkedin.com/in/username"
  }
}
```

### Rate Limited (429)

```json theme={null}
{
  "error": true,
  "code": "RATE_LIMIT_EXCEEDED",
  "message": "LinkedIn action rate limit exceeded",
  "version": "2.0",
  "timestamp": "2024-01-20T15:30:00Z",
  "retryAfter": 300,
  "details": {
    "dailyLimit": 100,
    "used": 100,
    "resetTime": "2024-01-21T00:00:00Z"
  }
}
```

## Best Practices

<AccordionGroup>
  <Accordion title="Message Personalization">
    Personalize messages for better engagement:

    ```javascript theme={null}
    function createPersonalizedMessage(prospect) {
      const templates = [
        `Hi ${prospect.firstName}, I noticed your work at ${prospect.company} and would love to connect!`,
        `Hello ${prospect.firstName}, your background in ${prospect.industry} caught my attention. Let's connect!`,
        `Hi ${prospect.firstName}, I'd love to learn more about your role at ${prospect.company}.`
      ];
      
      return templates[Math.floor(Math.random() * templates.length)];
    }
    ```
  </Accordion>

  <Accordion title="Error Handling">
    Implement robust error handling:

    ```javascript theme={null}
    async function scheduleWithRetry(actionData, maxRetries = 3) {
      for (let attempt = 1; attempt <= maxRetries; attempt++) {
        try {
          const response = await scheduleLinkedInAction(actionData);
          return response;
        } catch (error) {
          if (error.code === 'RATE_LIMIT_EXCEEDED' && attempt < maxRetries) {
            const delay = error.retryAfter * 1000;
            await new Promise(resolve => setTimeout(resolve, delay));
            continue;
          }
          throw error;
        }
      }
    }
    ```
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Upload Prospects" icon="upload" href="/api-reference/linkedin/upload-prospects">
    Upload bulk prospect lists for automation
  </Card>

  <Card title="Check User Status" icon="user" href="/api-reference/users/linkedin">
    Verify LinkedIn integration status
  </Card>

  <Card title="Monitor Jobs" icon="clock" href="/api-reference/users/jobs">
    Track LinkedIn action job status
  </Card>

  <Card title="LinkedIn Guide" icon="book" href="/guides/linkedin-automation">
    Learn advanced LinkedIn automation
  </Card>
</CardGroup>
