How can I make the bot code independent of the channel,( I want a single bot code for facebook at work and DirectLine) - facebook

My aim is to use a single bot code to run the bot at two different channels DirectLine and Facebook#work. I am going to cite an example of issues that I face when I am using facebook channel and directLine channel. The issues I have are the following:
The links or urls though supported through mark down in DirectLine are not supported in facebook, I have to make a seperate hero card.
Even if i use an url through hero card in facebook, the skype link cant be connected, bcos the link "sip:***#xxx.com", is changed to xxx alone.
I cannot get the name of the user from the "From.Name".
So what is the best possible way to resolve this? Should I simply write functions for each channels??Is that the only option.
What I want in the end is a bot code that is independent of the channel that is used for chatting

Use a simple switch-case for the Activity.Channel in the messagesController, then format the Activity.Text that is giving you troubles for each channel

Mark down is not supported in the Facebook channel. So there's no way to directly connect to Skype from Facebook channel.
Facebook# work returns only the id of the corresponding user to the bot framework. We have to then use the Facebook api to get the name of the user with the corresponding id.

Related

Send private message to 1 or more friends using FB API

I'm building a web application that performs an analysis based on the inputs a user enters. I want to allow the user to send this analysis, which will be 2-3 sentences max, to one or more of their Facebook friends through the messenger platform.
At first I thought the Send Dialog was the way to go, but it appears I can't pre-populate the message field at all (source).
Next I tried integrating the Messenger Platform but this appears to target businesses that want to connect their site to a Facebook Page and setup a chat bot, which seems far too complex for my use case.
Is there anyway I can allow the user to send a private message to one or more of their Facebook friends or is this not possible for a specific reason (e.g. prevent spam, security concerns)?
This SO question here appears similar to my question.
There's no way to do this unfortunately. Makes sense, however, as apps could spam people's imessenger if it was possible.
The best alternative is to use the Send Dialog component.

Is there a way to generate a map directions image (for fb messenger bot usage)

I'm working on a Facebook Messenger bot for a client and I'm trying to give the users a map with directions to the client's location. I know FB has a button to get the user's location, but I'm not sure how to show the directions.
Any ideas how I might go about doing that because I don't believe Facebook provides something like that by default or as a template message (I could be wrong?).
There is no template for this afaik, but you could just create a picture of the map (and directions) server side. Sending pictures with the bot is no problem at all. It all depends on how exactly you want to show directions, but i guess there is no other option. You can include a list too, showing all the steps/turns to get to the destination.

how to make my Facebook chatbot available for download

I want to make my bot available for download for testing purpose without
going through the actual review process of Facebook? This is just for testing purpose as I want to test how exactly end user will
download my bot from FB messenger platform and then will start using my bot. Is there a way/platform to try this? Can I do that?
(currently i am testing am sending message to my bot using FB page's messenger link as indicated in almost all the blogs/sites including FB's official
site.)
Can you please provide any pointers/links on this?
I see two options for you:
You want users to test your bot on Messenger:
Simply add them as testers in your bot corresponding Facebook page then ask them to look for your bot in their Messenger app.
Or you want to test your bot behaviors:
Enter botgen the chatbot generator I'm currently working on, which could help you test more publicly the bot you're working on. (assuming your bot doesn't need coding and is all about pattern conversation).
Just use the designer interface to design, run and test your chatbot.
Publish it and share it with your actual test users.

Facebook bot - retrieve image sent by user

I would like to know if this is possible for the Bot to retrieve an image directly send by the user in the messenger chat. (e.g. Get the image of a fire extinguisher on server side and save it)
I know there is this topic but because I'm in a case study, I need to know the "theorical" possibility so the response in it, doesn't match with my question.
The messenger bot documentation give only a example with texte and doesn't mention image.
Thanks for your understanding.
Yes according to the documentation
https://developers.facebook.com/docs/messenger-platform/webhook-reference

Does the Facebook's live stream social plugin allow tag filtering?

I'd like to build a feature similar to Envolve's chat plugin on my site that would allow users to chat (no webcams) around specific topics, using Facebook Connect. Users must also be able to see present users that are not connected to them so the XMPP option is out. The live stream social plugin isn't sufficient because there doesn't seem to be tag filtering so having 5 different chats about 5 different topics for instance doesn't seem viable.
Can't you specify an xid... "If you have multiple live stream boxes on the same page, specify a unique xid for each."
http://developers.facebook.com/docs/reference/plugins/live-stream/
We're adding jabber support soon so you'll be able to chat with Facebook users via your site. Please let us know what else your looking for. support[at]envolve.com
James (Founder # Envolve)