POST https://solarproof.com.au/apidata.php

Description

This endpoint allows you to subscribe to webhook events by registering your webhook URL and specifying which event type you want to receive. Once subscribed, Solar Proof will send HTTP POST requests to your webhook URL whenever the specified event occurs.

Multiple Subscriptions: You can subscribe to multiple event types by calling this endpoint multiple times with different type_request values. Each subscription is independent.

Request Parameters

Query Parameters

Parameter Type Required Description
action string Required Must be subscribe_customer
api_key string Required Your unique API key for authentication

Request Body (JSON)

Field Type Required Description
hookUrl string Required The HTTPS URL where webhook events will be sent. Must be a valid, publicly accessible URL
type_request string Required The event type to subscribe to. Valid values: customer_created, customer_status_change, project_email_sent, project_sms_sent, published_proposal_link, recent_draft_project

Response

Success Response (200 OK)

Success Response JSON
{
  "success": true,
  "message": "Webhook subscribed successfully"
}

Error Response (400 Bad Request)

Error Response JSON
{
  "success": false,
  "message": "Error description"
}

Common Error Messages

Error Message Cause Solution
Empty request body No JSON data sent in request Ensure you're sending a valid JSON body with the request
Invalid JSON Malformed JSON in request body Validate your JSON syntax before sending
hookUrl parameter is required Missing or empty hookUrl field Include a valid webhook URL in the request body
Invalid webhook URL format The URL provided is not a valid format Ensure the URL is properly formatted and includes the protocol (https://)
Invalid webhook type The type_request value is not allowed Use one of the valid event types listed above
Invalid API key The provided API key is invalid or expired Verify your API key is correct and active

Code Examples

cURL bash
curl -X POST "https://solarproof.com.au/apidata.php?action=subscribe_customer&api_key=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "hookUrl": "https://your-domain.com/webhooks/solarproof",
    "type_request": "customer_created"
  }'
JavaScript (Fetch) javascript
const subscribeWebhook = async () => {
  const response = await fetch(
    'https://solarproof.com.au/apidata.php?action=subscribe_customer&api_key=YOUR_API_KEY',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        hookUrl: 'https://your-domain.com/webhooks/solarproof',
        type_request: 'customer_created'
      })
    }
  );
  
  const data = await response.json();
  console.log(data);
};

subscribeWebhook();
PHP php
<?php
$api_key = 'YOUR_API_KEY';
$url = 'https://solarproof.com.au/apidata.php?action=subscribe_customer&api_key=' . $api_key;

$data = [
    'hookUrl' => 'https://your-domain.com/webhooks/solarproof',
    'type_request' => 'customer_created'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
?>
Python python
import requests

api_key = 'YOUR_API_KEY'
url = f'https://solarproof.com.au/apidata.php?action=subscribe_customer&api_key={api_key}'

data = {
    'hookUrl': 'https://your-domain.com/webhooks/solarproof',
    'type_request': 'customer_created'
}

response = requests.post(url, json=data)
print(response.json())

Common Use Cases

CRM Integration

Subscribe to customer_created events to automatically sync new customers to your CRM system.

{
  "hookUrl": "https://your-crm.com/api/webhooks/solarproof",
  "type_request": "customer_created"
}

Sales Pipeline Automation

Subscribe to customer_status_change to move deals through your sales pipeline automatically.

Team Notifications

Send notifications to Slack when proposals are published using published_proposal_link.

Important Notes:
  • Your webhook URL must be publicly accessible and use HTTPS
  • Your endpoint must respond within 5 seconds with a 200 status code
  • Duplicate subscriptions (same URL and type) are allowed but not recommended
  • Test your webhook endpoint before subscribing to ensure it can handle the traffic

Related Endpoints