Skip to content
OpenFaaS function for BikeshareClient
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


OpenFaaS function for BikeshareClient access. Provides a simple serverless GBFS status system.

gbfs-systems-function parses the GBFS Systems CSV to JSON, providing API for systems overview.

faas-cli template pull
faas-cli build -f bikeshare-function.yml

faas-cli deploy -f bikeshare-function.yml

echo "johanneskirken" |faas-cli invoke bikeshare-function |jq
# {
#  "Name: "Johanneskirken",
#  "BikesAvailable": 1,
#  "LocksAvailable": 23
# }

echo |faas-cli invoke gbfs-systems-function |jq
#    "CountryCode": "US",
#    "Name": "Sobi Long Beach",
#    "Location": "Long Beach, NY",
#    "Id": "sobi_long_beach",
#    "Url": "",
#    "GBFSFileUrl": ""
#  }

Change GBFS system by updating the GBFSAddress variable:

faas-cli deploy -f bikeshare-function.yml --env=GBFSAddress= update=true
echo "Diakonhjemmet" |faas-cli invoke bikeshare-function
# {
#  "Name: "Diakonhjemmet",
#  "BikesAvailable": 9,
#  "LocksAvailable": 5
# }

This project also contains function to post from bikeshare-function to Slack. Add a new bot named bikesharebot to a Slack workspace, and update the variable under bikeshare-slack-function: in bikeshare-function.yml with the location of the OpenFaaS gateway:

    gateway_hostname: http://gateway:8080/

Add the bot's OAUTH token to OpenFaaS secrets:

faas-cli secret create bikeBotSlackToken --from-file=slackbot-key.txt

and initialize the bot by trigging the function after deploy:

echo "init" |faas-cli invoke bikeshare-slack-function
# Bot initializing

Now simply ask the bot for a station:

andmos [8:40 PM]
@BikeshareBot Lerkendal
BikeshareBot APP [8:40 PM]
Lerkendal: :bike:: 17 :unlock:: 3

To run OpenFaaS, look at the guides for Docker Swarm, Kubernetes or OpenShift.

Build Status

You can’t perform that action at this time.