# Yelp Leads

> Read and reply to Yelp leads and manage partner business subscriptions.

App · 8 actions. Web page: https://docs.lodol.com/docs/integrations/yelp-leads

## Actions

### Create business subscriptions

Subscribe to businesses.

**Inputs**

- Subscription types (`subscription_types`, list, required): Types of subscriptions that will be managed. One or more of: `LISTING_MANAGEMENT` (Listing management), `YELP_KNOWLEDGE` (Yelp knowledge), `WEBHOOK`.
- Business ids (`business_ids`, list, required): List of Yelp Encrypted Business IDs that will be managed.

**Outputs**

- `data` (object): Yelp Leads response data.

**Example output**

```json
{
  "data": {}
}
```

### Get lead

Get Lead.

**Inputs**

- Lead ID (`lead_id`, text, required): The Yelp Lead ID

**Outputs**

- `data` (object): Yelp Leads response data.

**Example output**

```json
{
  "data": {
    "business_id": "example",
    "conversation_id": "example",
    "id": "example",
    "last_event_time": "example",
    "link_to_reply_in_yelp": "example",
    "phone_number": "example",
    "project": {
      "attachments": [],
      "availability": {
        "dates": [],
        "status": "example"
      },
      "job_names": [],
      "location": {
        "postal_code": "example"
      },
      "survey_answers": []
    },
    "temporary_email_address": "example",
    "temporary_email_address_expiry": "example",
    "temporary_phone_number": "example",
    "temporary_phone_number_expiry": "example",
    "time_created": "example",
    "user": {
      "display_name": "example"
    }
  }
}
```

### List business lead ids

Get Lead IDs for a Business.

**Inputs**

- Business id (`business_id`, text, required): The Yelp Business ID
- Limit (`limit`, number): The maximum number of items to return. Default=20 (1-20). From 1 to 20. Default: `20`.
- After lead id (`after_lead_id`, text): If specified, only lead IDs that come after this lead ID will be returned.
- Created after (`created_after`, date and time): If specified, only leads created at or after this timestamp (inclusive) will be returned. ISO 8601 format with timezone required, e.g. 2024-06-30T23:59:59Z or 2024-06-30T23:59:59%2B00:00. Can be combined with created_before to define a time range. Time filters are applied first, then results are paginated with after_lead_id within the filtered window.
- Created before (`created_before`, date and time): If specified, only leads created at or before this timestamp (inclusive) will be returned. ISO 8601 format with timezone required, e.g. 2024-06-30T23:59:59Z or 2024-06-30T23:59:59%2B00:00. Can be combined with created_after to define a time range. Time filters are applied first, then results are paginated with after_lead_id within the filtered window.

**Outputs**

- `data` (object): Yelp Leads response data.

**Example output**

```json
{
  "data": {
    "has_more": false,
    "lead_ids": []
  }
}
```

### List business subscriptions

Get Business Subscriptions.

**Inputs**

- Subscription type (`subscription_type`, text, required): Type of subscriptions being returned. One of: `LISTING_MANAGEMENT` (Listing management), `YELP_KNOWLEDGE` (Yelp knowledge), `WEBHOOK`.
- Limit (`limit`, number): The maximum number of business subscriptions to return. From 0 to 10000. Default: `100`.
- Offset (`offset`, number): Offset the list of returned business subscriptions by this amount. At least 0. Default: `0`.

**Outputs**

- `data` (object): Yelp Leads response data.

**Example output**

```json
{
  "data": {
    "limit": 1,
    "offset": 1,
    "subscription_type": "LISTING_MANAGEMENT",
    "subscriptions": [],
    "total": 1
  }
}
```

### List lead events

Get Lead Events.

**Inputs**

- Lead ID (`lead_id`, text, required): The Yelp Lead ID
- Older than cursor (`older_than_cursor`, text): If specified, only events that were sent before this cursor will be returned.
- Newer than cursor (`newer_than_cursor`, text): If specified, only events that were sent after this cursor will be returned.
- Limit (`limit`, number): The maximum number of items to return. Default: 20 (1-20). *Note* Events with the same id (text + attachment) are counted as 1 event for the limit. From 1 to 20. Default: `20`.

**Outputs**

- `data` (object): Yelp Leads response data.

**Example output**

```json
{
  "data": {
    "events": []
  }
}
```

### Mark events read

Mark Lead Event as read.

**Inputs**

- Lead ID (`lead_id`, text, required): The Yelp Lead ID
- Event id (`event_id`, text, required): The encrypted id of the event which is being marked as read
- Time read (`time_read`, date and time): An optional parameter to specify the time when the event was read. If not provided, the event is considered read at the current timestamp (Refer [RFC3339](https://www.rfc-editor.org/rfc/rfc3339#section-5.6) for the format)

**Outputs**

- `data` (object): Yelp Leads response data.

**Example output**

```json
{
  "data": {}
}
```

### Mark lead replied

Mark Lead as replied.

**Inputs**

- Lead ID (`lead_id`, text, required): The Yelp Lead ID
- Reply type (`reply_type`, text, required): The medium through which the lead was replied to. One of: `PHONE`, `EMAIL`.

**Outputs**

- `data` (object): Yelp Leads response data.

**Example output**

```json
{
  "data": {}
}
```

### Reply to lead

Write Event.

**Inputs**

- Lead ID (`lead_id`, text, required): The Yelp Lead ID
- Request content (`request_content`, text, required): The actual content of the event. This must be a non empty string.
- Request type (`request_type`, text, required): The content type of the event. Only "TEXT" is supported right now. One of: `TEXT`.

**Outputs**

- `data` (object): Yelp Leads response data.

**Example output**

```json
{
  "data": {}
}
```
