我正在使用DialogFlow为Slack制作Chatbot。我在Slack中放了一个消息菜单。我想将选定的值作为意图发送到DialogFlow。这是行不通的。 DialogFlow是否支持消息菜单或我是否必须自己设置webhook?
感谢。
答案 0 :(得分:1)
正如@praveen建议您在项目的DialogFlow设置enable Fulfilment
和point 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