# Zapier

Connect Tensorix AI to 6,000+ apps with Zapier, the world's most popular automation platform.

***

## Overview

[Zapier](https://zapier.com/) connects apps and automates workflows without code. Using Tensorix's OpenAI-compatible API with Zapier's webhooks, you can add AI to any Zap.

### What You Can Build

* 📧 **Smart Email Responses** - Auto-draft replies based on content
* 📋 **Form Processing** - Analyze and route form submissions
* 🏷️ **Content Tagging** - Auto-categorize documents and records
* 📊 **Report Summaries** - Generate insights from data
* 🛒 **E-commerce Automation** - Product content, review analysis
* 💬 **Multi-Channel Bots** - Respond across Slack, Discord, email

***

## Prerequisites

* Zapier account (Free tier works, Webhooks require paid plan)
* Tensorix API key from [app.tensorix.ai](https://app.tensorix.ai)

***

## Method 1: Webhooks by Zapier (Recommended)

The most flexible way to call Tensorix from Zapier.

### Step 1: Create a New Zap

1. Click **Create Zap**
2. Choose your trigger (e.g., New Email in Gmail)
3. Add an action step

### Step 2: Add Webhooks Action

1. Search for **Webhooks by Zapier**
2. Select **POST** as the action event
3. Configure the webhook:

**URL:**

```
https://api.tensorix.ai/v1/chat/completions
```

**Payload Type:** `json`

**Data:**

```
model: deepseek/deepseek-chat-v3.1
messages: [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Your prompt here"}]
max_tokens: 1000
temperature: 0.7
```

**Headers:**

| Key             | Value                 |
| --------------- | --------------------- |
| `Authorization` | `Bearer YOUR_API_KEY` |
| `Content-Type`  | `application/json`    |

### Step 3: Use Dynamic Content

Replace the user message with data from your trigger:

```
messages: [{"role": "user", "content": "Summarize this email: {{body}}"}]
```

### Step 4: Extract the Response

Add a **Formatter by Zapier** action:

* Action: **Text** → **Split Text**
* Input: `{{webhooks__choices__0__message__content}}`
* Separator: (leave empty for full text)

Or use **Code by Zapier** for more control:

```javascript
const response = JSON.parse(inputData.webhookResponse);
return { aiMessage: response.choices[0].message.content };
```

***

## Method 2: OpenAI App (With Custom Base URL)

If Zapier's OpenAI integration supports custom endpoints:

### Setup

1. Add **OpenAI** as an action
2. In connection settings, look for **Advanced** or **Custom Base URL**
3. Enter: `https://api.tensorix.ai/v1`
4. Use your Tensorix API key

> **Note:** This method depends on Zapier's OpenAI integration supporting custom URLs. If not available, use the Webhooks method above.

***

## Method 3: Code by Zapier

For complex logic, use JavaScript or Python:

### JavaScript Example

```javascript
const response = await fetch('https://api.tensorix.ai/v1/chat/completions', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${inputData.apiKey}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'deepseek/deepseek-chat-v3.1',
    messages: [
      { role: 'system', content: 'You are a helpful assistant.' },
      { role: 'user', content: inputData.prompt }
    ],
    max_tokens: 1000
  })
});

const data = await response.json();
return { response: data.choices[0].message.content };
```

### Python Example

```python
import requests

response = requests.post(
    'https://api.tensorix.ai/v1/chat/completions',
    headers={
        'Authorization': f'Bearer {input_data["api_key"]}',
        'Content-Type': 'application/json'
    },
    json={
        'model': 'deepseek/deepseek-chat-v3.1',
        'messages': [
            {'role': 'user', 'content': input_data['prompt']}
        ],
        'max_tokens': 1000
    }
)

result = response.json()
return {'response': result['choices'][0]['message']['content']}
```

***

## Example Zaps

### 1. Email Auto-Classifier

Automatically label and route incoming emails:

```
Gmail (New Email)
    ↓
Webhooks (POST to Tensorix)
    ↓
Paths (by AI classification)
    ├── Support → Zendesk
    ├── Sales → Pipedrive
    └── Other → Slack notification
```

**Prompt:**

```
Classify this email into exactly one category: SUPPORT, SALES, BILLING, SPAM, or OTHER.

From: {{from_email}}
Subject: {{subject}}
Body: {{body}}

Respond with only the category name.
```

### 2. Form Response Analyzer

Analyze feedback forms and extract insights:

```
Typeform (New Response)
    ↓
Webhooks (POST to Tensorix)
    ↓
Google Sheets (Add Row)
    ↓
Slack (Send if negative sentiment)
```

**Prompt:**

```
Analyze this feedback and provide:
1. Sentiment (Positive/Neutral/Negative)
2. Key topics mentioned (comma-separated)
3. One-line summary

Feedback: {{answers}}
```

### 3. Content Generator

Generate social posts from blog articles:

```
RSS (New Item)
    ↓
Webhooks (POST to Tensorix)
    ↓
Buffer (Create Post)
```

**Prompt:**

```
Create a Twitter post promoting this article. Keep it under 280 characters. Include a hook and call-to-action.

Title: {{title}}
Summary: {{description}}
```

### 4. Lead Scoring

Score new leads based on their data:

```
CRM (New Lead)
    ↓
Webhooks (POST to Tensorix)
    ↓
Formatter (Extract score)
    ↓
CRM (Update Lead)
```

**Prompt:**

```
Score this lead from 1-100 based on:
- Company size (larger = higher)
- Job title seniority
- Industry fit

Company: {{company}}
Title: {{job_title}}
Industry: {{industry}}
Employees: {{company_size}}

Respond with ONLY the numeric score.
```

### 5. Meeting Notes Processor

Transform raw notes into structured summaries:

```
Calendar (Event End)
    ↓
Webhooks (POST to Tensorix)
    ↓
Notion (Create Page)
    ↓
Slack (Share summary)
```

**Prompt:**

```
Convert these meeting notes into a structured summary:

# {{event_title}}
Date: {{event_date}}

## Attendees
[List attendees]

## Key Points
[Bullet points of main discussion items]

## Action Items
[Tasks with owners if mentioned]

## Decisions Made
[Any decisions reached]

Notes: {{notes}}
```

***

## Working with Responses

### Access Response Fields

After the webhook, use Zapier's built-in parsing:

| What You Need | Zapier Field Path              |
| ------------- | ------------------------------ |
| AI Response   | `choices__0__message__content` |
| Model         | `model`                        |
| Total Tokens  | `usage__total_tokens`          |

### Clean Up Output

Use **Formatter by Zapier**:

1. **Trim Whitespace** - Remove extra spaces
2. **Replace** - Clean unwanted characters
3. **Split Text** - Extract specific parts

***

## Recommended Models

| Task                 | Model                               | Why                  |
| -------------------- | ----------------------------------- | -------------------- |
| **Classification**   | `deepseek/deepseek-chat-v3.1`       | Fast, accurate       |
| **Summarization**    | `meta-llama/llama-3.3-70b-instruct` | Good compression     |
| **Analysis**         | `deepseek/deepseek-r1-0528`         | Deep reasoning       |
| **Content Creation** | `deepseek/deepseek-chat-v3.1`       | Creative, coherent   |
| **Code Tasks**       | `z-ai/glm-5.1`                      | Excellent for coding |

***

## Error Handling

### Handle API Errors

Add a **Paths** step after your webhook:

* **Path A:** Webhook successful (status = 200)
* **Path B:** Error occurred → Send alert

### Common Issues

| Error   | Cause           | Fix                          |
| ------- | --------------- | ---------------------------- |
| 401     | Invalid API key | Check key in webhook headers |
| 400     | Malformed JSON  | Validate your JSON structure |
| 429     | Rate limited    | Add delay between steps      |
| Timeout | Long response   | Increase webhook timeout     |

### Retry Logic

Use Zapier's built-in retry:

1. Click the webhook step
2. Go to **Advanced**
3. Enable **Retry** on failure

***

## Best Practices

### 1. Store API Key Securely

* Use Zapier's **App Connections** when possible
* Never expose keys in Zap names or descriptions

### 2. Optimize for Speed

* Use concise prompts
* Set appropriate `max_tokens`
* Choose faster models for simple tasks

### 3. Handle Long Text

For content exceeding limits:

```
Formatter (Truncate) → Webhook → Response
```

### 4. Test Thoroughly

* Use Zapier's **Test** feature
* Check edge cases (empty fields, special characters)

### 5. Monitor Usage

Add a logging step to track:

* Token consumption
* Response times
* Error rates

***

## Pricing Notes

* **Zapier:** Webhooks require a paid plan
* **Tensorix:** Pay per token used

Optimize costs by:

* Caching repeated requests
* Using smaller models for simple tasks
* Batching related operations

***

## See Also

* [API Reference](https://github.com/Tensorix-ai/tensorix-docs/blob/main/api-reference/overview/README.md) - Complete API documentation
* [Models](https://github.com/Tensorix-ai/tensorix-docs/blob/main/api-reference/models/README.md) - Available models
* [Zapier Help](https://help.zapier.com/) - Official Zapier documentation


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tensorix.ai/automation-platforms/zapier.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
