All Articles

Mail from Slack by OpenFaaS Cloud

In this tutorial I want to show you how I built a function to send emails from a Slack command. It runs for free on OpenFaaS Cloud using the Community Cluster.

OpenFaaS

OpenFaaS (Function as a service) is a framework for creating serverless functions on Kubernetes or Docker. It made serverless functions simple. You can run OpenFaaS anywhere on your laptop, your own premise hardware or create a cluster in the cloud. OpenFaaS supporting any language such as GO, Java, Python, C#, Ruby , ASP.NET Core or anything else. If you are new with OpenFaaS workshop is a great place to start.To learn more about OpenFaaS please checkout the project documentation.

OpenFaaS Cloud

Run you serverless functions using automates CI/CD. You are able to run OpenFaaS cloud self-hosted or use the hosted Community Cluster.

Pre-requisites

  • Access to the OpenFaaS Cloud: Community Cluster, or your own self-hosted cluster with ofc-bootstrap.
  • Slack Account.
  • You already have faas-cli installed.
  • You have an GitHub repository connected to OpenFaaS Cloud: Community Cluster

Scenario

  • Using Slash Command in Slack to send message to an API.
  • Use OpenFaaS function as API to receive message from Slack.
  • Verifying Slack message HMAC.
  • Extract the message.
  • Convert message body from Markdown to HTML.
  • Send email using nodemailer.
  • Send back appropriate message to Slack.

Continue reading on Medium.