0

I've made a bot using BotFramework, and I want to have an azure function triggered every 5 minutes (for example). And when it's triggered my bot must be notified.

But I have no idea how to do this, I read this https://docs.botframework.com/en-us/azure-bot-service/templates/proactive/ but the thing is he didn't use a Timmer Trigger Azure Function but a Queue Trigger.

I tryed to do something like that :

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 HttpResponseMessage  Run(TimerInfo myTimer,out BotMessage message ,TraceWriter log)
{
    message = new BotMessage()
    {
        Source = "AzureFunction",
        Message = "Testing"
    };
    return new HttpResponseMessage(HttpStatusCode.OK);   

}

but i have this error :

2017-03-02T14:49:40.460 Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.TimerTriggerCSharp1'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'message' to type BotMessage&. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).

Plus, to indicate which bot has to be notified where the event is triggered is added a output with the direct line key :

enter image description here

but as u can see there is the same error than above ...

Does someone have some docs or example for that.

Thank you for reading me.

5
  • Did you try WebJobs? learn.microsoft.com/en-us/azure/app-service-web/… Commented Mar 2, 2017 at 15:26
  • 1
    Could you share your function.json file? Commented Mar 2, 2017 at 15:42
  • Hi look at my last message, ty. Commented Mar 2, 2017 at 22:10
  • 1
    Shiglet, do you still have this issue? Did you try what was proposed in the answer below? Commented Mar 3, 2017 at 19:59
  • Ohh my bad i answered to this topic in place to add a comment then my answer got deleted. but yeah i don't have this issue now. It helped me a lot ! The error has disappeared after i followed your second option ! Thank you for your help. Commented Mar 3, 2017 at 22:26

1 Answer 1

3

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)

You have a couple of options:

  1. Uncheck the box to use the return value of of your function and name the parameter message

Or

  1. Change the return type of your function to BotMessage return the message instance from your Run method and remove the out BotMessage message parameter.

Either option should fix this problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.