abcnews/chatfuel-webhook

Name: chatfuel-webhook

Owner: ABC News

Description: A send-to-Slack webhook implementation for ChatFuel

Created: 2017-06-02 04:50:19.0

Updated: 2017-06-19 20:26:49.0

Pushed: 2017-06-14 06:47:37.0

Homepage: null

Size: 22

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Chatfuel webhook sender

A JSON endpoint to send Chatfuel user attributes to a Slack webhook.

Send variables from Messenger users to Slack

Setup

This app is intended for use in AWS Lambda. General setup:

  1. Configure this app as an AWS Lambda
  2. Set requisite env vars (see below)
  3. Expose via a web gateway
  4. Set up in Chatfuel as a JSON API card
  5. Configure this as a POST endpoint
  6. Sending through the Chatfuel vars and any custom vars you wish (see below)
  7. Add a query param to the url to let the webhook know which channel to send to. Eg. ?slackChannel=test where test corresponds to an environment variable below.
Environment variables

The following variables may be configured:

Variable name | Description
————–|——————— SLACK_WEBHOOK_x | Full slack webhook url. Replace x with the channel name. Corresponds to slackChannel in the query params. Generate a webhook from Slack DASHBOT_USERID | Optional userId to link to the user's session (with history) in Dashbot. This is the number is in your Dashbot dashboard url, eg. https://www.dashbot.io/reports/1234

Chatfuel variables

It is intended that you can throw any variables you like at this endpoint and they will be printed accordingly. Some notes:

  1. Send through all the default (blue) ChatFuel variables. These are used to format the user's name, profile pic etc. For a list, see chatfuel.js.
  2. Send through any custom (yellow) variables you wish to appear. If you don't send any, the hook will send the user's last entered text.

Chatfuel can only send the user's last entered text in the default answer block. If you wish to capture images, locations, or stickers you should use a User input card.

Error messages

The following error messages may be printed in the logs:

Message | Description
——————-|——————— no tasks specified | The query string must contain a task to run, eg. ?slackChannel=x webhook not configured | The designated webhook needs to be configured via environment variable. error sending | An error occurred while sending the webhook. Is the hook valid?


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.