Search code examples
apifacebookbotframework

Botframework v4 - Facebook Channel - Operation returned an invalid status code 'Forbidden`


Last year I developed a chatbot with Microsoft Bot Framework that I integrated in the Facebook Messenger of a page. Everything worked fine until 16th of December (last successful log). The page is not used by a lot of people therefore the application might have worked also longer than that.

Today I tried to use the chatbot again and I did not get any response. In the Logs I just found the error message "Operation returned an invalid status code 'Forbidden`".

After a bit of Debugging I found out that the problem is sending messages back to the Facebook Messenger.

context.SendActivityAsync(...)

I did not change any configuration within my Azure Bot Channel registration recently. I am aware of the privacy changes within the Facebook API, but as I already struggle with sending a simple text response like "Hi" I assume that cannot be the problem. Also the permission scheme has changed for Facebook apps. I have the permission for "pages_messaging". Do I need another permission now? Or did I miss another change in the Facebook API?

Technical Details:

  • Facebook API Version v6 (tried also v9 but no change in behavior)
  • Chatbot based on .Net Core 2.1
  • Bot Builder SDK v 4.11

Any hints what I did wrong or where I can look for further information is much appreciated.

Edit: I tried to add a new page to my Facebook App and get following message: enter image description here

There is a hint that a permission is missing, but I cannot find out which one I require. As I only send responses to FAQ's and if required handover to the customer service inbox I just requested the "pages_messaging" permission. Do I require any other permission now?


Solution

  • I found the problem. For everyone that might have the same problem: In our case the administrator that added the Facebook pages to the application was removed from the admin permission list of the pages. After re-adding the admin permissions for the pages the bot started working again.