Webhooks
Please do not share your private keys with any website, individual, or businesses. SolanaFM would never ask for your private keys or to sign any suspicious transactions.
Our webhooks only returns successful, non-vote transactions.
Getting Started
To get things started, hop over to https://portal.solana.fm and log in using a web3 wallet.
The above video walks through the process of subscribing to a webhook on the DevPortal, listening to an OpenBookV2 program.
Sample code used to create an endpoint locally on the port 3000:
const fastify = require("fastify")();
// Define a POST route for the webhook endpoint
fastify.post("/", (req, reply) => {
// Assuming JSON payload is sent
const payload = req.body;
// Process the payload here...
console.log("Received webhook payload:", payload);
// Send a response
reply.code(200).send({ message: "Webhook received successfully" });
});
// Start the server
fastify.listen(3000, (err, address) => {
if (err) {
console.error(err);
process.exit(1);
}
console.log(`Server listening on ${address}`);
});
After creating this endpoint, a proxy service is used to to spin up a webhook url that proxies the the data from the webhook to your local server.
Sample response data from the webhook:
{
transaction: {
transaction: { signatures: [Array], message: [Object] },
meta: {
err: null,
status: [Object],
fee: 8530,
preBalances: [Array],
postBalances: [Array],
innerInstructions: [Array],
logMessages: [Array],
preTokenBalances: [Array],
postTokenBalances: [Array],
rewards: null,
computeUnitsConsumed: 188464
},
version: 0
},
sfm_meta: {
events: {}
},
network: 'mainnet',
block_time: 1716449876
}