TonicPow will send events related to your application to the webhook URL you specify when creating an application. You can expect webhooks to arrive as a POST request to the endpoint you provide, and it should return a 200 when called.
Method: POST
Expected Response: 200 (StatusOK)
The following are the various action types you can expect to receive from the TonicPow API via webhook, and the structure of the data contained in the request.
Click webhook will be triggered after a click that was batched has been processed and a txid was broadcasted to the Bitcoin network.
{ "type": "click", "data": { "amount": number, // amount in satoshis "campaign_id": number, // associated campaign id "campaign_slug": string, // campaign URL slug "tncpw_session": string, // visitor session "tx_id": string, // payout tx_id } }
Conversion webhook will be triggered after a conversion that was batched has been processed and a txid was broadcasted to the Bitcoin network.
{ "type": "conversion", "data": { "amount": number, // amount in satoshis "campaign_id": number, // associated campaign id "campaign_slug": string, // campaign URL slug "tncpw_session": string, // visitor session "tx_id": string, // payout tx_id "goal_id": number, // associated goal id } }
Once you have a webhook added to your application, you can manually trigger test events to preview what a valid webhook would send you when triggered. To do this, you can click the "Test Click" and "Test Conversion" buttons from the app details page.
When testing a webhook, you will receive a payload that is identical in format to what will be sent, except the "type" field will be prefixed with "test_", so testing a click will produce a payload that looks like a typical click, but will have a dummy value for campaign ID, and "test_click" for the payload type.