[英]Can I set up Google Assistant to send a push notification to my Android app using Dialogflow?
Is it possible to set up a conversation using Dialogflow so that when you speak an application specific command to Google Assistant on an Android phone, a push notification is sent to my app without me needing to set up a web server to handle a webhook? 是否可以使用Dialogflow进行对话,以便当您在Android手机上向Google Assistant讲特定于应用程序的命令时,将推送通知发送到我的应用程序,而无需我设置网络服务器来处理Webhook?
Can the push notification be sent directly from the in-line index.js that you enter on the Dialogflow website under the fulfillment section? 推送通知是否可以直接从您在Dialogflow网站上在实现部分下输入的内联index.js发送? If so, how?
如果是这样,怎么样?
This isn't exactly what you're looking for, but you could use Nodemailer to send an email from inside your Dialogflow fulfillment. 这并不是您要找的东西,但是您可以使用Nodemailer从Dialogflow实现中发送电子邮件。 Most Android users get a push notification when they get a new email, which completes half of your goal.
大多数Android用户在收到新电子邮件时都会收到推送通知,这完成了您目标的一半。
var nodemailer = require('nodemailer');
// create reusable transporter object using the default SMTP transport
var transporter = nodemailer.createTransport('smtps://user%40gmail.com:pass@smtp.gmail.com');
// setup e-mail data with unicode symbols
var mailOptions = {
from: '"Fred Foo ?" <foo@blurdybloop.com>', // sender address
to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers
subject: 'Hello ✔', // Subject line
text: 'Hello world ?', // plaintext body
html: '<b>Hello world ?</b>' // html body
};
// send mail with defined transport object
transporter.sendMail(mailOptions, function(error, info){
if(error){
return console.log(error);
}
console.log('Message sent: ' + info.response);
});
You need to implement the firebase cloud messaging APIs in your Android App and push that message you want to your app. 您需要在Android应用中实现firebase云消息传递API,然后将所需的消息推送到您的应用。 Please keep in mind that you need some kind of login to connect the push token of your app to your fulfillment code.
请记住,您需要某种登录方式才能将应用程序的推送令牌连接到实现代码。 Without that link you cannot send a push message.
没有该链接,您将无法发送推送消息。 If you need more details leave a comment.
如果您需要更多详细信息,请发表评论。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.