stripe-slack-notifier
is an OpenFaaS function that can be used as a webhook for sending Slack notifications when triggered by Stripe API events( only charge.succeeded
events are supported for now).
This function was created to showcase a real-world use case that involves faasd and inlets.
More details can found on the blog post on myedes.io.
Clone the repository:
$ git clone https://github.com/mehyedes/stripe-slack-notifier.git
$ cd stripe-slack-notifier/
Fetch the python3-http
template:
$ faas-cli template pull stack -f stripe-slack-notifier.yml
Create the necessary secrets for the function:
$ export ${OPENFAAS_GATEWAY_URL}
$ faas-cli secret create slack-webhook-url \
--from-literal=${SLACK_WEBHOOK_URL} --gateway ${OPENFAAS_GATEWAY_URL}
$ faas-cli secret create stripe-secret-key \
--from-literal=${STRIPE_API_KEY} --gateway ${OPENFAAS_GATEWAY_URL}
$ faas-cli secret create webhook-secret \
--from-literal=${WEBHOOK_SIGNING_SECRET} --gateway ${OPENFAAS_GATEWAY_URL}
$ faas-cli secret list --gateway ${OPENFAAS_GATEWAY_URL}
NAME
slack-webhook-url
stripe-secret-key
webhook-secret
Deploy to the OpenFaaS gateway
$ faas-cli deploy -f stripe-slack-notifier.yml --gateway ${OPENFAAS_GATEWAY_URL}