Skip to content

Notification module

Ben edited this page Apr 12, 2017 · 5 revisions

Notification module

The notification module provides two type of notifications: address notifications and transaction notifications. You can subscribe to the Address Subscription and Transaction Subscription by the following APIs to receive the Address Notification and Transaction Notification

API endpoints

Address Subscription

Transaction Subscription

Address Subscription APIs

POST /notification/v1/address/subscription

Description

Create an address subscription

Parameter

Field Type Description
address str address
callback_url url a webhook allows you to receive a notification

Sample Response

{
  "id": "c898943d-ac2e-42c8-afdc-a8f1a61d86a8",
  "address": "1ABFCkDV6QUbin3PEiHBs3pPBZgs8kHzhB",
  "callback_url": "http://example.com",
  "created_time": "2016-08-17T07:42:12.489Z"
}

GET /notification/v1/address/subscription/[:subscription_id]

Description

Get an address subscription

Parameter

None

Sample Response

{
  "id": "c898943d-ac2e-42c8-afdc-a8f1a61d86a8",
  "address": "1ABFCkDV6QUbin3PEiHBs3pPBZgs8kHzhB",
  "callback_url": "http://example.com",
  "created_time": "2016-08-17T07:42:12.489Z"
}

POST /notification/v1/address/subscription/[:subscription_id]/delete

Description

Delete an address subscription

Parameter

None

Sample Response

{
  "deleted": true,
  "id": "c898943d-ac2e-42c8-afdc-a8f1a61d86a8"
}

Transaction Subscription APIs

POST /notification/v1/tx/subscription

Description

Create a transaction subscription

Parameter

Field Type Description
tx_hash str transaction hash
confirmation_count int confirmation threshold
callback_url url a webhook allows you to receive a notification

Sample Response

{
  "id": "bd84e443-daa9-4000-a0ea-f162d273937a",
  "tx_hash": "e6372839ab539785191f9fcdb19e015ad0e72143709f14e50dc5f6d069dd888f",
  "confirmation_count": 3,
  "callback_url": "http://example.com",
  "created_time": "2016-08-17T07:49:41.706Z"
}

GET /notification/v1/tx/subscription/[:subscription_id]

Description

Get a transaction subscription

Parameter

None

Sample Response

{
  "id": "bd84e443-daa9-4000-a0ea-f162d273937a",
  "tx_hash": "e6372839ab539785191f9fcdb19e015ad0e72143709f14e50dc5f6d069dd888f",
  "confirmation_count": 3,
  "callback_url": "http://example.com",
  "created_time": "2016-08-17T07:49:41.706Z"
}

POST /notification/v1/tx/subscription/[:subscription_id]/delete

Description

Delete a transaction subscription

Parameter

None

Sample Response

{
  "deleted": true,
  "id": "bd84e443-daa9-4000-a0ea-f162d273937a"
}

Address Notification

POST callback_url

When the address event that you subscribe happened. Your webhook will receive an address notification

Sample Reqeust

{
    "notification_id": "680aba58-3a86-4a07-b025-97d39830a397",
    "subscription_id": "c898943d-ac2e-42c8-afdc-a8f1a61d86a8",
    "tx_hash": "e6372839ab539785191f9fcdb19e015ad0e72143709f14e50dc5f6d069dd888f",
}

Transaction Notification

POST callback_url

When the transaction event that you subscribe happened. Your webhooks will receive an transaction notification

Sample Request

{
    "notification_id": "299f4f3f-71a7-4cb5-bb21-564e4c0f81bf",
    "subscription_id": "bd84e443-daa9-4000-a0ea-f162d273937a",
    "tx_hash": "e6372839ab539785191f9fcdb19e015ad0e72143709f14e50dc5f6d069dd888f",
}