I am using firebase functions to subscribe to change events for opportunity using specified cometD. my handshake all is working but the change is not received at all. i have made sure that in setup Opportunity object is selected. Any advice on what else to check or debug as why nothing is happening?
export const helloWorld = functions.https.onRequest(async(request, response) => {
functions.logger.info("Hello logs!", {structuredData: true});
const data = {
"url": "https://XX.salesforce.com",
"accessToken": "XXX"
}
await cometd_setup(data)
functions.logger.log("cometd_setup_done")
await cometd.handshake(function (handshake:any) {
if (handshake.successful) {
functions.logger.log("successful opty sending data")
cometd.subscribe('/data/OpportunityChangeEvents', cometd_processdata)
} else {
logger.info('Handshake failed', handshake);
}
})
response.send("Hello from Firebase!");
});
the method that process data is currently simply doing a console log as below
var cometd_processdata = function (server_data:any) {
// Do something more useful with the data
functions.logger.info("got new data:", server_data);
};
The name of the subscription channel for Change Data Capture (CDC) events on standard objects is
/data/<Standard_Object_Name>ChangeEvent
. For anOpportunity
standard object, the CDC channel is/data/OpportunityChangeEvent
(nos
on the end)