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

# Talking Shops

> How qualified calls are pushed into Talking Shops CRM.

## Purpose

Talking Shops is the CRM destination. Once a call is successfully qualified, the pusher creates a follow-up task so a human sales team member can continue the lead.

## When Records Are Pushed

`talkingshops_pusher.py` reads:

```sql theme={null}
SELECT * FROM calls WHERE status = 'called' ORDER BY created_at ASC;
```

After a successful push, the call status becomes:

```text theme={null}
pushed
```

## Scheduler Integration

`scheduler.py` runs the pusher loop every:

```env theme={null}
PUSH_INTERVAL_SECONDS=120
```

You can also run a one-off push:

```powershell theme={null}
python talkingshops_pusher.py
```

## Authentication

Default auth header:

```env theme={null}
TALKINGSHOPS_AUTH_HEADER=x-tenant-api-key
TALKINGSHOPS_API_KEY=your_talkingshops_api_key
```

If the API expects a prefix:

```env theme={null}
TALKINGSHOPS_AUTH_PREFIX=Bearer
```

## Customer Linking

Before creating a task, the pusher tries to find a customer by mobile number.

Derived default customers endpoint:

```text theme={null}
{TALKINGSHOPS_API_URL with /tasks replaced by /customers}
```

Override:

```env theme={null}
TALKINGSHOPS_CUSTOMERS_API_URL=https://api.talkingshops.com/v1/customers
```

If the customer does not exist, the pusher tries to create one. If linking fails, the task gets an `unlinked-customer` tag.

## Task Payload

The task includes:

* `title`: `Follow up with {lead_name}`
* `titleType`: `followup`
* `description`: summary of lead, phone, source, product, budget, location, call ID, and lead ID
* `priority`: derived from budget
* `dueDate`: next day
* `tags`: `ai-caller`, source platform, `qualified-lead`
* `metadata`: call ID, lead ID, phone, product interest, budget, location, source, full qualification JSON
* Optional owner fields
* Optional related customer fields

## Priority Mapping

| Budget amount   | Priority |
| --------------- | -------- |
| `>= 1 crore`    | `urgent` |
| `>= 25 lakhs`   | `high`   |
| Less or unknown | `normal` |

Budget parsing understands common Indian terms such as `lakh`, `lac`, `lk`, `crore`, and `cr`.

## Owner Assignment

Static owner:

```env theme={null}
TALKINGSHOPS_OWNER_ID=owner_1
TALKINGSHOPS_OWNER_NAME=Agent One
```

Round-robin owners:

```env theme={null}
TALKINGSHOPS_OWNERS=owner_1:Agent One,owner_2:Agent Two,owner_3:Agent Three
```

Round-robin selection uses the call ID.

## Dry Run

```env theme={null}
TALKINGSHOPS_DRY_RUN=true
```

Dry run logs the redacted headers and payload and marks the operation successful without sending the HTTP request.

## Push Failure Behavior

```env theme={null}
TALKINGSHOPS_MARK_FAILED_ON_PUSH_ERROR=true
```

When true, failed pushes mark the call `failed`. When false, the call remains `called` so it can be retried by the next pusher cycle.
