Firebase Remote Config Triggers

Cloud Functions can be triggered in response to changes in Firebase Remote Config in the same Cloud project as the function. This makes it possible to change the behavior and appearance of your app without publishing an app update.

Event types

Firebase Remote Config can trigger functions in response to the remoteconfig.update event.

Event Type Trigger
remoteconfig.update Triggered when the remote config template is updated.

Event structure

Event data is provided as a transformed remoteConfig object.

For example:

  "updateType": "FORCED_UPDATE",
  "updateOrigin": "CONSOLE",
  "versionNumber": 1

Sample code


 * Triggered by a change to a Firebase Remote Config value.
 * @param {object} event The Cloud Functions event.
exports.helloRemoteConfig = event => {
  console.log(`Update type: ${event.updateType}`);
  console.log(`Origin: ${event.updateOrigin}`);
  console.log(`Version: ${event.versionNumber}`);


def hello_remote_config(data, context):
    """ Triggered by a change to a Firebase Remote Config value.
            data (dict): The event payload.
            context ( Metadata for the event.
    print(f'Update type: {data["updateType"]}')
    print(f'Origin: {data["updateOrigin"]}')
    print(f'Version: {data["versionNumber"]}')


// Package helloworld provides a set of Cloud Functions samples.
package helloworld

import (

// A RemoteConfigEvent is an event triggered by Firebase Remote Config.
type RemoteConfigEvent struct {
	UpdateOrigin string `json:"updateOrigin"`
	UpdateType   string `json:"updateType"`
	UpdateUser   struct {
		Email    string `json:"email"`
		ImageURL string `json:"imageUrl"`
		Name     string `json:"name"`
	} `json:"updateUser"`
	VersionNumber string `json:"versionNumber"`

// HelloRemoteConfig handles Firebase Remote Config events.
func HelloRemoteConfig(ctx context.Context, e RemoteConfigEvent) error {
	log.Printf("Update type: %v", e.UpdateType)
	log.Printf("Origin: %v", e.UpdateOrigin)
	log.Printf("Version: %v", e.VersionNumber)
	return nil


import java.util.logging.Logger;

public class FirebaseRemoteConfig implements RawBackgroundFunction {
  private static final Logger logger = Logger.getLogger(FirebaseRemoteConfig.class.getName());

  // Use GSON ( to parse JSON content.
  private static final Gson gson = new Gson();

  public void accept(String json, Context context) {
    JsonObject body = gson.fromJson(json, JsonObject.class);

    if (body != null) {
      if (body.has("updateType")) {"Update type: " + body.get("updateType").getAsString());
      if (body.has("updateOrigin")) {"Origin: " + body.get("updateOrigin").getAsString());
      if (body.has("versionNumber")) {"Version: " + body.get("versionNumber").getAsString());


using CloudNative.CloudEvents;
using Google.Cloud.Functions.Framework;
using Google.Events.Protobuf.Firebase.RemoteConfig.V1;
using Microsoft.Extensions.Logging;
using System.Threading;
using System.Threading.Tasks;

namespace FirebaseRemoteConfig
    public class Function : ICloudEventFunction<RemoteConfigEventData>
        private readonly ILogger _logger;

        public Function(ILogger<Function> logger) =>
            _logger = logger;

        public Task HandleAsync(CloudEvent cloudEvent, RemoteConfigEventData data, CancellationToken cancellationToken)
            _logger.LogInformation("Update type: {origin}", data.UpdateType);
            _logger.LogInformation("Update origin: {origin}", data.UpdateOrigin);
            _logger.LogInformation("Version number: {version}", data.VersionNumber);

            // In this example, we don't need to perform any asynchronous operations, so the
            // method doesn't need to be declared async.
            return Task.CompletedTask;


use Google\CloudFunctions\CloudEvent;

function firebaseRemoteConfig(CloudEvent $cloudevent)
    $log = fopen(getenv('LOGGER_OUTPUT') ?: 'php://stderr', 'wb');

    $data = $cloudevent->getData();

    fwrite($log, 'Update type: ' . $data['updateType'] . PHP_EOL);
    fwrite($log, 'Origin: ' . $data['updateOrigin'] . PHP_EOL);
    fwrite($log, 'Version: ' . $data['versionNumber'] . PHP_EOL);

Deploying your function

To deploy your function, you need to specify the event type google.firebase.remoteconfig.update.

The following gcloud command deploys a function that is triggered by a Firebase Remote Config event:

gcloud functions deploy YOUR_FUNCTION_NAME \
  --trigger-event google.firebase.remoteconfig.update \
  --runtime RUNTIME
Argument Description
--trigger-event google.firebase.remoteconfig.update Trigger the function upon Firebase Remote Config update events.
--runtime RUNTIME The name of the runtime you are using. For a complete list, see the gcloud reference.