ការណែនាំអំពីការអនុវត្ត Webhook
ចុះឈ្មោះ URL HTTPS មួយ ហើយទទួលការជំរុញព្រឹត្តិការណ៍ដែលមានហត្ថលេខា HMAC ជាពេលវេលាពិតនៅពេលដែលសញ្ញាប្រាក់ដុំឆ្លាតដំណើរការ — គ្មានការស្ទង់។ ការណែនាំនេះគ្របដណ្តប់លើការចុះឈ្មោះ ការតម្រងព្រឹត្តិការណ៍ ការផ្ទៀងផ្ទាត់ហត្ថលេខា និងឥរិយាបថព្យាយាមម្តងទៀត។
ទិដ្ឋភាពទូទៅ
ជំនួសឱ្យការស្ទង់ /v1/confirm ឬការផ្គត់ផ្គង់សញ្ញា ចុះឈ្មោះ webhook ហើយ Smart Money API នឹង POST ព្រឹត្តិការណ៍មួយទៅចំណុចបញ្ចប់របស់អ្នកនៅពេលដែលសញ្ញាដែលត្រូវគ្នាដំណើរការ។ រាល់ការផ្ញើត្រូវបានចុះហត្ថលេខាជាមួយ HMAC-SHA256 ដូច្នេះអ្នកអាចផ្ទៀងផ្ទាត់ថាវាពិតជាមកពីយើង។
Webhooks ចេញគឺអាចប្រើបាននៅលើ Pro និងផែនការសហគ្រាស។
ចុះឈ្មោះ Webhook
POST ទៅ /v1/webhooks ជាមួយនឹងកូនសោ API របស់អ្នកនៅក្នុង X-API-Key ក្បាល។ ត្រូវការបួនផ្នែកនៅក្នុងផ្នែករាងកាយ៖
| ផ្នែក | ប្រភេទ | ការពិពណ៌នា |
|---|---|---|
| url | string | ចំណុចបញ្ចប់ HTTPS ដើម្បីទទួលព្រឹត្តិការណ៍ (ត្រូវតែចាប់ផ្តើមដោយ https://) |
| events | array | ឈ្មោះព្រឹត្តិការណ៍ដើម្បីទទួល ឧ. ["HIGH","MEDIUM","VETO"] ឬ ["*"] |
| symbols | array | និមិត្តសញ្ញាដើម្បីតម្រង ឧ. ["BTC","ETH"] ឬ ["*"] |
| secret | string | អាថ៌កំបាំងចុះហត្ថលេខារបស់អ្នក — យ៉ាងហោចណាស់ ១៦ តួអក្សរ។ ត្រូវបានផ្ទុកជាអាស្រ័យ hash; រក្សាតម្លៃដើមនៅខាងអ្នកដើម្បីផ្ទៀងផ្ទាត់ហត្ថលេខា។ |
តម្រងព្រឹត្តិការណ៍
ការផ្ញើដំណើរការសម្រាប់ព្រឹត្តិការណ៍ដែលឈ្មោះ និងនិមិត្តសញ្ញាត្រូវគ្នានឹងការចុះឈ្មោះរបស់អ្នក។ ឈ្មោះព្រឹត្តិការណ៍ធម្មតាគឺជាប៉ាន់ស្មានទំនុកចិត្ត — HIGH, MEDIUM, VETO — បូកជាមួយព្រឹត្តិការណ៍ទូទៅ SIGNAL ព្រឹត្តិការណ៍។ ប្រើ ["*"] ដើម្បីទទួលព្រឹត្តិការណ៍ទាំងអស់ ឬនិមិត្តសញ្ញាទាំងអស់។
ការផ្ញើ និងក្បាល
រាល់ការផ្ញើគឺជា HTTP POST ជាមួយនឹងផ្នែករាងកាយ JSON និងក្បាលទាំងនេះ៖
| Header | Value |
|---|---|
| X-SmartMoney-Event | The event name (e.g. HIGH) |
| X-SmartMoney-Signature | HMAC-SHA256 hex digest of the request body (see below) |
| Content-Type | application/json |
| User-Agent | SmartMoneyAPI-Webhook/1.0 |
Respond with any 2xx status to acknowledge. Non-2xx (or a timeout) triggers a retry.
Verifying Signatures
The signature in X-SmartMoney-Signature is an HMAC-SHA256 hex digest of the request body. The HMAC key is the SHA-256 hex digest of the secret you registered (your raw secret is only ever stored hashed on our side). To verify: derive the key, HMAC the raw body, and compare with a constant-time check. Reject any request that fails.
Retries
If your endpoint does not return a 2xx (or times out — the delivery timeout is 10s), Smart Money API retries up to 3 times with exponential backoff (approximately 1s, 4s, then 16s). Make your handler idempotent so a re-delivered event is safe to process twice.
Inbound Webhooks (TradingView)
Separately, you can send an inbound alert to us. POST /v1/tradingview/webhook receives a TradingView alert, runs it through /confirm, and returns the confirmation. Because TradingView cannot send custom headers, it authenticates via a secret field in the JSON body (not X-API-Key). Send secret, symbol, and direction (long/short); optionally timeframe, strategy, and price.
Ready to wire up real-time signals?
Get your API key