This repository provides a collection of code examples demonstrating how to interact with a Psyll webhook endpoint using various programming languages. Each example performs a POST request to the webhook with a payload to execute a trading action, such as a "BUY" order for BTCUSDT. The examples are designed to be simple, reusable, and adaptable for various use cases, enabling developers to integrate trading functionality into their applications.
Webhook enable executing trades across exchanges through simple HTTP POST requests. They are ideal for automating complex trading strategies, allowing bot developers to seamlessly integrate trading logic, respond instantly to alerts, and embed trading functionality into any backend system for complete automation.
Create a webhook on Psyll.com
- Navigate to Psyll.com website
- Login to your user account
- Navigate to "My Webhooks" under the user menu (top-right corner)
- Click "Create new webook"
- Complete the form by providing:
- A unique webhook name.
- The exchange you wish to connect to.
- Valid API keys for the selected exchange.
| Account type | Number of webhooks | Daily limits | 
|---|---|---|
| Free account | 1 | 10 requests | 
| PRO account | 15 | 100 requests | 
Request URL:
https://psyll.com/env/webhook/{WEBHOOK-ID}
Replace {WEBHOOK-ID} with the unique identifier provided when you created the webhook.
Request data
{
  "code": "{WEBHOOK-CODE}",
  "action": "{ACTION}",
  "quantity": "{QUANTITY}",
  "symbol": "{SYMBOL}"
}| Name | Type | Description | 
|---|---|---|
| code | string | unique authentication code required to validate the webhook request, ensuring secure access to the API. | 
| action | string | Specifies the trading action to be performed. Allowed Values: BUY,SELL,SET | 
| quantity | float | Defines the amount of the asset to trade | 
| symbol | string | Identifies the trading pair or asset for the order. The symbol must match a valid trading pair supported by the exchange | 
A successful webhook request returns a JSON response with the following structure:
{
    "created": "2025-07-07 18:25:20",
    "limit": {
        "account": "PRO",
        "max_per_day": 200,
        "usage": 3
    },
    "message": "Order placed",
    "request": {
        "action": "SET",
        "code": "{WEBHOOK-CODE}",
        "quantity": "1",
        "symbol": "BTCUSDC"
    },
    "status": "success",
    "response": {
        ... Exchange response
    }
}
| Field | Description | 
|---|---|
| created | Timestamp indicating when the request was processed. | 
| limit | Object containing account tier, daily request limit, and current usage. | 
| message | A brief description of the request outcome. | 
| request | Echoes the submitted request data for verification. | 
| response | The results of exchange operation. This could include confirmation of a trade order, its ID, execution status, or other data. | 
| status | Indicates the outcome of the request, e.g., "success" or "error". | 
If a request fails, the response will include an error status and a descriptive message. Example:
{
    "created": "2025-07-07 18:37:08",
    "limit": {
        "account": "PRO",
        "max_per_day": 200,
        "usage": 4
    },
    "message": "Account has insufficient balance for requested action.",
    "request": {
        "action": "SET",
        "code": "{WEBHOOK-CODE}",
        "quantity": "1",
        "symbol": "BTCUSDC"
    },
    "status": "error"
}Ensure that the code, action, quantity, and symbol fields are valid to avoid errors.
- Incorrect or missing webhook code: Ensure the code field matches the webhook code provided by Psyll.
- Unsupported trading pair: Verify that the symbol is valid for the selected exchange.
- Invalid quantity format: Use a representation of a numeric value (e.g., "1.5") to maintain precision.
- Rate limit exceeded: Check the limit field in the response to monitor usage against the daily limit.
- Clone this repository to your local machine:
git clone https://github.com/username/webhook-examples.git
- Navigate to the directory of the desired programming language.
- Update the WEBHOOK_URLandWEBHOOK_CODEvariables with your webhook ID and code.
- Install any required dependencies (e.g., requests for Python, axios for Node.js).
- Run the example script to test the webhook request.
The repository includes example implementations in the following programming languages:
| Name | Folder | |
|---|---|---|
| Python | View files | |
| C# | View files | |
| PHP | View files | |
| JavaScript | View files | |
| NodeJS | View files | |
| Go | View files | |
| Java | View files | |
| Kotlin | View files | |
| Ruby | View files | |
| Rust | View files | |
| Swift | View files | |
| TypeScript | View files | 
- Secure Webhook Code: Store WEBHOOK_CODE in environment variables or a secure configuration file, not in source code.
- Validate Responses: Always check the status field in the response to confirm the request outcome.
- Monitor Rate Limits: Use the limit field to track daily usage and avoid exceeding quotas.
- Use HTTPS: Ensure all requests are sent over HTTPS to protect sensitive data.
- Connection Errors: Verify that WEBHOOK_URL is correct and accessible.
- Invalid Payload: Double-check the format and values of code, action, quantity, and symbol.
- Authentication Issues: Confirm that the WEBHOOK_CODE matches the code provided by Psyll.
- Exchange-Specific Errors: Ensure the selected exchange supports the specified symbol and that your API keys have the necessary permissions.
- Psyll Homepage - Psyll homepage
- Psyll Webhook Homepage - Psyll webhook page
- Webhook documentation - Psylls's webhook documentation pages
Contributions are welcome ❤️ To contribute:
- Fork the repository.
- Create a new branch for your changes git checkout -b feature/new-example)`.
- Commit your changes with a clear message git commit -m "Add example for <language>")`.
- Submit a pull request with a detailed description of your changes.
Please ensure your code adheres to the repository's style guidelines and includes appropriate documentation.
This project is licensed under the MIT License. See the LICENSE file for details.



