gpt4 book ai didi

image - 如何在BotKit Facebook中捕获音频消息接收或图像接收

转载 作者:行者123 更新时间:2023-12-03 01:40:14 25 4
gpt4 key购买 nike

我一直在使用Botkit Facebook Messenger,可以完美地从Facebook接收文本消息,但是无法捕获音频消息,图像或附件。

有没有人能够捕获这些类型的消息?

    var Botkit = require('botkit');
var controller = Botkit.facebookbot({
access_token: process.env.access_token,
verify_token: process.env.verify_token,
})

var bot = controller.spawn({
});

// if you are already using Express, you can use your own server instance...
// see "Use BotKit with an Express web server"
controller.setupWebserver(process.env.port,function(err,webserver) {
controller.createWebhookEndpoints(controller.webserver, bot, function() {
console.log('This bot is online!!!');
});
});

// this is triggered when a user clicks the send-to-messenger plugin
controller.on('facebook_optin', function(bot, message) {

bot.reply(message, 'Welcome to my app!');

});

// user said hello
controller.hears(['hello'], 'message_received', function(bot, message) {

bot.reply(message, 'Hey there.');

});

controller.hears(['cookies'], 'message_received', function(bot, message) {

bot.startConversation(message, function(err, convo) {

convo.say('Did someone say cookies!?!!');
convo.ask('What is your favorite type of cookie?', function(response, convo) {
convo.say('Golly, I love ' + response.text + ' too!!!');
convo.next();
});
});
});

最佳答案

在facebook入门项目中有一个贴纸,图像和音频回复的示例:https://github.com/howdyai/botkit-starter-facebook/blob/master/skills/sample_events.js

如果您在使用它们时遇到麻烦,请随时在github上创建问题!

关于image - 如何在BotKit Facebook中捕获音频消息接收或图像接收,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47987896/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com