How To Send Proactive Notification/ Broadcast Message Using Azure Functions To User Using Various Channels?
Solution 1:
You need to create output bot framework and Here is the binding information for the azure function which will be triggered after every x minute
{
"bindings": [
{
"name": "myTimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */1 * * * *"
},
{
"type": "bot",
"name": "$return",
"botId": "Azurefunction",
"secret": "AppSettingNameOfYourBot",
"direction": "out"
}
],
"disabled": false
}
and the azure function is
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;
}
Also your binding configuration is set to use the return value of your function (also, in this case, that doesn't match any of the types supported by the binding) that's how you can make a connection between Bot and azure function.
And for directline api related issue please check this thread
Cant send message using directlineapi in bot framework
Hope it helps.
Solution 2:
Okay so I sorted out my problem. By using REST connector https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-authentication?view=azure-bot-service-4.0 I think I just made big assumption that I have to use Direct Line
I maybe did not explain clear what my problem really was. Thanks for the replies !
Post a Comment for "How To Send Proactive Notification/ Broadcast Message Using Azure Functions To User Using Various Channels?"