
Security News
Security Community Slams MIT-linked Report Claiming AI Powers 80% of Ransomware
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.
@notifi-network/notifi-node
Advanced tools
This SDK is intended for use with Servers who have obtained a SID / Secret pair from Notifi. Please reach out to us for help on Discord!
This SDK allows you to interact with Notifi Tenant specific services, such as creating users, sending notifications. It is particularly useful when you want to have a custom server-side application. For example, sending notifications automatically when a certain event occurs.
To authenticate with Notifi Node SDK to get the valid auth token, it requires specific server credentials,
SIDandSecret. You can get these credentials from Notifi Admin Panel --> Account Settings --> Account Keys (top right corner) -->Show Sid/Secret. If you not yet have an Notifi tenant account, feel free to register a new tenant at Notifi Admin Panel for free.
Install @notifi-network/notifi-node package using npm or yarn:
# NPM
npm install @notifi-network/notifi-node
# Yarn
yarn add @notifi-network/notifi-node
The NotifiNodeClient instance behaves as an proxy of NotifiService which is a wrapper around the Notifi GraphQL API. By interacting with NotifiNodeClient, we can perform various admin leven server methods such as creating users, sending notifications, etc.
It requires to pass in GraphqlClient, DataPlaneClient and SubscriptionService instances in order to instantiate a NotifiService object. The NotifiService object is then passed to the NotifiClient constructor. Example:
import {
  NotifiClient,
  createGraphQLClient,
  createNotifiService,
} from '@notifi-network/notifi-node';
const gqlClient = createGraphQLClient();
const dpapiClient = createDataplaneClient();
const subService = createNotifiSubscriptionService();
const notifiService = createNotifiService(graphqlClient, subService);
// Instantiate a NotifiNodeClient
const client = new NotifiNodeClient(notifiService);
NOTE:
GraphqlClientis used to interact with the Notifi GraphQL Mutations and Queries.
DataPlaneClientis used to interact with the Notifi Data Plane API.
SubscriptionServiceis used to interact with the Notifi Subscription Service.
In order to utilize the NotifiNodeClient methods, we firstly need to call the logIn by passing the tenant SID and Secret mentioned above. This method initializes the NotifiNodeClient and returns a token and expiry.
If we already have a valid token, we can directly call initialize method by passing the token.
const sid = 'your-notifi-tenant-sid';
const secret = 'your-notifi-tenant-secret';
// Either login
const { token, _expiry } = await client.logIn({
  sid,
  secret,
});
// Or,iff already have a valid token, directly initialize client
await client.initialize(token);
You can obtain the client status by calling client.status.
NotifiNodeclientUninitializedStateNotifiNodeclientInitializedState// uninitialized
const { status } = client.status;
// initialized
const { status, jwt } = client.status;
NOTE: Make sure not to expose the
SID,SecretandToken (jwt)publicly. Otherwise, it could be abused by malicious users.
Use publishFusionMessage method to send one or more messages to the users. The example below sends a notification to the all users who have subscribed to the event-type-id.
if (!status === 'initialized') throw new Error('Client not initialized');
const messagePayloads = [
  {
    eventTypeId: 'event-type-id',
    variablesJson: {
      /** Could be any shape of object according to the need of template */
      fromAddress: 'from-wallet-address',
      toAddress: 'to-wallet-address',
      amount: 'amount',
      currency: 'ETH',
    },
    // Passing `specificWallets` optionally if you want to send to specific users. By default, it sends to all users who have subscribed to the `event-type-id`.
    // specificWallets: [{
    //   walletBlockchain: 'ETHEREUM',
    //   walletPublicKey: 'user-wallet-public-key',
    // }]
  },
];
const result = await client.publishFusionMessage(fusionMessages);
NOTE:
- The
variablesJsonparameter is the set of variables that will be used when rendering your templates. If you have a variablefromAddress, for example, you can display it in the template with the expression{{ eventData.fromAddress }}
Use getActiveAlerts method to get all active alerts under the tenant.
const first = 10; // Number of alerts to fetch
const after = 'the-cursor'; // Cursor to fetch the alerts after
const result = client.getActiveAlerts({ first, after, fusionEventIds });
You can get the cursor (in PageInfo) from the
resultobject to fetch the next set of alerts.
Using addEventListener method allows to monitor the tenantActiveAlertChanged event.
Listening to event
const id = client.addEventListener(
  'tenantActiveAlertChanged',
  eventHandler,
  errorHandler,
);
const eventHandler = (event) => {
  console.info('Event received:', event);
};
const errorHandler = (error: Error) => {
  console.error('Error occurred', error);
};
Removing event listener
client.removeEventListener('tenantActiveAlertChanged', id);
We welcome and appreciate your contributions! Please review our contribution guidelines before getting started.
To ensure a smooth contribution process, please follow the steps below to confirm that all tests pass before submitting your changes:
.env.example file and rename it to .env.npm run test to execute all tests.If your contribution includes a new feature, you may also want to create a dedicated test case within the __tests__/NotifiNodeClient.test.ts file to validate its functionality.
@notifi-network/notifi-node package on express.js server.FAQs
Server-initiated operations with Notifi
We found that @notifi-network/notifi-node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.