Skip to content

Webhook Order Updates

Introduction

Webhook empowers traders to receive real-time updates on order-related events directly from our system. Traders can register their webhook endpoint, and our system will notify them asynchronously whenever there is a relevant change in the order status. Use the methods below to subscribe and unsubscribe for order updates.

Authorization Type: Bearer Token

Order Status Feed WebSocket API

The Order Status Feed WebSocket API allows clients to receive real-time updates on their order status. The process involves initial authentication to obtain an order token, followed by establishing a WebSocket connection using this token. Clients must maintain the connection by sending regular heartbeats to keep the connection alive.

Authentication

GET ws/createWsToken

Headers

Authorization: Bearer Token

Response

{
    "status": "Ok",
    "message": "200",
    "result": [
        {
            "orderToken": "134abeea07eed35dec11ccc4e5cdb435a957e84ca8fa88032ce48706cffa5e7f"
        }
    ]
}
Order token that will be used to establish the Websocket connection

Websocket Connection

Step 2: Connect to Websocket

wss://protrade.jainam.in/omo/odrest/websocket

Request

After successful connection send order token and user ID to subscribe.

Sample Payload:

{
    "orderToken": "<Order_Token>",
    "userId": "<User_ID>"
}

Response

    { 
        "status": "Ok" 
    } 
Upon successful connection user with start receiving their order feeds.

Heartbeat

Step 3: Send Heartbeat

Request

To maintain the WebSocket connection, clients must send a heartbeat message every minute.

Sample Payload:

          { 
              "heartbeat": "h", 
              "userId":"<User_ID>"
          }

Notes: Failure to send a heartbeat every minute will result in the connection being closed. Clients must re-establish the connection if it is closed.

Order Status Feed

Request

Once connected, clients will receive real-time updates on their order status.

Sample Payload:

{
    "MessageType": "ORD_NRML",
    "ManagerID": "8",
    "OrderNumber": "0",
    "CliOrderNumber": 1,
    "Exchange": "1",
    "ScripCode": "25",
    "Symbol": "ADANIENT",
    "Series": "EQ",
    "InstrumentName": "",
    "ExpiryDate": "",
    "StrikePrice": 0,
    "Option_Type": "",
    "Buy_Sell": "1",
    "OrderOriginalQty": 1,
    "PendingQty": 1,
    "TradedQTY": "0",
    "DQ": 0,
    "DQRemaining": 0,
    "OrderPrice": 227000,
    "TriggerPrice": 0,
    "OrderType": 2,
    "MarketType": 1,
    "OrderStatus": 15,
    "Reason": "Order failed surveillance for user_ID and was rejected by Admin Serverron/cancellation requestestPRO BUY",
    "OrderValidity": "1",
    "Days": "0",
    "ProCli": "1",
    "UserID": "35941",
    "PartCode": "",
    "OrderEntryTime": "01-Feb-2025 16.26.05",
    "LastModifiedTime": "01-Feb-2025 16.26.05",
    "CP_ID": "",
    "UCC": "<User_ID>",
    "Product": "M",
    "InitiatedBy": "APIMOBILE",
    "ModifiedBy": "APIMOBILE",
    "InitiatedByUserId": "<User_ID>",
    "ModifiedByUserId": "<User_ID>",
    "LegIndicator": "",
    "UserRemarks": "-1",
    "Misc": "",
    "SpreadFlag": 0,
    "SpreadPrice": 0,
    "AMOOrderID": "",
    "GTDOrderStatus": 0,
    "MessageSequenceNumber": "20250310001149850",
    "UniqueCode": "OKUAU0000112"
} 

Summary:

  1. Authenticate: Obtain the order_token by calling GET https://protrade.jainam.in/odrest/ws/createWsToken with a valid bearer token.
  2. Connect: Establish a WebSocket connection to wss://protrade.jainam.in/omo/odrest/websocket and send orderToken and userId to subscribe.
  3. Heartbeat: Send a heartbeat message every minute to keep the connection alive.
  4. Receive Updates: Listen for real-time order status updates. Additional Notes: Ensure your WebSocket client can handle reconnections in case of disconnections. Maintain the security of your bearer token and order token at all times. By following the steps outlined above, clients can successfully integrate with the Order Status Feed WebSocket API and receive timely updates on their orders.