Charca / bootbot

Facebook Messenger Bot Framework for Node.js
MIT License
974 stars 253 forks source link

messaging_type property mandatory #79

Closed 5hay closed 6 years ago

5hay commented 6 years ago

Hi!

In this blog post (https://messenger.fb.com/blog/2-2-release/) Facebook states that the "messaging_type" property will be mandatory in all requests to the send API.

Please note that after a six month integration period, the messaging_type property will be mandatory and all messages sent without it will not be delivered. We recommend implementing it as soon as possible and also expect to add more required flags in the coming months.

Is this property already set by bootbot?

Charca commented 6 years ago

Thanks, @5hay

The messaging_type property is not being set by BootBot, and like you said, we definetely need to support it before May 7, 2018 when it becomes mandatory.

It looks like there're currently 4 different message types: RESPONSE, UPDATE, MESSAGE_TAG and NON_PROMOTIONAL_SUBSCRIPTION, but more could be added in the future.

My first impression is that we could probably default messaging_type to RESPONSE and then provide an option to all the methods in the Send API so you can set a different type, for example:


bot.say(`Hello human`) // defaults to { messaging_type: 'RESPONSE' }

bot.say(`These are today's news`, { messaging_type: 'NON_PROMOTIONAL_SUBSCRIPTION' })

Thoughts?

5hay commented 6 years ago

I would do it exactly the same way actually. I'd love to help with implementing but I don't have any spare time atm unfortunately.

mraaroncruz commented 6 years ago

I'll take a look at the docs as I am unaware of this change. I'll also add the docs asked for in https://github.com/Charca/bootbot/pull/54 so we can get a bit more of a test suite (which is included in the PR).

I also like this solution.