Skip to content

Instantly share code, notes, and snippets.

Amir Movahedi Qolzam

Block or report user

Report or block Qolzam

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View test-mail.md

/mail amir.gholzam@live.com | Send email from Slack using OpenFaaS |

Hello 👋

OpenFaaS Logo

This is working Yeahhhh 👍

View secret.yml
version: 1.0
provider:
name: openfaas
gateway: http://127.0.0.1:8080
functions:
slack-mail:
lang: node
handler: ./slack-mail
image: slack-mail:latest
environment:
View kubeseal
# Install client-side tool into /usr/local/bin/
$ wget https://github.com/bitnami-labs/sealed-secrets/releases/download/v0.8.3/kubeseal-$(go env GOOS)-$(go env GOARCH) -O kubeseal
$ sudo install -m 755 kubeseal /usr/local/bin/kubeseal
View cloud-seal
faas-cli cloud seal --name red-gold-secrets \
--literal password="password" --literal email="example@gmail.com" --literal sign-secret="slack_signing_secret"
View download-public-key.sh
cd $HOME/mail-of-slack
curl -O https://github.com/openfaas/cloud-functions/blob/master/pub-cert.pem
View send-email.js
// Email callback handler
const emailCallback = (emailResult) => {
let result = null
if (emailResult.error) {
result = {
"text": "There is problem!",
"attachments": [
{
"text": JSON.stringify(emailResult.error)
}
View handle.js
"use strict"
const qs = require('qs');
const utils = require('./utils')
module.exports = (context, callback) => {
// Parse query string
const data = qs.parse(context)
View util.js
const crypto = require('crypto');
const qs = require('qs');
const fs = require('fs');
const nodemailer = require('nodemailer');
const md = require('markdown-it')({
html: true,
linkify: true,
breaks: true,
typographer: true
});
View install-packages.sh
cd $HOME/mail-of-slack/slack-mail
npm install --save markdown-it@9.1.0 markdown-it-emoji@1.4.0 nodemailer@6.3.0 qs@6.8.0
View env-stack.yml
version: 1.0
provider:
name: openfaas
gateway: http://127.0.0.1:8080
functions:
slack-mail:
lang: node
handler: ./slack-mail
image: slack-mail:latest
labels:
You can’t perform that action at this time.