Firebase Cloud Functions examples and starter code for building custom Connhex integrations.
Clone this repository, configure Firebase and Connhex, then replace or extend the example functions with your own integration logic. The examples show how to wrap Connhex APIs in custom server-side lambda functions that can be called by apps, automations, or other backends.
functions/
main.py # Firebase exports only
connhex/ # Shared Connhex client/auth helpers
examples/ # One module per integration example
onboard_user_to_team adds a Connhex identity to a Connhex IAM team using a caller-provided Connhex bearer token.
This example requires an Authorization: Bearer <connhex-user-token> header. It uses the caller's Connhex bearer token for both authorization and the team API call.
curl -X POST "https://<region>-<firebase-project>.cloudfunctions.net/onboard_user_to_team" \
-H "Authorization: Bearer <connhex-user-token>" \
-H "Content-Type: application/json" \
-d '{
"teamId": "my-team",
"membershipId": "connhex-identity-id"
}'The function checks these pairs through POST /iam/introspect_pairs before making any team changes:
- resource
iam:teams:{teamId}, actioniam:teams:get - resource
iam:teams:{teamId}, actioniam:teamUsers:list - resource
iam:teams:{teamId}, actioniam:teamUsers:create
Firebase uses .firebaserc to decide which Firebase project receives deployments from this folder.
Copy the example file:
cp .firebaserc.example .firebasercThen replace your-firebase-project-id with your Firebase project ID:
{
"projects": {
"default": "my-firebase-project-id"
}
}Copy the local example environment file:
cd functions
cp ../.env.example .envThen set the required environment variables in the .env file:
CONNHEX_DOMAIN=your-connhex-domainFirebase expects the Python virtual environment inside the functions folder to be named venv when deploying Python functions.
Create it and install the function dependencies before deploying:
cd functions
python -m venv venv
. venv/bin/activate
pip install -r requirements.txtYou can deploy all functions with:
cd ..
firebase login
firebase deploy --only functionsYou can deploy only a target function (e.g: onboard_user_to_team) with:
firebase deploy --only functions:onboard_user_to_teamThe deployed endpoint will look like this:
https://<region>-<firebase-project-id>.cloudfunctions.net/onboard_user_to_team