问题描述
我想制作这样一个表单或一个测验表单,将问题发送给用户并且用户可以回答它,并且在几个问题之后所有文本例如会发送到我的电子邮件。但是主要问题,据我所知,webhook 只处理一条消息,并且当发送一条新消息时,代码从头开始。我试过这个:
function sendEmail($subject,$sender_id,$sender_name,$message){
global $email;
mail($email,$subject,$message);
}
主要条件:
...
elseif($input['event'] == "message" and $on_message == 0)
{
// main
if($text == "Contact")
{
sendMsgText($sender_id,$text = "Type your message and send it.",$keyboard = Null);
$subject = "Message";
$on_message = 1;
}
...
...
if($input['event'] == "message" and $on_message == 1)
{
$request = file_get_contents("PHP://input");
$input = json_decode($request,true);
put_log_in($request);
$type = $input['message']['type']; //type of message received (text/picture)
$text = $input['message']['text']; //actual message the user has sent
$sender_id = $input['sender']['id']; //unique viber id of user who sent the message
$sender_name = $input['sender']['name']; //name of the user who sent the message
sendEmail($subject,$text);
$on_message == 0;
}
问题是,在我的电子邮件中,我收到了一条带有文本“联系方式”的消息,而它不是我发送给机器人的最后一条消息。
我知道webhook 只处理一条消息,并且当发送一条新消息时,代码从头开始。 但是我应该怎么做?或者是否还有其他一些变体可以在 viber-bot 中进行联系或表单(测验)? 提前致谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)