How to subscribe multiple device token for FCM HTTP v1 API using coldfusion
In ColdFusion, we generated an OAuth token to send notifications. However, due to the limitations of FCM HTTP v1, we cannot send notifications to multiple devices at once. To overcome this, we found a solution: using a TOPIC to subscribe device tokens. We attempted to subscribe multiple tokens using the FCM SDK.
We included all the necessary dependent JAR files for subscribing, but it throws an error.
We are using ColdFusion 2023.
Here’s a simplified version of what we’re trying:
<cfset FirebaseAdmin = createObject("java", "com.google.firebase.FirebaseApp") /> <cfset FirebaseMessaging = createObject("java", "com.google.firebase.messaging.FirebaseMessaging").getInstance(FirebaseAdmin) />
<cfset registrationTokens = ["token1", "token2", "token3"] />
<cfset response = FirebaseMessaging.subscribeToTopic(registrationTokens, topic) />
However, we’re getting an error when trying to subscribe the tokens.
Could anyone please provide a solution?
