search ESC
search

Start typing to search...

Zoek naar features, prijzen, documentatie, blog posts...

Tesoro API and Webhooks Complete Developer Guide

Integrate Tesoro CRM with your own applications via REST API and webhooks. Automate workflows, build custom integrations, and synchronize data in real-time.

list Table of Contents expand_more

API Best Practices and Security

Code Examples

JavaScript/Node.js example:

const axios = require('axios');

const API_KEY = process.env.TESORO_API_KEY;
const BASE_URL = 'https://api.tesoro.estate/v1';

// Create contact
async function createContact(contactData) {
  try {
    const response = await axios.post(
      `${BASE_URL}/contacts`,
      contactData,
      {
        headers: {
          'Authorization': `Bearer ${API_KEY}`,
          'Content-Type': 'application/json'
        }
      }
    );
    return response.data;
  } catch (error) {
    console.error('Error creating contact:', error.response?.data);
    throw error;
  }
}

// Usage
const newContact = await createContact({
  firstName: 'Maria',
  lastName: 'Garcia',
  email: '[email protected]',
  phone: '+34612345678',
  type: 'buyer'
});

Python example:

import requests
import os

API_KEY = os.getenv('TESORO_API_KEY')
BASE_URL = 'https://api.tesoro.estate/v1'

def create_contact(contact_data):
    headers = {
        'Authorization': f'Bearer {API_KEY}',
        'Content-Type': 'application/json'
    }
    
    response = requests.post(
        f'{BASE_URL}/contacts',
        json=contact_data,
        headers=headers
    )
    response.raise_for_status()
    return response.json()

# Usage
new_contact = create_contact({
    'firstName': 'Maria',
    'lastName': 'Garcia',
    'email': '[email protected]',
    'phone': '+34612345678',
    'type': 'buyer'
})

Webhook handler example (Express.js):

const express = require('express');
const crypto = require('crypto');

const app = express();
app.use(express.json());

const WEBHOOK_SECRET = process.env.TESORO_WEBHOOK_SECRET;

function verifySignature(payload, signature) {
  const hash = crypto
    .createHmac('sha256', WEBHOOK_SECRET)
    .update(JSON.stringify(payload))
    .digest('hex');
  return signature === `sha256=${hash}`;
}

app.post('/webhooks/tesoro', (req, res) => {
  const signature = req.headers['x-tesoro-signature'];
  
  if (!verifySignature(req.body, signature)) {
    return res.status(401).send('Invalid signature');
  }
  
  const { event, data } = req.body;
  
  switch (event) {
    case 'contact.created':
      console.log('New contact:', data);
      // Your custom logic here
      break;
    case 'deal.won':
      console.log('Deal won:', data);
      // Trigger celebration automation
      break;
    default:
      console.log('Unhandled event:', event);
  }
  
  res.status(200).send('OK');
});

app.listen(3000);

Related articles

handshake Deal Management

Idealista Integration: Automatic Property Synchronization

Automatically sync your properties with Idealista via XML feed. Configure in minutes and publish directly to Spain's largest real estate portal.

schedule 8 min
hub Integrations

Fotocasa Integration: Automatic Property Synchronization

Automatically sync your properties with Fotocasa via XML feed. Reach millions of potential buyers and renters on one of Spain's largest real estate portals.

schedule 7 min
forum Communication

WhatsApp Business API: Professional Messaging Integration

Integrate WhatsApp Business API with Tesoro CRM for professional messaging. Send property details, confirm viewings, and communicate with leads via the most popular messaging platform.

schedule 11 min

Frequently Asked Questions

chevron_right How do I access the complete API documentation?
Complete API docs are available at https://api.tesoro.estate/docs with interactive API explorer, all endpoints, request/response examples, and postman collection download.
chevron_right Are there costs associated with API usage?
API access is free included with all Tesoro CRM plans. Rate limit is 1000 requests/minute. For higher limits, consider enterprise plan.
chevron_right Can I use the API to migrate data from aniether CRM?
Yes, use bulk endpoints (/v1/contacts/bulk, /v1/properties/bulk) for data migration. Max 100 items per request. Contact support for assistance with large migrations (>10,000 records).
search