Webhooks Asynchronous Endpoints
This Webhooks
endpoint provides asynchronous methods to interact with the webhooks of the authenticated user.
Example usage of the Webhooks endpoint object:
import asyncio
from pyrevolut.client import AsyncClient
CREDS_JSON_LOC = "path/to/creds.json"
client = AsyncClient(
creds_loc=CREDS_JSON_LOC,
sandbox=True,
)
async def run():
async with client:
webhooks = await client.Webhooks.get_all_webhooks()
print(webhooks)
asyncio.run(run())
EndpointWebhooksSync
Bases: BaseEndpointWebhooks
The Webhooks API
A webhook (also called a web callback) allows your system to receive updates about your account to an HTTPS endpoint that you provide. When a supported event occurs, a notification is posted via HTTP POST method to the specified endpoint.
If the receiver returns an HTTP error response, Revolut will retry the webhook event three more times, each with a 10-minute interval.
The following events are supported:
TransactionCreated TransactionStateChanged PayoutLinkCreated PayoutLinkStateChanged
Source code in pyrevolut/api/webhooks/endpoint/synchronous.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
|
create_webhook(url, events=None, **kwargs)
Create a new webhook to receive event notifications to the specified URL. Provide a list of event types that you want to subscribe to and a URL for the webhook. Only HTTPS URLs are supported.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
A valid webhook URL to which to send event notifications. The supported protocol is https. |
required |
events |
list[EnumWebhookEvent]
|
A list of event types to subscribe to. If you don't provide it, you're automatically subscribed to the default event types: - TransactionCreated - TransactionStateChanged |
None
|
Returns:
Type | Description |
---|---|
dict | Response
|
The response model for the request. |
Source code in pyrevolut/api/webhooks/endpoint/synchronous.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|
delete_webhook(webhook_id, **kwargs)
Delete a specific webhook.
A successful response does not get any content in return.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
webhook_id |
UUID
|
The ID of the webhook. |
required |
Returns:
Type | Description |
---|---|
dict | Response
|
An empty dictionary. |
Source code in pyrevolut/api/webhooks/endpoint/synchronous.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
|
get_all_webhooks(**kwargs)
Get the list of all your existing webhooks and their details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
None |
|
required |
Returns:
Type | Description |
---|---|
list[dict] | list[Response]
|
The list of all your existing webhooks and their details. |
Source code in pyrevolut/api/webhooks/endpoint/synchronous.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
get_failed_webhook_events(webhook_id, limit=None, created_before=None, **kwargs)
Get the list of all your failed webhook events, or use the query parameters to filter the results.
The events are sorted by the created_at date in reverse chronological order.
The returned failed events are paginated. The maximum number of events returned per page is specified by the limit parameter. To get to the next page, make a new request and use the created_at date of the last event returned in the previous response.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
webhook_id |
UUID
|
The ID of the webhook. |
required |
limit |
int
|
The maximum number of events returned per page. To get to the next page, make a new request and use the created_at date of the last event returned in the previous response as value for created_before. If not specified, the default value is 100. |
None
|
created_before |
datetime | DateTime | str | int | float
|
Retrieves events with created_at < created_before. Cannot be older than the current date minus 21 days. The default value is the current date and time at which you are calling the endpoint. Provided in ISO 8601 format. |
None
|
Returns:
Type | Description |
---|---|
list[dict] | list[Response]
|
The list of all your failed webhook events. |
Source code in pyrevolut/api/webhooks/endpoint/synchronous.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
get_webhook(webhook_id, **kwargs)
Get the information about a specific webhook by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
webhook_id |
UUID
|
The ID of the webhook. |
required |
Returns:
Type | Description |
---|---|
dict | Response
|
The information about the webhook. |
Source code in pyrevolut/api/webhooks/endpoint/synchronous.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
rotate_webhook_secret(webhook_id, expiration_period=None, **kwargs)
Rotate a signing secret for a specific webhook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
webhook_id |
UUID
|
The ID of the webhook. |
required |
expiration_period |
Duration
|
The expiration period for the signing secret in ISO 8601 format. If set, when you rotate the secret, it continues to be valid until the expiration period has passed. Otherwise, on rotation, the secret is invalidated immediately. The maximum value is 7 days. |
None
|
Returns:
Type | Description |
---|---|
dict | Response
|
The response model for the request. |
Source code in pyrevolut/api/webhooks/endpoint/synchronous.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
update_webhook(webhook_id, url=None, events=None, **kwargs)
Update an existing webhook. Change the URL to which event notifications are sent or the list of event types to be notified about.
You must specify at least one of these two. The fields that you don't specify are not updated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
webhook_id |
UUID
|
The ID of the webhook. |
required |
url |
str
|
A valid webhook URL to which to send event notifications. The supported protocol is https. |
None
|
events |
list[EnumWebhookEvent]
|
A list of event types to subscribe to. |
None
|
Returns:
Type | Description |
---|---|
dict | Response
|
The response model for the request. |
Source code in pyrevolut/api/webhooks/endpoint/synchronous.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
|