/get_webhooks
Gets the list of generated webhooks with detailed information.
Requests
The request body at this endpoint is the header_msg
JSON object.
Only authsignature
header is required for this request.
POST /0.2/get_webhooks HTTP/1.1
Host: sandbox.silamoney.com
authsignature: [GENERATED AUTHSIGNATURE HEX STRING HERE]
Content-Type: application/json
{
"header": {
"created": 1234567890,
"auth_handle": "handle.silamoney.eth",
"version": "0.2",
"crypto": "ETH",
"reference": "<your unique id>"
},
"message": "header_msg",
"search_filters": {
"uuid": "some UUID string assigned by Sila",
"delivered": true,
"sort_ascending": false,
"event_type": 'kyc_update',
"endpoint_name": 'receiver'
"user_handle": 'user',
"start_epoch": 1234567860,
"end_epoch": 1234567891,
"page": 1,
"per_page": 20
}
}
***
HTTP/1.1 200 OK
{
"success": true,
"status": "SUCCESS",
"response_time_ms": "171",
"page": 1,
"returned_count": 2,
"total_count": 2,
"webhooks": [
{
"user_handle": "user",
"uuid": "1dc1294f-8100-40e3-8240-49679a10576a",
"delivered": false,
"details": {
"kyc": "cd449904-1de6-45b6-89f6-634ac8cf0f10",
"entity": "user"
"outcome": "pending",
},
"attempts": 1,
"responses": [
{
"created": "1634577920",
"status_code": 200
}
],
"processing": true,
"created_epoch": 1582754399,
"last_update_epoch": 1582754414,
"next_attempt_epoch": "",
"event_type": "kyc_update",
"endpoint_name": "receiver_2",
"endpoint_url": "http://localhost/receiver-2"
},
{
"user_handle": "user",
"uuid": "d830a9d9-1e05-42e5-8a38-6c4598e49789",
"delivered": false,
"details": {
"kyc": "cd449904-1de6-45b6-89f6-634ac8cf0f10",
"entity": "user"
"outcome": "passed",
},
"attempts": 1,
"responses": "responses": [
{
"created": "1634577920",
"status_code": 200
}
],
"processing": true,
"created_epoch": 1582784399,
"last_update_epoch": 1582794414,
"next_attempt_epoch": "",
"event_type": "kyc_update",
"endpoint_name": "receiver_2",
"endpoint_url": "http://localhost/receiver-2"
},
]
}
var searchFilters = {
"uuid": "some UUID string assigned by Sila",
"delivered": true,
"sort_ascending": false,
"event_type": 'kyc_update',
"endpoint_name": 'receiver'
"user_handle": 'user',
"start_epoch": 1234567860,
"end_epoch": 1234567891,
"page": 1,
"per_page": 20
};
const res = await Sila.getWebhooks(userHandle, userPrivateKey, searchFilters);
// Success Response Object
console.log(res.statusCode); // 200
console.log(res.data.status);
console.log(res.data.success); // TRUE
console.log(res.data.page); // The # of page
console.log(res.data.returned_count); // # of wallets returned
console.log(res.data.total_count); // Total # of wallets
console.log(res.data.webhooks); // Wallets array
console.log(res.data.webhooks[0].created_epoch);
console.log(res.data.webhooks[0].last_update_epoch);
console.log(res.data.webhooks[0].next_attempt_epoch);
console.log(res.data.webhooks[0].event_type);
console.log(res.data.webhooks[0].endpoint_name);
console.log(res.data.webhooks[0].endpoint_url);
console.log(res.data.webhooks[0].uuid);
console.log(res.data.webhooks[0].delivered);
console.log(res.data.webhooks[0].endpoint_name);
console.log(res.data.webhooks[0].details);
console.log(res.data.webhooks[0].attempts);
console.log(res.data.webhooks[0].responses);
console.log(res.data.webhooks[0].processing);
console.log(res.data.webhooks[0].user_handle);
WebhookSearchFilters searchFilters = new WebhookSearchFilters();
searchFilters.setUuid("some UUID string assigned by Sila");
searchFilters.setDelivered(true);
searchFilters.setEventType("kyc_update");
searchFilters.setSortAscending(false);
searchFilters.setEndpointName("receiver");
searchFilters.setUserHandle("user handle");
searchFilters.setStartEpoch(1234567860);
searchFilters.setEndEpoch(1234567891);
searchFilters.setPage(1);
searchFilters.setPerPage(20);
ApiResponse response = api.getWebhooks("user handle", searchFilters);
System.out.println(response.getStatusCode()); // 200
GetWebhooksResponse parsedResponse = (GetWebhooksResponse) response.getData();
System.out.println(parsedResponse.getSuccess()); // true
System.out.println(parsedResponse.getStatus()); // SUCCESS
System.out.println(parsedResponse.getWebhooks().get(0).getUserHandle());
System.out.println(parsedResponse.getWebhooks().get(0).getUuid());
System.out.println(parsedResponse.getWebhooks().get(0).getDelivered());
System.out.println(parsedResponse.getWebhooks().get(0).getDetails().getKyc());
System.out.println(parsedResponse.getWebhooks().get(0).getDetails().getEntity());
System.out.println(parsedResponse.getWebhooks().get(0).getDetails().getOutcome());
System.out.println(parsedResponse.getWebhooks().get(0).getAttempts());
System.out.println(parsedResponse.getWebhooks().get(0).getResponses());
System.out.println(parsedResponse.getWebhooks().get(0).getProcessing());
System.out.println(parsedResponse.getWebhooks().get(0).getCreatedEpoch());
System.out.println(parsedResponse.getWebhooks().get(0).getLastUpdateEpoch());
System.out.println(parsedResponse.getWebhooks().get(0).getNextAttemptEpoch());
System.out.println(parsedResponse.getWebhooks().get(0).getEventType());
System.out.println(parsedResponse.getWebhooks().get(0).getEndpointName());
System.out.println(parsedResponse.getWebhooks().get(0).getEndpointUrl());
System.out.println(parsedResponse.getPagination().getReturnedCount());
System.out.println(parsedResponse.getPagination().getTotalCount());
System.out.println(parsedResponse.getPagination().getCurrentPage());
System.out.println(parsedResponse.getPagination().getTotalPages());
payload = {
"user_handle": "user.silamoney.eth"
}
response = User.get_webhooks(silaApp, payload, eth_private_key)
### Success Response Object
{
'success': True,
'webhooks': [{
'created_epoch': 1635760689,
'last_update_epoch': 1635760689,
'next_attempt_epoch': None,
'event_type': 'kyc_update',
'endpoint_name': 'kyc_update1',
'endpoint_url': 'http://www.silamoney.com',
'uuid': 'f0b9ae40-13fb-41e6-a6aa-9153a33c9abf',
'delivered': True,
'details': {
'kyc': '83206f2f-af98-4473-9c90-6c36b3c7c7db',
'entity': 'pahujxetoe',
'outcome': 'passed'
},
'attempts': 1,
'responses': [{
'created': '1635760689',
'status_code': 200
}],
'processing': False,
'user_handle': 'pahujxetoe'
}],
'page': 1,
'returned_count': 1,
'total_count': 1,
'pagination': {
'returned_count': 1,
'total_count': 1,
'current_page': 1,
'total_pages': 1
},
'status': 'SUCCESS',
'status_code': 200
}
### Failure Response Object
{
status: 'FAILURE'
}
$privateKey = "user private key";
$filters = new SearchFilters();
$response = $client->api->getWebhooks($privateKey, $filters);
echo $response->getStatusCode();
echo $response->getData()->status;
echo $response->getData()->success;
WebhooksSearchFilters searchFilters = new WebhooksSearchFilters();
ApiResponse<object> response = api.GetWebhooks(userHandle, searchFilters);
// searchFilters is optional
// Success Response Object
Console.WriteLine(response.StatusCode); // 200
Console.WriteLine(((GetWebhooksResponse)response.Data).Success); // true
Console.WriteLine(((GetWebhooksResponse)response.Data).Page); // Page number
Console.WriteLine(((GetWebhooksResponse)response.Data).ReturnedCount); // Returned count
Console.WriteLine(((GetWebhooksResponse)response.Data).TotalCount); // Total count.
Console.WriteLine(((GetWebhooksResponse)response.Data).Status); // SUCCESS
Console.WriteLine(((GetWebhooksResponse)response.Data).Pagination); // Pagination
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].Attempts); // Attempts
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].CreatedEpoch); // Created epoch
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].Delivered); // Delivered
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].EndpointName); // Endpoint name
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].EndpointUrl); // Endpoint url
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].EventType); // Event type
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].LastUpdateEpoch); // Last update epoch
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].NextAttemptEpoch); // Next attempt epoch
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].Processing); // Processing
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].UserHandle); // User handle
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].Uuid); // uuid
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].Responses[0].Created); // Responses created
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].Responses[0].StatusCode); // Responses statuscode
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].Details.Account); // Account
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].Details.AccountName); // Account Name
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].Details.Entity); // Entity
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].Details.KYC); // KYC
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].Details.Transaction); // Transaction
Console.WriteLine(((GetWebhooksResponse)response.Data).Webhooks[0].Details.TransactionType); // TransactionType
Key | Type | Description |
---|---|---|
header | JSON object | Required. Requires these keys in JSON format: created, app_handle. See the /check_handle endpoint for the complete list of fields in this object. |
search_filters | JSON object | Optional. Allows filtering results. |
search_filters. uuid (Webhook ID) | String | Optional. Webhook ID. The format should be a UUID string. Example: 5167160d-9d12-4fa8-a8cd-302507782de0 |
search_filters. sort_ascending | Boolean | Optional. Default: true Example: false |
search_filters. start_epoch | Integer | Optional. UTC Unix Timestamp. Minimum 0 Example: 1631610941 |
search_filters. end_epoch | Integer | Optional. UTC Unix Timestamp. Minimum 0 Example: 1631610950 |
search_filters.page | Integer | Optional. Min Length 1 Default: 1 |
search_filters. per_page | Integer | Optional. Min 1 Max 100 Default per page 20 |
search_filters.user_handle | String | Optional. Webhook user handle. Examples: user.silamoney.eth or user |
search_filters.delivered | Boolean | Optional. Webhook delivere to endpoint. Example: false |
search_filters.event_type | String | Optional. Webhook trigger type. Example: kyc_update |
search_filters.endpoint_name | String | Optional. Webhook endpoint name. Example: receiver_2 |
Responses
Status Code | success Attribute | Description |
---|---|---|
200 | true | Successfully fetched array of webhooks. |
400 | false | Bad request format - check validation_details for more information. |
401 | false | authsignature header was absent or incorrect. |
Key | Type | Description |
---|---|---|
uuid | UUID | An auto-generated ID for webhook. |
details | JSON | The event-specific payload will be included in the request. |
attempts | Integer | The number of attempts |
next_attempt_epoch | Integer | The next time that this Event should be attempted, if any |
responses | JSON | A JSON object structured as [{"created":TIMESTAMP,"status_code":RESPONSE_CODE} |
delivered | Boolean | True when Webhook returns a 200 status code. Will be set to FALSE if the maximum number of attempts on the related Webhook has been reached and no 200 response has been received. default Null |
processing | Boolean | Webhook in progress. default FALSE |
user_handle | String | User |
endpoint_name | String | Webhook endpoint name |
endpoint_url | String | Webhook endpoint url |
event_type | String | Webhook event type |
Updated about 3 years ago