davidmann4 / botstack

rapid chatbot development with ruby on rails
127 stars 23 forks source link

How To Fix RecipientNotFound ((#100) No matching user found) Error? #20

Closed phillipp closed 8 years ago

phillipp commented 8 years ago

Hi, I was just toying around with the bot but I think I broke it. In my first conversation the bot stopped replying, not sure what action or text did this. The console shows the following error:

Facebook::Messenger::Bot::RecipientNotFound ((#100) No matching user found):
  lib/bot/base_bot_logic.rb:33:in `reply_message'
  lib/bot/bot_logic.rb:25:in `bot_logic'
  lib/bot/base_bot_logic.rb:207:in `handle_request'
  app/bots/main.rb:7:in `block in <top (required)>'

The "RESET" replys with a text, but my other reply is not sent. My bot logic is this:

class BotLogic < BaseBotLogic
    def self.setup
        set_welcome_message "Hey! Interesse an einer Domain? Ich kann Dir gerne sagen, ob eine Domain Deiner Wahl verfügbar ist!"
        set_get_started_button "bot_start_payload"
        set_bot_menu
    end

    def self.cron
        broadcast_all ":princess:"
    end

    def self.bot_logic
        ENV["DOMAIN_NAME"] = "https://2c654be7.eu.ngrok.io/"

        if @request_type == "CALLBACK" and @fb_params.payload == "RESET_BOT"
            @current_user.delete
            reply_message "Removed all your data from our servers."
            return
        end

        return reply_message "This is never sent"
    end
end

What did I do wrong?

davidmann4 commented 8 years ago

So interesting, another person had exactly the same problem. Not sure what exactly fixed the issue tbh. Our theory was that fb api had a hickup. But if you got the same problem there must be an other source of the problem :)

Which fb hook callbacks you use ( settings in fb developer )

davidmann4 commented 8 years ago

@ramonh funny, we had the aame issue yesterday

phillipp commented 8 years ago

I activated all of them. I noticed that the API sends the bots messages (the messages the bot sent to the user) to the API, so reply_message will in that case try to sent the message to the bot. That can't work. But I wonder why that happens? Did I subscribe to too many events? Is filtering on the server side necessary?

phillipp commented 8 years ago

Looks like it is the message_echoes event. After unsubscribing from it it works fine.

hola-soy-milk commented 8 years ago

Good to know! Thanks for confirming.