Webhook Queries

I have a few questions regarding webhook feature.

  1. Why the 24 hours token validity is recommended for the Webhook URL?
    Is there any special advantage with 24 hours validity?
    or
    Is there any potential disadvantage or risk with longer validity of the Webhook
    URL?

  2. Do we need to log into the tradingview trading panel using Dhan credentials
    for using webhook feature?

  3. Will it still work even if we shut down our system after submitting the alerts with
    Dhan webhook URLs in Tradingview app?

Hello @trader7626

Great to know that you are exploring Dhan Webhooks.

  1. The reason for recommending 24 hour validity on Webhooks is to ensure that your alerts do not trigger orders post the 24 hour active window. This is applicable for people who use alerts and place order for one day, they might miss out some active alerts in their account which might get triggered the next day without their knowledge, no other reason for this.
  2. No. Webhooks and Trading Panel work independently. Although if you do want to use TradingView.com for monitoring your positions as well (even for orders placed via Webhooks), then this can work as a great add-on.
  3. Yes. TradingView has alerts based on clouds which work even when the platform is not opened on any devices. You can read more about it here - About TradingView alerts — TradingView India
  1. So does that mean the order placed in the Tradingview via Webhook will remain active in the system overnight also or until the validity of the Webhook URL?

  2. Is it really possible to submit multiple orders by creating multiple Webhook URLs and Alerts in the same script or multiple different scripts one after the other even before our earlier orders have executed?
    When we try to generate a new URL it flashes a message on the screen that ‘Generating new URL will disable all existing URLs’.
    So, the question is does the earlier Webhook URL and its associated Order with its Json remain active in the system or it gets deactivated and disabled when we try to create a new URL for a new order in the same or another script?

Hello @trader7626

Yes, the webhook will remain active in the system till the validity of the URL. Even your alerts set on tradingview.com work in the same way.

Yes, you can create multiple orders with a single Webhook URL itself.
Your orders can be across segments or exchanges and even multiple in number associated with a single webhook URL itself.

Do note that the message displayed when generating new URL clearly mentions that if you create a new URL, then existing alerts will get disabled. As your account is linked to one webhook URL which is in turn linked to many alert generated orders, if you generate a new URL, then existing alerts will not work.

Yes ,So my intention is to place different orders based on different alerts placed at different price points.
The alerts can be on different scripts and the corresponding orders also could be on different scripts.
e,.g I placed a conditional order in MRF Futures based on a particular alert at a particular price point on the MRF Stock. Then I want to place another order in Axisbank Futures based on a different alert on Axis bank stock at a particular price point. Then should I not change the webhook URL for Axis bank Alert for its corresponding order?
Does that mean I should not change the URL for placing every different order in the same script or even on the different script for different alerts?
I noticed that every time I click on manage button on the Webhook URL page the same URL gets populated but the validity always reverts back to 24 hours even if for the previous alert I had used it with 30 days validity.
Should I use the same URL and not try to change it?

@trader7626

Yes, you should use the same URL for all the alerts, no matter which segment or order type it is.

  1. So that means once a URL is pasted on the notifications page of the first alert that we create the next time we should only select a new script and create a new json for our next order?
    Is that how we should place multiple orders just by changing the script and the corresponding Json and not bothering with the Webhook URL?

  2. How to delete the webhook URL from the Alert Window?
    I also noticed that once we paste a webhook URL in the designated box on the Alert window, every new Alert window on the same script or even on any other script starts displaying the last used webhook URL by default and it does not allow us to submit a simple Alert without a webhook URL.
    If we try to delete the URL and create and submit the alert without the URL it displays a message that Alert cannot be submitted without Webhook URL.
    In future for some alerts if we do not want our alert to be associated with the webhook URL obtained from Dhan then what do we do?
    How do we dissociate our alerts on Tradingview from Dhan webhook URL?

  3. How do we keep track of the expiry of the URL?
    Is there any notification or message that flashes on the Web platform of Dhan that our last generated URL has expired and we need to create a new URL?

  4. How and where do we track the orders which we have submitted through a webhook?
    After submission of the Webhook URL and the Json in the Alert configuration window, when we change to another page on Dhan web portal and come back again on the Webhook page, we find it is clean and ready to accept another webhook order. The previously submitted webhook orders are not seen in pending orders page or anywhere else on the Dhan Web portal.
    How do we track those orders and the corresponding Jsons as the webhooks are likely to expire very soon based on their validity?
    After submitting multiple orders on various scripts how do we remember in which scripts we have placed the orders?
    How many total orders have we placed through the last WEbhook URL?
    If we want to review some of the orders say if we want to modify some of those orders any time before execution in terms of quantity or price then how do we do it? Or
    if we change our mind for some scripts and we want to cancel some of the orders how do we do it and also where and how do we get the record or a list of orders submitted through webhook?

Hello @trader7626

  1. Yes, this is how the intended flow is. In fact you can even have multiple orders for same script (instrument) as well.
  2. If it is a simple alert, then as long as you do not place order JSON in the message box, your order will not get executed on Dhan. Meanwhile, this error is from TradingView end. You can actually unclick checkbox for webhook URL on TradingView alert window to proceed without Webhook URL and yet create an alert.

    Unclick this checkbox to create simple alert.
  3. No, this is not present right now. However, it is a great feedback, will try to implement this.
  4. All of this has to be managed from TradingView alert window. Once alert is generated and we receive order at Dhan, then you can manage the orders just like any other order on Dhan.

You have mentioned that all this has to be managed from the Tradingview Alert window but even on Tradingview Alert window how to keep track of Expiry of the Webhook URL ?
I mean on the alerts window we do not get to see the expiry date of the URL anywhere.

a) When we revisit the charts on the Tradingview and open those alert configuration windows how do we know that the URL pasted in that notification page is still valid and not expired?

b) How do we know that the Json that is visible in the message window is also valid, active and correct for the order?

c) Is there any connection between the Webhook URL and the Json also?
I mean if we change the webhook URL in the notification page of the Alert window then is it necessary to create a new Json also for the same order that we had previously submitted?

Hello @trader7626

  1. Agreed. The validity of URL cannot be checked on TradingView panel. But since, at any given point of time, only one Webhook URL will be active, you can always confirm whether only active Webhook URL is pasted on TradingView alerts or not.
  2. This has to be ensured at your end. It will be difficult for us to store all created order JSONs at scale, also this beats the purpose of Webhook orders which can be placed without even coming to Dhan Platform.
  3. Yes. There is a secret code that links Webhook URL to JSON, which also needs to be changed when URL is changed.