Skip to main content

Triggers Reference

The Event Listener enables users to detect specific events that align with predefined criteria, known as triggers. These triggers can be configured via the mintBlue Console to respond to either internal events within the mintBlue ecosystem or to real-time transactions occurring on the Bitcoin network. Below is the reference.

Interfaces​

Bitcom​

  • Type: BITCOM
  • Options:
    • bitcom_protocol_id
{  
type: 'BITCOM';
options: {
bitcom_protocol_id: string;
}
}

Peppol​

  • Type: PEPPOL
  • Options:
    • pubKey
{  
type: 'PEPPOL';
options: {
pubKey: string;
}
}

Payment from​

  • Type: PAYMENT_FROM
  • Options:
    • from_address
{  
type: 'PAYMENT_FROM';
options: {
from_address: string;
}
}

Payment to​

  • Type: PAYMENT_TO
  • Options:
    • to_address
{  
type: 'PAYMENT_TO';
options: {
to_address: string;
}
}

Bitquery​

  • Type: BITQUERY
  • Options:
    • bitquery: bitquery is a JSON.stringify of a Bitquery.
{  
type: 'BITQUERY';
options: {
bitquery: string;
}
}

mintBlue transaction inserted​

  • Description: Triggers when a transaction is inserted in a project on your account by another event listener.
  • Type: mintblue.transaction.inserted
  • Options:
    • project_id: If project_id is given, only match the event when it was inserted in the corresponding project.
    • txo: If txo is given, only match if the TXO representation of the transaction matches your predicate (see BitQuery).
{  
type: 'mintblue.transaction.inserted',
options: {
project_id: string | null;
txo: object | null;
}
}

mintBlue transaction created​

  • Description: Triggers when a transaction is created on your account.
  • Type: mintblue.transaction.created
  • Options:
    • project_id: If project_id is given, only match the event when it was inserted in the corresponding project.
    • txo: If txo is given, only match if the TXO representation of the transaction matches your predicate (see BitQuery).
{  
type: 'mintblue.transaction.created',
options: {
project_id: string | null;
txo: object | null;
}
}

I'm seeing duplicate events?​

The types Bitcom, Peppol, Payment from, Payment to, Bitquery can be triggered for multiple reasons:

  1. when a transaction is seen on the Bitcoin network
  2. when a transaction is inserted into a project
  3. when a transaction is created in mintBlue

To see why an event was triggered, see the event.topic property inside the event body:

{
"version": 1,
"subscription": {
"id": "a7efeea9-c5ce-4f65-a827-eed28145d982",
"name": "webhook 1",
"trigger": {
"type": "PAYMENT_TO",
"options": {
"to_address": "12mm8RPb8rdGo2pR9HATW7R93ejRc9XSKy"
}
},
"actions": [
{
"type": "webhook",
"options": {
"url": "https://webhook.site/d742b2f9-239e-4afc-844d-df171707c2b0"
}
}
],
"user_id": "e73836d9-e81e-42ac-9923-296b72508866",
"account_id": "f3d73993-86bd-4d6a-b6bc-9cbd0e29530e",
"createdAt": "2024-01-18T16:25:33.357Z",
"updatedAt": "2024-01-18T16:25:33.357Z"
},
"event": {
"_source_type": "zmq",
"_source_host": "100.96.30.121",
"_source_topic": "rawtx2",
"topic": "bitcoin.transaction.seen",
"content": {
"txid": "c545171e152f063bba18bd97d0e3a1eeee315f01050594e03eae351118cef731"
}
},
"includeRawtx": false
}

Each of these events corresponds to a topic name:

  1. bitcoint.transaction.seen
  2. mintBlue.transaction.inserted
  3. mintBlue.transaction.created

As an example: when using the PAYMENT_TO trigger with 2 actions configured: insert_into_project, webhook; a payment to the configured address will cause the actions to be executed. Because the first action insert_into_project publishes an internal mintBlue.transaction.inserted event, the original PAYMENT_TO trigger will be executed a second time:

  • The webhook action will be called twice but with different topic names as the source event (see highlighted line above)
  • The insert_into_project action will only insert the transaction into the project once