How to add "subscribe button" in facebook messenger bot? - facebook-messenger-bot

I need to add a button (subscription ) in my messenger bot through which users can subscribe. and after that bot will automatically send latest post to the users at the specific time.
I was going through documentation but i am unable to find any proper documentation for it.
Can anybody please help regarding that?

Facebook don't provide a mechanism to manage subscriptions. It's up to you as a developer to choose how to implement this - for example using a button with a payload to confirm that the user wants to opt in.
You could perhaps put an Opt Out option in your persistent menu and listen for the relevant payload and unsubscribe the user.
Facebook have published some documentation about this, explaining how they expect subscription messaging to be triggered:
Person sends a message to a business or clicks on a call to action button within Messenger to request subscription messaging
Person requests subscription messaging from a business via a Send to Messenger plugin
Person signs up for SMS alerts
See the full page of documentation at https://developers.facebook.com/docs/messenger-platform/policy-overview#messaging_types for more details on their expectation

Related

How to build in app notification service?

I'm learning backend and API development and trying to understand how to implement some features from scratch without using any paid third party service.
I want to understand this concept from design as well as implementation pov. Please share if you have any resources where I can learn how to code the below service.
How to build in app notification service like one of these from scratch ?
Notification when user likes or comments on a post (Instagram, Twitter)
Notification when someone views your profile (Linkedin)
Notication when a channel you are subscribed to uploads a video (Youtube)
These are different from push notifications like
Notification when someone sends you a message (All chat apps)
Live status via notification of your delivery (Food delivery apps)
Push notifications need not be stored permanently in any database but what happens with in app notifications? How to build such service which is scalable too.
One possible solution I could think of is this, for notification on post like
User A has made a post.
User B likes their post.
From likePost API emit an event which will notify User A that User B liked their post, listen for these real time events on client side. This can be done via sockets.
Do not store any notifications in database, just update the notifications in UI on that event emitted by likePost API or listen to real time changes in likes attribute of a User's Post table (is this possible?) and update UI.
In UI just show all such notifications by fetching from likes and comments table.
But I wonder how scalable is this approach.
I searched but couldn't find any good resources regarding this, so please if anyone could explain this or provide link to any blog or videos it will be helpful.
(P.s. I'm an undergrad student and don't have experience in system design and architectures, just started learning about these so just curious)
Thanks.
apps like Facebook, Instagram and linkedIn provides web hook of notifications. Webhooks allow you to receive real-time HTTP notifications for subscribed events. This functionality is only available for applications with an approved use case for webhooks. Webhhook received as a notification when user comment on your post or like your post, a web hook can be used to retrieve the information of post, comment and commentor etc.
I am attaching a reference of LinkedIn web-hook.
https://learn.microsoft.com/en-us/linkedin/shared/api-guide/webhook-validation

Does long-polling work always even if the user switches app?

I have an application which sends notification to its subscribers through telegram.
For someone to subscribe, he needs to add his request in my website and after that, to identify his self, he needs to start a conversation with my bot using a secret code generated by the server.
For example, whenever he completes his request he should click a button which leads him out of my website and to telegram's chat (using ), in the background, the website is making long-pool requests to the server to check whether the server received a notification from telegram with this secret code abcd and to get the chat id assosiated with the request so it could store the request with this specific chat id.
The process seems to work just fine for many users, but for minor amount of users it's not working, they are starting a conversation with my bot but not getting any feedback about a success. It seems as whenever they leave the website (or the browser) and follow the path of the link (https://t.me/mybot?start=abcd) straight to telegram app, the long-pool is being stopped.does that happen sometimes when long-polling?

Google chat API - Receive user reaction on bot message

I'm wondering if the Google Chat API can call our endpoint when a user put a reaction (an emoji) on the message
has anyone made this working ?
Thanks
Issue:
You want the bot to be notified when there's a reaction to a message.
This functionality is currently not available, since the only Chat events that may trigger an action are:
ADDED_TO_SPACE: bot is added to a room or DM.
REMOVED_FROM_SPACE: bot is removed from a room or DM.
MESSAGE: a message has been sent to the bot.
Feature request:
This feature has been requested before in Issue Tracker, see:
Allow bots to be notified on emotes
I'd suggest you to star this FR, in order to keep track of it and to help prioritizing it. Also, since this FR has not been getting much traction, I'd consider creating a new one in the Chat API component, explaining the potential usefulness of this functionality.
Reference:
Chat API: Event types

Adding button to Slack Channel Message using Zapier Integration

Does anyone know of a way to add interactive buttons to a slack channel messages that are created using the Zapier slack channel message integration?
David here, from the Zapier Platform team. Sorry to be the bearer of bad news, but that's not currently possible. Because of the way button interactions are handled (centrally, to a single url for all buttons created with Zapier), we haven't come up with a good way for users to add buttons to their messages that would be in any way useful.
We track all feature requests that come in through tickets, so if you'd like to voice your support and get notified if/when this does get implemented, I'd suggest emailing in to contact#zapier.com.
There is a way to add buttons, but you need a premium account. It works by using the Zapier webhook function to send a POST request directly to the Slack API.
You can follow this tutorial to prepare everything in Slack
Then you need to add a custom request step in Zapier:
Screenshot from Zapier
Select method "POST" and paste the URL from your Slack application management tool
Build your Slack message using the Slack Block Kit Builder
Paste the JSON from the Block Kit Builder into the data field in Zapier
Replace text from JSON with dynamic fields from Zapier where necessary
Likely if you want to have buttons, you would want to use them to trigger further Zapier events. For this, follow these steps:
Create new Zap triggered by Webhooks by Zapier
Select "Catch requests"
Copy Request URL
Navigate to your Zapier application management tool and find your app's Interactive Components section
Paste Request URL from Zapier

Telegram bot check if user online

How can I check is user online or not, if I have users chat Id? I tryed bot.userStatus(myChat); but this is wrong.
Telegram Bot APIs don't offer any methods or object's attribute in order to get the user status, whether if he's online or not.
Your chatbot is able to gather user's information as soon as he wrote a message to the chatbot: these informations are the User's object fields as described into the Telegram Bot API documentation.
According to the available fields, user status (online, offline, etc.) unfortunately is not (yet) available.
According to another question posted here, it seems that getting the user status is possible via Telegram API so that creating a Telegram registered application which is not the same thing of using a Telegram Bot.

Resources