mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
1.0 KiB
1.0 KiB
Quick Example for a SlackBot command in Ruby
This example will show you how to test and deploy a SlackBot command to Oracle Functions.
# create your func.yaml file
fn init
# build the function - install dependencies from json gem
fn build
# test it
cat slack.payload | fn run
# push it to Docker Hub
fn push
# Create a route to this function on Oracle Functions
fn routes create slackbot /guppy
# Change the route response header content-type to application/json
fn routes headers set slackbot /guppy Content-Type application/json
# test it remotely
cat slack.payload | fn call slackbot /guppy
Create a Slash Command integration in Slack
In Slack, go to Integrations, find Slash Commands, click Add, type in / as the command then click Add again. On the next page, take the Oracle Functions route URL and paste it into the URL field then click Save Integration.
If running in localhost, use ngrok.
Try it out!
In slack, type / [options] and you'll see the magic!