将松弛消息菜单与DialogFlow集成

时间:2018-04-10 09:03:08

标签: slack-api dialogflow

我正在使用DialogFlow为Slack制作Chatbot。我在Slack中放了一个消息菜单。我想将选定的值作为意图发送到DialogFlow。这是行不通的。 DialogFlow是否支持消息菜单或我是否必须自己设置webhook?

感谢。

1 个答案:

答案 0 :(得分:1)

正如@praveen建议您在项目的DialogFlow设置enable Fulfilmentpoint it to your fulfilment back-end service中需要 from flask import Flask, request, flash, url_for, redirect, render_template, session from flask import render_template import numpy as np import matplotlib.pyplot as plt import io import threading import base64 from IPython import get_ipython from sys import exit app = Flask(__name__) @app.route('/') def home(): return render_template('home.html') @app.route('/plot' , methods = ['GET', 'POST']) def build_plot(): img = io.BytesIO() global running x = np.linspace(-180, 180,1000) y = np.sin(x) global j fig, ax = plt.subplots() plt.plot(x[0:200], y[0:200]) #plt.plot(x,y) for i in range(200, len(y)): plt.scatter(x[i], y[i]) plt.pause(0.0005) return(get_ipython().run_line_magic('matplotlib', 'inline')) @app.route('/stop' , methods = ['GET', 'POST']) def stop(): #stop_ind='N' #exit() return render_template('home.html') if __name__ == '__main__': app.debug = True app.run() 。完成检查后Rich Messages Doc查看要从您的Fulfillment服务响应DialogFlow的数据有效负载,以使Slack显示菜单。

<强>更新

如果您想在Slack中执行操作并启用Slack通知您该操作,那么您可以使用Slack RTM或Slack's event API