简体   繁体   English

我可以设置Google Assistant以使用Dialogflow向我的Android应用发送推送通知吗?

[英]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.

相关问题 有没有办法设置从Google日历到我的Android应用的推送通知? - Is there a way to set up a push notification from Google Calendar to my android app? 我可以使用Android推送通知在我的Android应用中设置值 - Can I use an Android Push Notification to set a value in my Android App 是否可以通过在“ app_remove”事件中使用Google Analytics for Firebase触发器向Android应用自动发送推送通知 - Is it possible to send automatically push notification to android app by using Google Analytics for Firebase Triggers on “app_remove” event 如何使用谷歌助手为我的应用测试 android 切片 - how to test android slices using google assistant for my app 无法使用Dialogflow将我们的应用程序与Google助手集成 - can't integrate our application with Google assistant using Dialogflow 使用parse.com在android中将应用发送到应用推送通知 - Send App to App push notification in android using parse.com 使用GCM为我的Android应用程序发送推送通知通知给所有设备 - Send Push Notifications notification to all devices using GCM for my android app 如何以编程方式使用 android studio 4.2.1 将我的应用程序图标设置为一个信号通知 - How can i set my app icon to one signal notification using android studio 4.2.1 programatically 我的应用未运行时,如何发送类似Facebook的推送通知(背景/前景) - how can i send push notification like facebook while my app is not running(background/foreground) 如何使用我的应用向特定用户发送推送通知? - How to send a push notification to a specific user using my app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM