-1

My bot has an option "notify". I would like to stop automatic replies for that user if "notify" has been hit. Is that possible ? Any example ?

PS: I know this question is not asked properly, but i don't know where to start.

Bob Swager
  • 884
  • 9
  • 25
  • Have you tried to store whether or not "notify" option has been hit in .UserData? Then check userdata, and do not send the reply if the "notify" setting has been set. – Eric Dahlvang Apr 19 '17 at 22:56
  • UserData always gets deleted. Because of multiple bot instances of my code. – Bob Swager Apr 20 '17 at 07:44

1 Answers1

-1

If you want to stop displaying in the conversation what the user selected from a set of options, you can set the CardAction type to PostBack.

eg.

CardAction CardButton = new CardAction()
{
    Type = ActionTypes.PostBack,
    Title = item.ToString(),
    Value = item.ToString()
};
Curiosity
  • 1,753
  • 3
  • 25
  • 46
  • Yes. There should be postback button and method to stop automatic replies. But how to stop that from some third party method ? I want to stop auto replies when stuff is ready to provide live support. That callback you mention is to notify support, not to stop automatic replies. – Bob Swager Apr 18 '17 at 11:22
  • Can you be more specific about what you mean by automatic replies? – Curiosity Apr 19 '17 at 03:19
  • Bot response. That's auto-replies. – Bob Swager Apr 19 '17 at 06:39
  • The bot responds usually based on any message sent by the user. And as in your case, it's options. So, the bot is listening for an `IMessageActivity`, from the method `MessageReceivedAsync` (this is the method used in most cases). So, whatever the "automatic replies" you are mentioning here are probably coming from that kind of a method. So try to stop the "automatic replies" from there? – Curiosity Apr 19 '17 at 07:10
  • Auto replies from Facebook page. – Bob Swager Apr 20 '17 at 07:43
  • Did you find a solution to your problem? Have you tried using a `static` or a `ThreadStatic` variable? – Curiosity Apr 24 '17 at 04:35
  • Is it possible to catch if page is used by user, not by bot ? – Bob Swager Apr 24 '17 at 07:01
  • Sorry. I'm not sure if it's possible or not. I just gave it as a suggestion for you to try. :) Check this [question and answer](http://stackoverflow.com/questions/39524913/can-i-start-the-conversation-with-messenger-bot-fb-botframework) and see if it's related to your problem. – Curiosity Apr 24 '17 at 08:18
  • Just to get your problem clear. You have a bot in a Facebook page and you are trying to stop some kind of an auto-reply to the user from Facebook itself? Or is it from your bot when the user tries to initiate a conversation? You are trying to stop those replies using 'notify', which has to be given by the user? Is that right? – Curiosity Apr 24 '17 at 08:25
  • Yes. Right. I want to stop conversation using notify (button). That's ok. I know how to get that done. The real problem is how to resume conversation. Any idea ? – Bob Swager Apr 24 '17 at 08:30
  • If you are using a button to stop the conversation, why not use another to start the conversation? :) You can display this button after the user clicks on your 'notify' button, and so when the user clicks on the second button, you can resume the conversation. – Curiosity Apr 24 '17 at 09:32
  • That's one of the ideas. But it is not user friendly, because user has to search whole conversation to find that button because of conversation with admin of the page. What do you think ? – Bob Swager Apr 24 '17 at 09:50
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/142466/discussion-between-curiousity-and-bob-swager). – Curiosity Apr 24 '17 at 09:52