Is there a event handler for new comments for Facebook comment plug in? - facebook-javascript-sdk

I am trying to leverage Facebook comments plug in and push notifications for post on my page. What I am basically trying to do is:
user creates a post
the Facebook comment is dynamically inserted for that post by suffixing id from that post.
The above two are already done in the page.
Now what I want is, when someone posts, a push notification is subscribed if the user allows and when a comment is made a push notification is pushed to the user. The user is identified by the ID of the post as well which is stored on database.
I tried to attach a event handler on Facebook iframe comment box but was thrown with cross origin error.
I was trying webhooks but couldn't work on local host and found I need ngrok to validate my test url. I am posting this to ask is that is my flow even valid or I am seriously misunderstanding the concept. If someone could validate my flow.I will be happy to work on it or I will be just wasting my time.
Here's the link with the Facebook comments applied on post:
https://helpingcow.com/postit/get_share_listings

The facebook have killed "comment.create" event subscriptions.See the answer here to my related question answer.The preferred method is to use webhooks.
As I have already mentioned in question,that I cant use ngrok because it only supports python 3.6 and above and I have 2.7.
But I used localtunnel from npm.It did the work and I have validated my localhost url and test webhooks are now functional.I really dont need the data from the json payload from webhooks but just need a way to get to id of the posted item when the facebook comment is posted but there is no way the client can know about that event unless some server sent events are used.

Related

Correct way to ask for chatbot verification

I want to 1) be able to receive updates about the activity in the comments on my instagram page and then 2) to be able to leave a reply.
I far as I understand the products, 1) can be made using Webhooks and 2) requires Instagram Graph API.
My app is intended to be used only by me. However, when I try to go through verification process, the form requires me to show how users can log into the app and so on. This does not apply to me.
The app is really simple: the comment is posted -> Webhook sends an update -> a reply is generated (this is out of the scope of this question) -> a reply is posted using Instagram Graph API from my page. You can see that the app does not have or require any additional UI.
The owner/developer of this chatbot is business, however it does not provide any servicies to other businesses. When applying for verification, I am only requesting 'instagram_manage_comments', however even there they ask me about the user log in (see the attached screenshot).
The account went through business verification already.
I was not able to find the information that is 100% relevant to my case.
The question is: what is the correct way to ask for the verification? Does Instagram support apps without additional UI and logging in? And basically what am I doing wrong?
Thanks in advance!

Google GMail callback when someone reply to thread

I'm using Google GMail Api. All works fine with synchronous requests. However I would like to get notified when someone reply to given thread_id to a callback somehow.
I found this article https://developers.google.com/gmail/api/guides/push?hl=pl about push notifications and it's great but still I don't know how to setup Observer I have described above.
I'm using PHP btw, but I just need concept how it works and how I can setup that kind of communication between API and app.
There is currently no available API that detects/observes (something that behaves like a callback) if there is a reply for a specific thread_id.
You'll have to do the checking yourself, doing some polling (with users.threads.get) to see if there is a reply. Similar to what the OP was doing in this post (emphasis mine):
We have a web application that makes use of the Gmail API to automate certain emails on our users' behalf. When the application sends an email, it stores the threadId returned by the Gmail API. It then uses this threadId to poll the Gmail users.threads.get API, looking for replies. When a reply is detected, it pauses future emails.
You can use the Push notifications provided by Gmail API. The document is available here:
https://developers.google.com/gmail/api/guides/push?hl=pl#python
It's pretty much straight forward. Create a topic, then create a push subscription for the topic. It requires a webhook pointing to your web app. Grant necessary permission to the Gmail service account as mentioned in the document.
Use the below Python code to get notified:
request = {
'labelIds': ['INBOX'],
'topicName': 'projects/myproject/topics/mytopic'
}
gmail.users().watch(userId='me', body=request).execute()
We get a response with HistoryId. Tracking all the messages since the HistoryId can be done like this:
history = (service.users().history().list(userId=user_id, startHistoryId=start_history_id)
I found the below video helpful:
https://www.youtube.com/watch?v=wjHp9_NAEJo

YouTube Data Api v3 - subscriptions.list and mine = true

I found following problem.
If user is authorized with youtube and you call subscriptions.list with parameter mine set to true. Then you get a list of subscriptions of authorized user. This works just fine if user has YouTube account linked with g+ page or if user has its own channel on YouTube. But if it is just a normal user without a channel and g+ page then this request returns "subscriberNotFound" error.
Is this a bug or am I doing something wrong?
You need to have a channel to subscribe, so that's normal.
You can read this blog for working with channel ids.
Also please use stackoverflow for only programming issues.
As suggested here, you should file bug reports or features request in public issue tracker.
The call to subscriptions.list can't return a subscriptionNotFound Error. This is an error which only occurs when you try to delete a subscription. Maybe you are calling the wrong method? Take a look at this link for more information on the possible error codes, and details why they occur. For all Error codes look here

Google Buzz return the status if the post submission was success or not?

Hi How can I know the status after the post submission? from my site i have made a google buzz buton when I click on this the defined post will submit to the google buzz url. but I want to know if the post submission was success of failure, because I need to keep a track on that. So that on next time I dont need to show the buzz icon there if I already posted there.
So how will I know it was a success or failure?
http://www.google.com/buzz/post?message=Here's%20Buzz!&url=http://www.google.com/buzz
or
window.open(
"http://www.google.com/buzz/post?" +
"message=Here's%20Buzz!&url=http://www.google.com/buzz",
"_blank",
"resizable=0,scrollbars=0,width=690,height=415"
);
You would need to either make an API call to search for the URL posted or you would need to subscribe to the Buzz Firehose to confirm that the post was created successfully. The widget does not have a callback mechanism.
Alternatively, you could go through the OAuth 2 sequence, and instead of posting via the widget, post via the API. Posting via the API will give you a response back telling you whether it succeeded or not.

Using Input Box to Post onto Twitter

Is it possible to post onto Twitter using the sharing URL, for example:
http://twitter.com/home?status=My Status Update
But, instead of creating a link for a user to click, I want to have an input box that will post the content of the input box as the status. So, whatever the user types into the input box would replace My Status Update.
I'm thinking there should be a way to use the form to post onto this URL hxxp://twitter.com/home?status=XXXX where XXXX is the input value. Is this possible?
UPDATE: I realize I described this wrong - it doesn't have to ACTUALLY POST the status, it can take them to Twitter, ask them to logged in (if not, skip), and then put the status update inside the Tweet Box and require the user to press Tweet to send it
Thanks!
No, Twitter require the status to be sent from it's interface.
You can provide the user an option to send status from your site only with twitter application and only after the user authorized your application to sends twits in his account.
Sadly, the solution to this may be more complicated then you think.
Twitter recently switched to full OAuth authentication to interact with their api and to post status updates etc.
In short, to do what you suggest above will require your visitors to log in.
To simplify this, on my websites I use the Official Twitter Tweet Button because I feel that my visitors will trust it the most and will enter in their username/pass without worry.
The Official Twitter Tweet Button page has a builder where you can select various options to change the look and content of the tweet itself.
Be sure to checkout the full documentation for the advanced usage examples and the full reference of properties that can be used with the javascript tweet button
p.s.
On my site I registered for an app so I could include the following js file:
<script src="http://platform.twitter.com/anywhere.js?id=MY-APP-ID&v=1"></script>
And my links look something like this:
Tweet