Facebook Messenger Send Api - send to a big amount of users - facebook

I have a bot over Facebook which people are subscribing for sports updates.
I have 1,000 - 10,000 users I want to send out an update to.
Currently, in small scales like 20 messages , I would use a Facebook Batch request.
But, i'm not sure what would be the best way to send my messages in a large scale.
My two options are:
Batch - limited to 50 requests per batch request.
I don't really know if I should expect a delay in the execution of the request.
Regular calls - I will iterate through my receivers and send each of them a message separately.
I'm afraid Facebook might block me for thinking i'm spamming, or I will exceed the rate limits.
I have to say I was expecting a more generic method coming from Facebook since they are allowing users to subscribe for update through my bot, hence, I was expecting them to provide a guide on what are the best practices for sending the update users subscribed for.

You should definitely use Facebook Messenger Broadcast API for this. This will broadcast your message to all user subscribed to the bot.
Caveats:
You have to apply for this permission. (pages_messaging and pages_messaging_subscriptions.Takes about 1-2 days, but
can test on Admin/Test users of the app)
Each broadcast has to be a separate broadcast. (e.g. you can't send image and a text together, each has to be its own individual broadcast).
Have some kind of un-subscription option as well. FB user might think you are spamming even if you clearly say in the messages that your bot will send updates.
Use custom labels to create targetted sends. So you can either subdivide who you will send updates to about specific issues or just label people if they unsubscribe to your broadcast or not.
Basic workflow:
Get permission to broadcast.
Create message_creative_id via POST to endpoint
Use message_creative_id to POST a broadcast_messages
On a successful send you will get back broadcast_id

Related

Is is possible to create a custom messenger bot on Facebook?

I would like to know that we are having a lead generation campaign running on Facebook but few of the times our staff isn't available to answer the query on Facebook messenger, so based on that short-coming I am thinking to devise a mechanism that "If within 1 hour of user's message no one replies to him then an automated BOT message should get sent to him."
Please don't deprecate this question as it is based entirely on knowledge. And if perhaps someone has hints or links on how to achieve this thing then I will really appreciate it.
Thanks.
Some options:
You can query your /conversations edge every X minutes to detect when there is a message from a user which has not been replied to, then you would send the automated message using Send API.
https://developers.facebook.com/docs/graph-api/reference/v10.0/conversation
https://developers.facebook.com/docs/messenger-platform/reference/send-api/
You can use webhook data for incoming messages to create a task that will run at received_time + 60 minutes, find the thread in your conversations edge based on PSID and then check if there has been a reply
Alternatively you can check out Handover Protocol which allows a Page to simultaneously use a Messenger Bot and Live chat agent to handle messaging
https://developers.facebook.com/docs/messenger-platform/handover-protocol/

How do you make Facebook Messenger bot broadcast message?

I'm facing the problems while making Messenger bot broadcast message. I can make it broadcast at first, but I find that when the bot have to send message to a big amount of users (around 100-200 users). It proceed very slow and some users don't get the message.
I'd like to ask you guys that:
How do you write code to make bot do broadcast? For me, I just put sendTextMessage it the loop which run all page-scoped ID of users. As far as I know, Facebook don't provide specific broadcast or batch sending command right?
According to documentation, Send API do have its limit, but no number specified. It say that 'Messenger Platform supports a high rate of calls to the Send API'. I'd like to know how high is 'high rate' ?
Facebook just updated its Messenger Platform yesterday (7 Nov).
It's now support Broadcast API (beta) and custom label for targeting recipient. Looks interesting.
https://messenger.fb.com/blog/2-2-release/

Facebook real time inbox messages with Graph API v2

Does anyone know a way to fetch a user/page inbox messages in real time?
I've found this link, but there is no mention about inbox messages.
The Real-time updates are about... -updates-. That means you will only get notified about changes in the fields described in that link (not regarding the Payments API, that's a different case).
So, you can't get real-time inbox messages.
You can subscribe to the notifications, but I'm not really sure if Messages notifications are included in those...

Facebook Graph - What is the limit to send private messages from page to users?

I am developing a chat robot that works with private messages on facebook. The person sends a private message to a page that I own, and then I will send an answer for each message.
Everything is working, but I need to be sure facebook won't complain about the amount of messages I will send. This application will receive a lot of interactions at the same time, but in some early tests one of my messages were received like that:
http://cl.ly/image/1C1n0Z2L0R05
I am now using Batch Requests to send all messages, on an interval of 15s.
Do someone know some way to test it with multiple users and multiple messages at the same time? How the process of identification of spam messages work on facebook? How many messages can I send at the same time and in what time range to prevent that kind of behaviour?
Thanks.
There is no set limit or guideline on volume.
But really volume should not be the issue. There's a huge number of factors that is taken into account to determine if a message is spam... too many to discuss here. But you can assume basics: the content of the messages, the volume per user in a given time period, the content variation per user, has this app been flagged as spammy before, by how many users, etc. I would say its reasonable to assume your test user is probably going to be triggered as spammy because you're likely using it far far more than the average user would.
So, in short: it depends entirely on what exactly you're doing every 15 seconds.
Tip (although I cannot verify it): if you are trying to batch send a message to a number of users at once, without them very recently contacting you, you're probably gonna be flagged as spammy.

Sending App-generated Requests to all users of an app

Is it possible to send an app-generated notification request to all users of a canvas app? I'm currently sending requests to individual users, but not the entire user base. I do not want to simply loop over all users and send an individual request to each. Furthermore, that seems SPAMish. In fact the whole concept seems SPAMish, so I wouldn't be surprised if the answer is simply, 'No, Facebook won't let you do that.'
You could send to 20 users at a time with batch requests.