3
我正在使用每X分钟执行一次的Azure函数(计时器触发函数)。我使用BotFramework制作了一个bot,并且我希望每x分钟触发一次天蓝色的函数。当它被触发时,我的机器人必须被通知。Azure函数不会通知我的机器人(Bot Framework)
我有,一个输出博特框架:
这里是我的JSON文件:
{
"bindings": [
{
"name": "myTimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */1 * * * *"
},
{
"type": "bot",
"name": "message",
"botId": "Azurefunction",
"secret": "h3VkHcc_PXU.cwA.XXXXXX.XXXXXXXX-XXX",
"direction": "out"
}
],
"disabled": false
}
我的功能是:
using System;
using System.Net;
using System.Net.Http;
using Microsoft.Azure.WebJobs.Host;
public class BotMessage
{
public string Source { get; set; }
public string Message { get; set; }
}
public static BotMessage Run(TimerInfo myTimer ,TraceWriter log)
{
BotMessage message = new BotMessage()
{
Source = "AzureFunction",
Message = "Testing"
};
return message;
}
我仍然有一个警告我不知道为什么(也许这是问题)......警告AF004:错唱出名为'message'的绑定参数。不匹配的绑定参数名称可能会导致函数索引错误。
有了这个东西,Azure功能运行良好,但似乎我的机器人没有通知。我忘了什么吗?
2017-03-03T13:05:00.001 Function started (Id=a5be778e-da6d-4957-a7b5-d9c8f58bd396)
2017-03-03T13:05:00.001 Function completed (Success, Id=a5be778e-da6d-4957-a7b5-d9c8f58bd396)
谢谢您的阅读。
完美的作品!万分感谢。 – Shiglet
btw:不要在输出菜单中添加键(请参阅上面的图片),因为它会自动将它添加到您的function.json中。正如@mathewc所说,通过创建一个新条目“AzureWebJobsBotFrameworkDirectLineSecret”来添加它在您的应用程序设置中。 – Shiglet
适合输出绑定,但添加输入绑定为Bot框架时收到错误'\“messsage \”:\“执行函数时的异常:函数。 - >无法解析属性'BotAttribute.SecretSetting'。\“'的值 –
curiousMonkey