Environment | Host | Port |
---|---|---|
production | api.lpb.lv | 5671 |
test | api-test.lpb.lv | 5671 |
API BaaS uses RabbitMQ to provide webhook functionality. All user notifications are stored in queues that follow format N.USER_ID
. You can get USER_ID
from decoded access token, property sub
. Notifications that didn't receive ACK are deleted after 4
days. Idle queues are deleted after 7
day period.
If you are not familiar with AMQP first thing you should do is download AMQP client that suits your system and try to reproduce following steps:
amqps://:ACCESS_TOKEN@api-test.lpb.lv:5671
;assertQueue
command; Queue name should match pattern N.USER_ID
and durable
property set true
;consume
;var amqp = require( 'amqplib/callback_api' );
var conn = ( error0, connection ) => {
if ( error0 ) {
throw error0;
}
connection.createChannel( ( error1, channel ) => {
if ( error1 ) {
throw error1
}
channel.assertQueue( 'N.49acf39b-0ff4-4c01-8dc9-d86f9d85b9d9', { durable: true } );
channel.consume( 'N.49acf39b-0ff4-4c01-8dc9-d86f9d85b9d9', message => {
console.log( message.content.toString() );
}, { noAck: true } );
} );
}
try {
amqp.connect( 'amqps://:eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJXTDVNdElqYk1aTUhDRzJrcmZjd3V1NEdmN2t2bFJEbGxkNGhPdVBteHljIn0.eyJleHAiOjE2NzM2MTUxODksImlhdCI6MTY3MzYxMzk4OSwianRpIjoiMmQ4ZTBlMGYtNmFmZi00ZmQyLWFlNTctMzE3YTdkNGQzOGVhIiwiaXNzIjoiaHR0cHM6Ly9hcGkubHBiLmx2L2F1dGgvcmVhbG1zL09FT0F1dGgiLCJhdWQiOiJvZWFibEFwcCIsInN1YiI6IjQ5YWNmMzliLTBmZjQtNGMwMS04ZGM5LWQ4NmY5ZDg1YjlkOSIsInR5cCI6IkJlYXJlciIsImF6cCI6ImxwYiIsInNlc3Npb25fc3RhdGUiOiIzMjVlZjA1ZC04N2RmLTQ0NzItYWRkMS1lYzIzMWU5YzZjMWEiLCJhY3IiOiIxIiwic2NvcGUiOiJQU0NVc2VyIiwiY2xpZW50X2lkIjoibHBiIn0.LiFjgMV5iez-vPJoS-JFVWrenqWie09L3Ki2rBwCK8PmrgsJb055HYbuLUXyT03CYxC98gnoQwJSohwoY3f2vZK8LRLxRjMfXsrdwSYGzbLC56gwSi8nMM8rF4w0iBJ9XAHZyKnWDNW_wrCDk0_LqEE0Mswf-rPXpYWHHhCxkX4SBjPYYSOb7YmKNg6mVBrJsdyTbiMnrZqrs0nXP4i3aGCQnPvZDSv2fBt7_KPzEAR1h9AyNf6cDxMG0DKcpv9HJEKOKUFDSw7F5UgNEuAzpc_ROupK-KUruHVHcdbYFYZWo9rQMRu7eT7ClCfzUn7zCftA_YWL7vWzP9C3IyeY0A@api-test.lpb.lv:5671', conn );
}
catch( error ) {
console.log( error );
}
Webhook notification is stored in JSON format. It has strict structure:
{
"category": "",
"timestamp": null,
"notification": {
"title": "",
"body": ""
},
"data": {}
}
Field | Description |
---|---|
category | Group, subgroup and action delimited by dot, e.g., finances.payment.processed |
timestamp | Notification creation timestamp |
notification > title | Notification subject |
notification > body | Short description written in free form |
data | Auxiliary information that varies by category |
Category | Description |
---|---|
finances.payment.processed | Payment is credited to client's account |
finances.payment.cancelled | Payment was credited, but for some reason rolled back |
finances.payment.deleted | Payment is removed from processing |
finances.viban.activated | Virtual IBAN becomes active |
finances.viban.deactivated | Virtual IBAN activity temporary suspended |
finances.viban.closed | Virtual IBAN permanently closed |
© 2023 Copyright: JSC Magnetiq Bank