Using Neo Cast SDK (Gasless)
npm install @NeoCastprotocol/restapi@latest ethersimport * as NeoCastAPI from "@NeoCastprotocol/restapi";import * as NeoCastAPI from "@NeoCastprotocol/restapi";
import * as ethers from "ethers";
const PK = 'your_channel_address_secret_key'; // channel private key
const Pkey = `0x${PK}`;
const _signer = new ethers.Wallet(Pkey);
const sendNotification = async () => {
try {
const apiResponse = await NeoCastAPI.payloads.sendNotification({
signer: _signer,
type: 1, // broadcast
identityType: 2, // direct payload
notification: {
title: `[SDK-TEST] notification TITLE:`,
body: `[sdk-test] notification BODY`
},
payload: {
title: `[sdk-test] payload title`,
body: `sample msg body`,
cta: '',
img: ''
},
channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address
env: 'staging'
});
} catch (err) {
console.error('Error: ', err);
}
}
sendNotification();Last updated