# nvSendMessage

This method allows you to send a message to a person in Sales Navigator.

```typescript
try {
  const workflow = await linkedapi.nvSendMessage.execute({
    personUrl: "https://www.linkedin.com/in/john-doe",
    text: "Hi John! I'd love to connect and discuss some opportunities.",
    subject: "Let's Connect!"
  });

  const { errors } = await linkedapi.nvSendMessage.result(workflow.workflowId);

  // The list of possible execution errors is below
  if (errors && errors.length > 0) {
    console.warn('Workflow completed with execution errors:');
    errors.forEach(error => {
      console.warn(` - Type: ${error.type}, Message: ${error.message}`);
    });
  } else {
    console.log('Sales Navigator message sent successfully.');
  }
} catch (e) {
  // A list of all critical errors can be found here:
  // https://linkedapi.io/sdks/handling-results-and-errors/#handling-critical-errors
  if (e instanceof LinkedApiError) {
    console.error(`Critical Error - Type: ${e.type}, Message: ${e.message}`);
  } else {
    console.error('An unexpected, non-API error occurred:', e);
  }
}
```

```python
from linkedapi import NvSendMessageParams, LinkedApiError

try:
    workflow = linkedapi.nv_send_message.execute(
        NvSendMessageParams(
            person_url="https://www.linkedin.com/in/john-doe",
            text="Hi John! I'd love to connect and discuss some opportunities.",
            subject="Let's Connect!",
        )
    )

    result = linkedapi.nv_send_message.result(workflow.workflow_id)
    errors = result.errors

    # The list of possible execution errors is below
    if errors:
        print("Workflow completed with execution errors:")
        for error in errors:
            print(f" - Type: {error.type}, Message: {error.message}")
    else:
        print("Sales Navigator message sent successfully.")
except LinkedApiError as e:
    # A list of all critical errors can be found here:
    # https://linkedapi.io/sdks/handling-results-and-errors/#handling-critical-errors
    print(f"Critical Error - Type: {e.type}, Message: {e.message}")
except Exception as error:
    print("An unexpected, non-API error occurred:", error)
```

## Params

- `personUrl`  – [public or hashed](/faq/what-are-hashed-url-and-public-url) LinkedIn URL of the person you want to send a message to.
- `threadId` (optional) – identifier of an existing conversation thread to reply into, as returned by [`pollInbox`](/sdks/poll-inbox) or [`pollConversations`](/sdks/poll-conversations). Provide either `personUrl` or `threadId`; if both are given, `threadId` takes precedence.
- `text`  – message text, must be up to **1900** characters.
- `subject`  – subject line, must be up to **80** characters. Required when starting a new conversation; ignored when replying into an existing thread via `threadId`.

## Data

The method doesn't return any data.

## Errors

- `personNotFound` – provided URL is not an existing LinkedIn person.
- `noSalesNavigator` – your account does not have Sales Navigator subscription.
- `messagingNotAllowed` – sending a message to the person is not allowed. This could happen for several reasons:
  - Your monthly Sales Navigator message limit has been reached.
  - LinkedIn has restricted your ability to send messages to the person, for example, due to the person's privacy settings.
