存储“会话变量".在Facebook Messenger中 [英] Storing "Session Variables" in Facebook Messenger

查看:84
本文介绍了存储“会话变量".在Facebook Messenger中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在会话"期间保存有关用户的信息(例如邮政编码,位置等),我该如何处理?根据我的理解,每次发送消息时,都会再次点击webhook,因此变量不会保存在webhook一侧.此外,元数据仅可用于从机器人到客户端的发送.我正在寻找一种无需使用数据库即可让客户影响流程的方法.

I want to save information about a user (ex postal code, location...) for the duration of the 'session', how could I go about this? From my understanding each time a message is sent, the webhook is hit again, so variables aren't saved on the webhook side. Furthermore, meta data is only available sending from bot to client. I'm looking for a way for the client to influence the flow without the use of a database.

考虑到Facebook Messenger平台的当前迭代版本,这可能吗?

Is this possible given the current iteration of the facebook messenger platform?

推荐答案

无法在Messenger中存储变量.

There is no way to store variables in messenger.

如果您确实想避免Webhook代码中的持久性,可以使用postabck按钮.有效载荷文本限制为1000个字符,可用于编码一些有限的数据.

If you really want to avoid persistence in your webhook code, you could use postabck buttons. The payload text limit is 1000 characters, which you could use to encode some limited data.

请参见 https://developers.facebook.com /docs/messenger-platform/send-api-reference/postback-button

我个人使用Firebase来处理这种类型的会话存储,并且运行良好

Personally I'm using firebase to handle this type of session storage and it's working well

这篇关于存储“会话变量".在Facebook Messenger中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆