You can trigger a function in response to Remote Config events, including the publication of a new config version or the rollback to an older version. This guide describes how to create a Remote Config background function that performs a diff of two template versions.
Trigger a Remote Config function
To trigger a Remote Config function, first import the required modules:
Node.js
// The Cloud Functions for Firebase SDK to set up triggers and logging.
const
{
onConfigUpdated
}
=
require
(
"firebase-functions/remoteConfig"
);
const
logger
=
require
(
"firebase-functions/logger"
);
// The Firebase Admin SDK to obtain access tokens.
const
admin
=
require
(
"firebase-admin"
);
const
app
=
admin
.
initializeApp
();
const
jsonDiff
=
require
(
"json-diff"
);
Python
# The Cloud Functions for Firebase SDK to set up triggers and logging.
from
firebase_functions
import
remote_config_fn
# The Firebase Admin SDK to obtain access tokens.
import
firebase_admin
app
=
firebase_admin
.
initialize_app
()
import
deepdiff
import
requests

