项目作者: some-bots

项目描述 :
A Giphy bot for Basecamp
高级语言: Elixir
项目地址: git://github.com/some-bots/basecamp-giphy-elixir.git
创建时间: 2019-07-11T15:56:22Z
项目社区:https://github.com/some-bots/basecamp-giphy-elixir

开源协议:

下载


basecamp-giphy-elixir

A Giphy bot of the simplest kind….only for Basecamp… written in Elixir!

Setup

Giphy API Key

To use the GIPHY API, you’ll need to obtain an API Key by creating an app. You’ll need a GIPHY account to create an app (don’t worry, it’s free!) Each application you create will have its own API Key. Don’t worry if you’re not sure what you want to use the GIPHY API for yet, all that’s needed to create an app is a name and a basic description, which can be changed at any time.

Start here: 👉 https://developers.giphy.com/docs/

Clone the repo

  1. git clone git@github.com:some-bots/basecamp-giphy-elixir.git
  2. cd basecamp-giphy-elixir

Setup a Heroku app

Ensure you have the Heroku CLI and are logged in.

Create an app

  1. heroku create

Set a buildpack

  1. heroku buildpacks:set https://github.com/HashNuke/heroku-buildpack-elixir.git

Set your config vars

  1. heroku config:set GIPHY_API_KEY=<<the giphy api key created above>>
  2. heroku config:set PORT=80

Deploy

  1. git push heroku master

Setup Basecamp App

add-chat-bot

  1. Go to your HQ (any any team/project) and click the ellipsis at the top right
  2. Select Configure chatbots
  3. Click Add a new chatbot
  4. Optional Upload assets/giphy logo.png as the bot’s avatar
  5. Name is giphy (any name will do)
  6. Enter the url of your Heroku app created above with the /cmd on the end

Testing Locally

Note: Replace with your actual Giphy API Key.

Install dependencies

  1. PORT=4000 GIPHY_API_KEY=<key> mix deps.get

Start the server

  1. PORT=4000 GIPHY_API_KEY=<key> heroku local

Open your browser to http://localhost:4000 and you should be greeted with Hi from Basecamp-giphy-elixir bot! 🤖.

You can send test queries using curl:

  1. curl -H "Content-Type: application/json" -d '{"command":"test"}' localhost:4000/cmd

or via the convenience url to test in the browser:

http://localhost:4000/cmd/test