Facebook SDK edge.create is deprecated. Any alternative? - facebook-graph-api

edge.create and edge.remove JS SDK Events are deprecated. Is there any alternative to allows users to subscribe to the like happening event (fired when the like action is completed)? I've not found any webhooks to replace the callback function I used before deprecation:
FB.Event.subscribe('edge.create', function(response) {
// like clicked
});

edge.create and edge.remove JS SDK Events: These Events will no longer
be accessible. As an alternative, you can use our Webhooks and be
notified every time someone likes one of your Facebook Pages.
For more information
Facebook Offical

Related

Instagram Webhook subscription fails

I am trying to enable an Instagram story_insights webhook on a live Facebook App. I am able to receive test data successfully, but won't receive any live data.
The webhook has been configured via the Facebook App Dashboard for an app with both "manage_pages" and "instagram_manage_insights" permissions granted.
I tried to perform a POST request to the {page-id}/subscribed_apps endpoint but couldn't subscribe to the instagram story insights as there is no related subscribed_field.
Is registering the webhook in the app dashboard sufficient to receive data, or do I need to perform some kind of registration for each Facebook Page connected to an Instagram Business account?
https://developers.facebook.com/docs/instagram-api/guides/webhooks/
With Graph API version 3.2, the /{page-id}/subscribed_apps edge now requires the subscribed_fields parameter, which currently doesn't support Instgram webhooks fields. To get around this, use an older version of the API, or include the subscribed_fields parameter with a non-Instagram field, then unsubscribe from the field later using your app's dashboard.
Just use some field that will most likely not change from your Facebook Page, like "email".
From the API docs it says ( https://developers.facebook.com/docs/instagram-api/guides/webhooks )
Technically it doesn't matter which Page Field you subscribe to. Your app will not receive notifications of changes to that field unless you configure Page subscriptions in the App Dashboard and subscribe to that field.

Facebook Messenger Chatbot Custom Event Tracking

I am trying to log custom events with a Facebook Chatbot I have developed, however I cannot for the life of me find a reference for the custom_events types.
The example listed on their reference shows fb_mobile_purchase as a custom eventName. I don't want that, and I can't find anywhere that lists other types.
I want to be able to track when the chatbot sends the user a specific message, but just setting the eventName to anything results in an event name in the Analytics as Reserved5.
Is there a reference to eventNames anywhere within Facebook Documentation?
You could consider using Chatbase for bot analytics (free to use), which has a Custom Events API.
Currently the docs give this as an example request:
var request = require('request');
request.post({
url : "https://graph.facebook.com/<app_id>/activities",
form: {
event: 'CUSTOM_APP_EVENTS',
custom_events: JSON.stringify([{
_eventName: "fb_mobile_purchase",
_valueToSum: 55.22,
_fb_currency: 'USD'
}]),
advertiser_tracking_enabled: 0,
application_tracking_enabled: 0,
extinfo: JSON.stringify(['mb1']),
page_id: <page_id>,
page_scoped_user_id: recipientId
}
}, function(err,httpResponse,body){
console.error(err);
console.log(httpResponse.statusCode);
console.log(body);
});
So, when the bot is sending that specific message you want to keep an eye out for, fire that message but with a different _eventName, and if needed other parameters.
Keep in mind, by recipientId they mean the PSID of the user the bot is sending the message to.

FB user button onClick event attend [duplicate]

I would like to make possibility for attending to event in Facebook feed view in my app. Is it possible by POST-request of Graph API?
IF it´s still possible, then by just doing a POST request to the attending endpoint. For example, with the JS SDK:
FB.api('/[event-id]/attending', 'POST', function(response){
console.log(response)
});
Afaik it was possible earlier, and you would need the rsvp_event permission for this.
Edit: I just tried it in the API Explorer, it definitely works: https://developers.facebook.com/tools/explorer/?method=POST&path=[event-id]%2Fattending&version=v2.5 (of course you need to replace the event ID)

Communicating over Messenger on behalf of another user's page

I want to make a Messenger bot with Messenger platform. But this bot needs to be connected to other Facebook users' pages, not my own page. I have a Facebook app with Messenger configured. I want to let other Facebook users who are page owners to give my application a permission to post on behalf of their pages through Messenger, as well as receive messages from their pages on my app's webhook.
The Messenger Platform docs only explain how to post on behalf of your own page.
Is is possible to make this through Graph API + Messenger Platform or something else? And maybe with a few pointers how?
This is how I send my messages:
uri: 'https://graph.facebook.com/v2.6/me/messages',
qs: { access_token: PAGE_ACCESS_TOKEN },
method: 'POST',
json: messageData
So I think if you would just need them to supply you with their page access token, and then you could send messages as their page through your bot.
EDIT: I guess this only answers how to send messages as them. To receive messages too you'd need to somehow subscribe your webhook to their page, which I think you need to be an admin of to do, so I'm not sure receiving their pages messages is possible through a straightforward system like what I'm suggesting. There may be other more complex workarounds though.
EDIT2: Maybe you can give them your webhook URL and have them verify and subscribe it for you

Aftership webhook tracking API

I am developing one e-commerce app project where I have to track the order status. I use Aftership Webhook API. Webhook provides a tracking event updates to our specified webhook URL(defined in our server). I read documentation but I dont know the proper approach to test the API. and in documentation it is also not defined. Can anyone tell or suggest me how can I test or track the updates.
To test Aftership API, first, you can follow the API reference to get your API key. And to tracking an order with webhook, your need to do the POST /trackings to https://api.aftership.com/v4 beforehand with body like(you can add optional parameter to the request body):
{"tracking": {"tracking_number": "<order tracking number>"}
And then you can follow the webhook documentation and add your webhook URL and configure the types of updates you want to get. At this point, you should be able to see the tracking update HTTP request coming into your webhook URL. Remember it will only send callback request when there is tracking status update.
Also, you can use other tracking APIs to get the status, update the tracking or delete it now.