Skip to main content

Update Events Config

Update the Events config. See a payload below for the main components which are mainly

  • eventName
  • eventRules
    • parameter (array of parameters to listen to trigger the rule)
    • webhook (array of webhooks triggered when the rule takes place)
Request
POST https://api.arkhia.io/events/hedera/settings/update/:item/:config/:x-api-key

HEADERS
x-api-secret | string | The Api Secret retrieved from an Arkhia project

PARAMETERS
item | string | `contract` or `ethtopic`
config | string | `events`
x-api-key | string | The Api Key retrieved from an Arkhia project

BODY PAYLOAD
item_id | string | `contract` or `account` -> hedera_item_id , `ethtopic` as an eth topic
network_id | number | `295` (mainnet) or `296` (testnet)
config_type | string | `events`
config_object | EventConfig | Full Event Configuration to uploaded

PAYLOAD REFERENCE
    export type ConfigType = 'events';    export type PollingInterval = 1000 | 5000 | 10000 | 30000;    export type WebhookCallType = 'get' | 'post';    export interface ParameterInstance {        enabled: boolean;        parameterId: string;        parameterType: string;        parameterName: string;        parameterRule: number;        parameterRuleValue: string;    };    export interface WebhookInstance {        tag: string;        key: string;        value: string; // `https://www.mywebhook.com/callsomething/request`        type: WebhookCallType;        active: boolean;    };    export interface EventRule {        ruleId: string;        ruleName: string;        enabled: boolean;        email_notification: boolean;        polling_interval: PollingInterval;               parameterCollection: Array<Parameter>;        webhooks: Array<WebhookInstance>;    }    export interface EventInstance {        eventId: string,        eventName: string,        eventRules: Array<EventRules>;    }    // Payload to submit    export interface EventConfig {        item_id: string;        network_id: string;        config_type: ConfigType;        config_object: Array<EventInstance>;    }
Payload example
   {
item_id: '0.0.1203',
network_id: 295,
config_type: 'events',
config_object:
[
{
eventId: '0.0.1203_event',
eventName: '0.0.1203_eventx',
eventRules:
[
{
ruleId: '0.0.1203_eventx_rule0',
ruleName: '0.0.1203_eventx_rule0',
enabled: true,
email_notification: false,
polling_interval: 1000,
parameterCollection:
[
{
enabled: true,
parameterId: "FairTradeEvent_rule0_from",
parameterType: "string",
parameterName: "ParameterName",
parameterRule: 1,
parameterRuleValue: "dummyvalue1",
},
{
enabled: true,
parameterId: "FairTradeEvent_rule0_from",
parameterType: "string",
parameterName: "ParameterName",
parameterRule: 1,
parameterRuleValue: "dummyvalue1",
},
],
webhooks:
[
{
tag: "api-micro",
key: "api-micro",
value: "https://www.mywebhook.com/callsomething/request",
type: "get",
active: true
},
{
tag: "api-micro",
key: "api-micro",
value: "https://www.mywebhook.com/callsomething/request",
type: "post",
active: true
}
]
}
]
},
],
};
Response
EventConfig   {        item_id: '0.0.3931201',        network_id: 295,        config_type: 'events',        config_object:         [            {                eventId: '0.0.3931201_Event_1',                eventName: '0.0.3931201_event_1',                eventRules:                 [                    {                        ruleId: "FairTradeEvent_rule0",                        ruleName: "FairTradeEvent Rule0",                        enabled: true,                          email_notification: false,                        polling_interval: 1000,                                 parameterCollection:                         [                            {                                enabled: true,                                parameterId: "FairTradeEvent_rule0_from",                                parameterType: "string",                                parameterName: "ParameterName",                                parameterRule: 1,                                parameterRuleValue: "dummyvalue1",                            },                            {                                enabled: true,                                parameterId: "FairTradeEvent_rule0_from",                                parameterType: "string",                                parameterName: "ParameterName",                                parameterRule: 1,                                parameterRuleValue: "dummyvalue1",                            },                        ],                        webhooks:                        [                             {                                tag: "api-micro",                                key: "api-micro",                                value: "https://www.mywebhook.com/callsomething/request",                                type: "get",                                active: true                            },                            {                                tag: "api-micro",                                key: "api-micro",                                value: "https://www.mywebhook.com/callsomething/request",                                type: "post",                                active: true                            }                        ]                    }                ]            },        ],    };
Code sample

Get Node Status

const axios = require('axios');const restApiUrl = `https://api.arkhia.io/events/hedera/settings/contract/events/<YOUR_ARKHIA_API_KEY>`;const apiSecret = `<YOUR_ARKHIA_API_SECRET>`;const headers = { headers: { "x-api-secret": apiSecret } };const bodyPayload = {    item_id: '0.0.3931201',    network_id: 296};getStatus= async () => {    try {        const response = await axios.post(restApiUrl, { scoutSettings: bodyPayload }, headers);        return response;    } catch(e) {        console.error(e);    }}