NOTIFICATIONS
A través de este servicio, se podran recibir notificaciones mediante webhooks, las cuales estaran basadas en diferentes eventos organizados en distintos tópicos. Para poder hacer uso de estas notificaciones, se deberá abrir un endpoint que acepte métodos POST. Se puede utilizar un solo endpoint para todos los tópicos, o se pueden usar distintos endpoints para distintos tópicos, esto es a decisión de cómo se quiere organizar para recibir los webhooks. Para la configuración inicial de recibir los hooks, por favor hablar con el/los responsables a cargo de API Broker.
GET/ notifications/topics
Endpoint para consultar todos los topicos disponibles.
- URL del Endpoint:
GET/{{baseUrl}}/api/notifications/topics/
Para obtener la informacion de un topico en especifico se debe pasar por path param el id del topico.
- URL del Endpoint:
GET/{{baseUrl}}/api/notifications/topics/{topic_id}
Campo | Tipo | Descripción |
---|---|---|
topic_id | int | Código identificador del topico. |
name | str | Nombre del topico. |
event_type | int | Tipo de evento. |
is_active | bool | Indica si el tópico está activo |
Response:
{
"items": [
{
"topic_id": "int",
"name": "str",
"event_type": "str",
"is_active": "bool"
}
]
}
GET/ notifications/client-hooks
Endpoint para obtener todas las configuraciones de webhooks.
- URL del Endpoint:
GET/{{baseUrl}}/api/notifications/client-hooks/
Para obtener la configuración de un webhook específico se debe enviar por path param el client_hook_id.
- URL del Endpoint:
GET/{{baseUrl}}/api/notifications/client-hooks/{client_hook_id}
Campo | Tipo | Descripción |
---|---|---|
client_hook_id | int | Código identificador del webhook. |
username | str | Nombre de usuario. |
webhook_url | str | URL del webhook |
auth | str | Método de autenticación |
topics | array | Lista de tópicos suscritos a ese webhook |
El campo "auth" puede tomar uno de los siguientes valores:
- bearer: Para autenticación mediante Bearer Token.
- basic: Para autenticación mediante credenciales básicas (usuario y contraseña).
- header_token: Para autenticación mediante tokens en los encabezados.
Response:
{
"items": [
{
"client_hook_id": "int",
"username": "str",
"webhook_url": "str",
"auth": "str",
"topics": [
{
"topic_id": "int"
},
{
"topic_id": "int"
}
]
}
]
}
PATCH/ notifications/client-hooks
Endpoint para actualizar la URL de un webhook.
- URL del Endpoint:
PATCH/{{baseUrl}}/api/notifications/client-hooks/{client_hook_id}
Request:
{
"webhook_url": "str"
}
Response:
{
"items": [
{
"client_hook_id": "int",
"username": "str",
"webhook_url": "str",
"auth": "str",
"topics": [
{
"topic_id": "int"
},
{
"topic_id": "int"
}
]
}
]
}
PATCH/ notifications/client-hooks/credentials
Endpoint para actualizar las credenciales de autenticación de un webhook.
- URL del Endpoint:
PATCH/{{baseUrl}}/api/notifications/client-hooks/{client_hook_id}/credentials
En el campo "auth" se debera especificar el tipo de autentificacion y en el objeto "credentials" las nuevas credenciales de acuerdo con el metodo de autentificacion. Los valores de los campos dentro del objeto credentials son case sensitive.
Request en caso de realizar la autenticación mediante bearer:
{
"auth": "bearer",
"credentials": {
"token": "str"
}
}
Request en caso de realizar la autenticación mediante basic:
{
"auth": "basic",
"credentials": {
"username": "str",
"password": "str"
}
}
Request en caso de realizar la autenticación mediante header token:
{
"auth": "header_token",
"credentials": [
{
"header": "str",
"token": "str"
},
{
"header": "str",
"token": "str"
}
]
}
Response:
{
"items": [
{
"client_hook_id": "int",
"username": "str",
"webhook_url": "str",
"auth": "str",
"topics": [
{
"topic_id": "int"
},
{
"topic_id": "int"
}
]
}
]
}
Ejemplos de notificaciones
En esta sección se presentan diferentes ejemplos de notificaciones. En todos los casos, la notificación contiene el campo "topic" con el nombre del tópico, y los mismos campos que se obtienen en las respuestas de los otros endpoints de los demas servicios.
Desplegar para ver el cuerpo de la notificacion.
Ejemplo de notificacion correspondiente al topico: account_statements_update
{
"topic": "account_statements_update",
"items": [
{
"available_amount": {
"stock_market": {
"ARS": {
"t1": {
"amount": 100
},
"t2": {
"amount": 100
},
"t0": {
"amount": 100
}
},
"USD-C": {
"t1": {
"amount": 0
},
"t2": {
"amount": 0
},
"t0": {
"amount": 0
}
},
"USD": {
"t1": {
"amount": 0
},
"t2": {
"amount": 0
},
"t0": {
"amount": 0
}
}
}
},
"bcra_blocked": {
"stock_market": {
"ARS": {
"t1": {
"amount": 0
},
"t2": {
"amount": 0
},
"t0": {
"amount": 0
}
},
"USD-C": {
"t1": {
"amount": 0
},
"t2": {
"amount": 0
},
"t0": {
"amount": 0
}
},
"USD": {
"t1": {
"amount": 0
},
"t2": {
"amount": 0
},
"t0": {
"amount": 0
}
}
}
},
"available_holdings": [
{
"market_type": "stock_market",
"instrument_id": null,
"quantity": 100,
"quantity_available": 100,
"quantity_t1": 0,
"quantity_t2": 0,
"quantity_future": 0,
"quantity_unavailable": 0,
"available_t0": 100,
"available_t1": 100,
"available_t2": 100,
"instrument_description": "Pesos",
"instrument_type": "CURRENCY",
"ticker": "ARS",
"updated_at": "2024-07-17T15:17:20.039940+00:00"
},
{
"market_type": "stock_market",
"instrument_id": 61,
"quantity": 10,
"quantity_available": 10,
"quantity_t1": 0,
"quantity_t2": 0,
"quantity_future": 0,
"quantity_unavailable": 0,
"available_t0": 10,
"available_t1": 10,
"available_t2": 10,
"instrument_description": "AMAZON.COM INC. ",
"instrument_type": "CEDEAR",
"ticker": "AMZN",
"updated_at": "2024-07-17T15:17:20.040500+00:00"
}
],
"investment_account_id": 46255
}
]
}
Ejemplo de notificacion correspondiente al topico: market_order_update
{
"topic": "market_order_update",
"items": [
{
"market_order_id": 635725,
"investment_account_id": 47738,
"market_instrument_id": 41,
"ticker": "AL30",
"market_operation_type": "buy",
"amount": 642.69,
"net_amount": 642.69,
"estimated_expenses": 0.33,
"include_expenses_in_amount": true,
"by_amount": false,
"at_market_price": true,
"quantity": 1,
"currency_id": "ARS",
"term": 0,
"instrument_price": 642.36,
"instrument_type": "GOVERNMENT_BOND",
"external_id": "external_id",
"trade_date": "2024-07-17",
"created_at": "2024-07-17T18:25:34Z",
"settlement_date": null,
"updated_at": null,
"market_order_status_id": "COMPLETED",
"executed_quantity": 1,
"pending_quantity": 0
}
]
}
Ejemplo de notificacion correspondiente al topico: investment_account_update
{
"topic":"investment_account_update",
"items":[
{
"external_id":"test_001",
"investment_account_id":"123456",
"investment_risk_profile":"AGGRESSIVE",
"owners":[
{
"person_id":"F-f9f9453f-7650-4cc3-b735-efdc14843f40",
"person_role_id":"TI"
}
],
"market_types":[
{
"market_type":"stock_market",
"is_created":true,
"data":{
"market_account_number":123654
},
"is_enabled":true
}
]
}
]
}