creating a link that will open facebook messenger and send a message - facebook-messenger

i'm creating a registration code for users to a facebook messenger bot i am writing.
instead of asking them to open a chat with my bot, and type in the registration code, i would like to provide them a link that will open their facebook messenger on a chat window with my bot, and send the registration code automatically.
i saw a link that opens the chat window (https://m.facebook.com/messages/compose?ids=USER_ID) but can't get it to send a message too.
if you know how to do that, or have an alternative suggestion, i would appreciate the help.

Check out the new referral webhook-reference. It gives you a way to link users directly to your bot with support for passing arbitrary parameters via the link.
So a possible approach would be:
Make sure your bot is subscribed to the messaging_referral event.
Craft your bot's m.me link to include the registration code in the ref param e.g http://m.me/mybot?ref=REGISTRATION_CODE. if you're interested in security you might consider encrypting the code
Send the link(s) to the user. When the user click's the link, they're directed to your bot on messenger and once they initiate a session with your bot, you'll receive a messaging_referral event at your webhook with a payload similar to
{
"sender":{
"id":"USER_ID"
},
"recipient":{
"id":"PAGE_ID"
},
"timestamp":1458692752478,
"referral": {
"ref": "REGISTRATION_CODE",
"source": "SHORTLINK",
"type": "OPEN_THREAD",
}
}
You can then evaluate the ref value and send your desired feedback to the user.

Every messenger app use it's own link. For facebook https://m.me/XXXXXXXX where XXXXXXXX - page name.
I always use https://msng.link/fb-messenger.html for generation FB link. Better to remember one website and genereate all messengers what you need.

Related

Authorization flow for Microsoft Graph API

Very new to the Microsoft ecosystem, trying to understand the flow.
Use-case: we need a Teams bot that sends personal messages to users saying "A customer is waiting at location X" with 2 buttons [Accept] and [Reject] containing personalized links like "https://someurl.com/accept?message=123&user=[user_id]".
How I think I should do it:
Add a special user "servicenotifications#ourdomain.onmicrosoft.com"
Authorize the user & then get a token
Use the token in Send message with cards with cards containing button links
My problem: Got confused with authorizing my special user. Examples on auth V2 require to "redirect the user to the Microsoft identity platform /authorize endpoint." — in a nutshell, show them the login screen, ask for consent and so on.
But my user is a special notification bot, there is no human and I need that fully automated without any user interaction at any point. It's basically a background service sending messages under specific circumstances. Like a Slack bot telling you "Hey, reminder, John has birthday tomorrow".
My questions:
In general, am I moving in the right direction? Or is there a better way for the usecase?
How do I authorize this user without showing any login screen? Because that's an app, a bot, it's not a human and will be controlled fully externally.
Since authentication will be initiated by a bot, the ideal solution is to implement the OAuth2 Client Credentials Flow so that a service principal can be authenticated and authorized. Take a look at Get access without a user for more information.
There may be some operations that may not be allowed for service principals (documented as applications) like Sending chat message to a chat.

Salesforce Chatbot : use NLP when the bot ask Question

I have setup a chatbot for my customer.
For that, I have configured the bot with different dialogs and pattern to help them going to the response they seek. I also have activated the Einstein bot intent (Natural Language Processing : NLP) to let them type answer to get directly to the right dialogs.
But it's here that I have a problem. When I set a dialog with a question (with or without choices) when I write an NPL answer, the bot stop and wait another input.
Exemple: the bot asks "Are you ok?" if I respond "Agent" (word link to another dialog) the bot stop and if I rewrite "Agent" the bot start the dialogs "Agent".
Dialog config : Dialog config
Chat exemple : Chat exemple
I don't know why it's happening or how can I resolve this. I have read the documentation but nothing link to this problem.
Thanks for your time
I have found the issues. It comes from the entity that we were using. The entity was set with a standard text. So, when a user was writing some text (utterance values or not) it was store and that was good for the bot.
The solution was to create an entity of Value type. Write in it the Buttons label. Like this if a user clicks on the button or write the button label, it can be stored and go further, if not it will go on the intent recognition. And finally, if all the 2 fails, the bot goes in the conversation repair.
Here is a process Schema draw by a salesforce member

How to add typing indicator in React webchat

I'm creating a bot application using bot framework web-chat and react js. I have almost completed the project. Now i just want to add typing indicator to my application. As i'm calling directline webchat to the application, How can i do that?
Web Chat is a Direct Line client, which means it handles the user side of the conversation. If you want the bot to send a typing indicator for the user to see then you need to handle that on the bot side. You can learn how to send a typing indicator here. You haven't said what SDK you're using, but you may also be interested in the typing middleware.
Web Chat does have a sendTypingIndicator option but it's apparently for indicating to the bot that the user is typing in case the bot is programmed to use that information.

Create telegram channel in nodejs or angular

Is it possible to have a link,a button, or similar on a website that permits to create a new channel?
E.g., when I click on the link, I send a message with my credentials (phone number is enough i tihink, but not sure) that says "create a new channel called foo".
Is that possible (and if, how can I do that)?
I searched in the telegram API but I had no clue..
I also found this but I have no idea how to do what I want.

Send data from silverlight application to a particular user in mvc application

I have an mvc application where you have to be registered to log in. So you have your profile page and etc... As a part of the application I have a chat for all users (silverlight page). You enter the chat from your profile page. You have a list of online users there (who logged in on the site and not necessary entered the chat page) but exchange messages you can just with users who did enter the chat page. Otherwise they won't see them. Here is my problem.
So, I want to realize next functionality: if user who didn't enter the chat page was chosen by another to start conversation in chat (silverlight), he should get a pop up message on HIS profile page (mvc) with invitation to the chat. I understand how to send data from silverlight to mvc through WebClient and json format. I don't understand how to reach particular user's profile page. I can think just about some database table with this kind of invitations and some timer on the profile page to check on them.
Please express your ideas, thoughts or opinions in this matter. I would appreciate any help. Thanks in advance.
Maybe you should check out SignalR.
Like you mentioned you need some way to signal another client about the message by checking periodically. SignalR does this for you and in modern browsers uses Websockets to make it even better.
It is very easy to setup and you can build a chat application in a few lines of code. Without the need to save messages in a database (when you don't want to).
Check out this blog post for a sample chat application:
http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx

Resources