Bot read from my api endpoint - facebook

I am creating a bot on facebook messenger, following the tutorial here
Is there a way for the bot to retrieve results from my own api endpoint?
Essentially, I have set up an api endpoint from which results in json is to be returned. I would like the results to populate the template in facebook messenger, like how the current CNN messenger bot shows news based on queries
How do I do this?

Your bot can do anything you want from him. But you have to setup him first on your server...
What he will return, or his behaviour is up to you.
You can use PHP with my API: https://github.com/Fritak/messenger-platform
Just follow an example and then return generic template.

You can use API.ai to create chatbots on Facebook messenger pretty easily. Full disclosure = yes I work there. We've had great feedback on our FB Messenger integration as well as Slack, Kik, Telegram, Twilio SMS, etc. https://docs.api.ai/docs/facebook-integration

Related

Social media notification integration to our website

Following are my requirements
created space in website that user can come and sign up with FB or Instagram to integrate their account
Through Graph API for FB and API for Instagram, I can able to view and post the images to FB (post is not possible to instagram)
My requirement would be any activities (like and share ) happened at the FB or Instagram page should receives as notification to my website
I came to know there is no direct APIs available to achieving notifications but I have seen them in "Social Stream" app.
any help would be appreciated on how could achieve this functionality
TIA
You can get likes, comments and posts using API. You can poll them at regular interval, compare new data and create your own notifications.
(You have to get your app approved by Instagram to get API permissions, which may be possible for your usecase, if you do get approval, then its possible to achieve what you are trying to do.)

How to test FB messenger bot with multiple users

Has anybody yet a way to interact with an FB messenger bot without using real FB accounts? I want to do automated testing and obviously not use real accounts for that.
I was not able to figure out how to allow access to a page to 'test users' or create a test page and subscribe the test app to it.
Any ideas on how to do this?
I use a wee web app I made to act as a local version of the facebook messenger api server and run user actions.
https://github.com/Fraser-Greenlee/bot_tester
On it you can write a script to define new users and their actions.
From the Facebook developers dashboard, select your app and then Roles. From Roles you can add other Facebook users as test users. It was easiest for me to use the users facebook id. Adding by email did not always work for me.
I am not aware of how to access a Facebook bot without a Facebook account. I created several fake accounts and had my friends test the bot. After testing, I deleted the fake accounts.
For more information on setting up a bot see my article Facebook Bots for Fun and Profit
The example bot is DMS Software Bot
The source code is Github fb-robot
Testing fb bot with non-fb user is currently not supported. Following are the reasons:
fb messenger requires the user to be logged
fb creates page scope ids (PSID) for each user who is interacting with the bot and hence login on fb is required
Coming to your question on testing:
you can add fb users as tester to your page and your app. Explained here. For your app https://developers.facebook.com/apps/[app-id]/roles/
Once added they will be able to send message to your bot (page) from messenger
On another note, if you are using 3rd party apps to build your bot (eg: api.ai, wit.ai) they already have emulators within the app which makes testing easier.
One easy way to achieve automated testing for messenger bots atleast is to try to mimic a request coming from FB. You can just log the request you are getting to your bot to find the signature of the request that FB sends. Then you can just pretend to be FB by sending http requests with the same signature. You will also have to add in code to respond to these http requests with your reply instead of just sending the message to FB's send API.
So in node it would be something like
sendMessage(<your reply>);
res.send(<your reply>);
Now you have an automated way of sending and receiving messages which you can use for automated testing.
However I think the bigger challenge is coming up with enough test cases. You need to use a combination of clustering over available data and classification to generate new cases.
I have been working on a tool to make this easy. So if you are interested you can sign up for early access. http://ozz.ai

Facebook API for conversations

Me and my friends are frequently using a Facebook group chat conversation. I'm building a web app that allows them to login with Facebook and do some silly stuff. Is there any way I can add that specific Facebook conversation so they can chat while on the website just like they would on facebook? I checked the API but didn't really find any references to this
Has anyone done stuff like this?
The Chat API is deprecated, it is impossible to do that.
https://developers.facebook.com/docs/chat

Sending email notification via GRAPH API Facebook

Does anybody know how to send a notification email via GRAPH API. I found some code in REST API like (notifications.sendEmail) but is there something in GRAPH? Thank you.
No, there is no equivalent, and no plans to add one.
From the Facebook Documentation:
Please note: We are in the process of deprecating the REST API,
and will not be adding support for this in Graph API.
Developers should directly send email to users once they are granted permission.

How can I display user comments for a Facebook Event or Group on my website?

I'd like to integrate user comments for a Facebook or Group on my website. It's simple enough to insert a Facebook Live Stream widget into a site, but it only shows comments that other users post via the widget on my site.
I'm using ASP.NET MVC, but would prefer to use HTML/Javascript integration over server-side integration if possible.
Your requested Feature is currently not possible.
I guess there will be something similar possible but only for Pages and Profiles. (See Comments API) For current use i would try to stick to an Page (Public Profile) and use the Fan Box
Try the wallflux of your group, http://wallflux.com/feed/115227675156013, does that serve the need?
I don't think Facebook permits scraping their content back to your site.