I am developping a bot for a facebook page. However in some case I would like to send a message to the communuty manager to answer directly to the user.
But I can find a way to get the url of the conversation
The format should be something like https://www.facebook.com/{PAGE_ID}/messages/?threadid={THREAD_ID}
The typical message that I get from messenger is:
{'entry': [{'time': 1480427999710, 'messaging': [{'sender': {'id': '1460044464009882'}, 'recipient': {'id': '1171951382925000'}, 'postback': {'payload': 'BUTTON_CONTACT_US'}, 'timestamp': 1480427999710}], 'id': '1171951382925000'}], 'object': 'page'}
Thanks for your help
Ok so someone from the facebook answered me.
We don't expose that information. In the context of Messenger
platform, contact with the recipient should only be done using the
Send API using the ID's we send you via Webhooks.
It's quite annoying when people are interacting a lot with the bot but you don't have a dedicated back-end to handle all the conversation (as a CM)
Related
I am trying to send more than 3 requests to my braze canvas from postman, immediately one ofter other. But I am not able to receive emails for all of the requests sent. I haven't setup frequency capping and customer re-entry time is 0sec. Can anyone help?
Edit: I found the Answer for this. Looks like Braze canvas cannot be used to send email to same person in succession. Braze Campaign is appropriate in this case.
Are you able to submit your code? It should look something similar to:
{"api_key":"<api_key>",
"canvas_id":"<canvas ID>",
"recipients":[
{"external_user_id": "{{User}}",
"canvas_entry_properties":{
"<any additional entry criteria>": "<values>"}}]}
That would allow you to push a single user. If the external_user_id does not appear in your instance when searched, it may not send.
https://www.braze.com/docs/api/endpoints/messaging/send_messages/post_send_triggered_canvases/#request-body
The information passed for the Canvas via the API must match up to the filters in Braze, otherwise it won't send. Make sure your API key can deploy Canvases as well.
I found the solution.Apparently, Braze campaign cannot be used to send email in succession to a single user. Switching it to Braze canvas solved the issue.
At the moment when trying to post any link from inc.com website via the Linkedin API (OAuth 2.0) it comes back with this error, which looks like LinkedIn are marking it as spam, however I can still post directly within Linkedin.com
Error:
{"message":"com.linkedin.restli.client.RestLiResponseException: Response status 403, serviceErrorMessage: Entity blocked by UCF: {lifecycleState=PUBLISHED, visibility={com.linkedin.ugc.MemberNetworkVisibility=PUBLIC}, specificContent={com.linkedin.ugc.ShareContent={shareMediaCategory=ARTICLE, shareFeatures={hashtags=[]}, shareCommentary={text=Mike Selden and Brian Wyrwas's Biotech Startup Finless Foods Is Making Edible Fish Without the Fish https://www.inc.com/jeff-bercovici/30-under-30-2018-finless-foods.html?cid=hmhero}, media=[{description={text=Cellular agriculture is poised to change the way we eat for the better, and Finless Foods is helping make it happen. }, originalUrl=https://www.inc.com/jeff-bercovici/30-under-30-2018-finless-foods.html?cid=hmhero, thumbnails=[{url=https://www.incimages.com/uploaded_files/image/970x450/finless-founders-panonew_350593.jpg}], title={text=Mike Selden and Brian Wyrwas's Biotech Startup Finless Foods Is Making Edible Fish Without the Fish}, status=READY}]}}, author=urn:li:company:11067858, created={actor=urn:li:member:233207359, time=1524741889593}, origin=API, clientApplication=urn:li:developerApplication:111336, versionTag=1, id=urn:li:share:6395231006479118336, firstPublishedAt=1524741889593, lastModified={actor=urn:li:csUser:2, time=1524741889656}, contentCertificationRecord={\"originCountryCode\":\"us\",\"modifiedAt\":1524741889649,\"spamRestriction\":{\"classifications\":[{\"systemName\":\"MACHINE_SYNC_BAM\",\"modifiedAt\":1524741889649,\"confidence\":\"HIGH\",\"spamType\":\"BADURL_SPAM\"}],\"contentQualityClassifications\":[],\"systemName\":\"MACHINE_SYNC\",\"lowQuality\":false,\"contentClassificationTrackingId\":\"FEF7FB2B21D5009642EF3F20C80ED626\",\"contentRelevanceClassifications\":[],\"spam\":true}}}. exception is: com.linkedin.ucf.integration.BlockedEntityException","status":403}
Any ideas what could be happening here?
This is the linkedin response to this:
this error means this post was marked by users as spam.
You need to open a linkedin zendesk ticket and provide your service request/responses with all the Share URNs involved to them. They will come back with the procedure to continue.
I have absolutelly the same question as dan here - Facebook conversion pixel with "server to server" option . There was written, that there was no way, but it was 2013, so I hope something changed.
So, is there any way to call facebook pixel events (e.g. CompleteRegistration) from server side now?
I can describe situation in more details. Imagine, that user visits our site, where fb pixel tracks 'PageView' of course. When user passes form and sends his phone number, we call 'Lead' event. But then we need to track one more event, when our manager successfully confirmes this user! Of course, it happens on other computer and so on, so there is no idea, how to "connect" to base user.
I've seen a lot of documentation departments like this, but I can't fully understand even if it's possible or not.
Logically, we need to generate specific id for user (or it can be phone number really), when 'Lead' event is called. Then, we should use this id to 'CompleteRegistration' for that user. But I can't understand, how to do it technically.
It would be gratefull, if somebody could explain it.
P.S. As I understand, it is fully available in API for mobile apps. Is it ok idea to use it for our situation, if there is no other solution?
Use Offline Conversions to record events that happen after a user has left your website. Logging these conversions, technically, is very easy. Setting everything up takes a little effort
tldr; check the code below
Follow setup steps in the FB docs (Setup steps 1-5) which are:
Setup facebook Business Manager account
Add a new app to Business Manager account
Create an Ad account, if you don't already have one
Create a System User for the ad account
After the setup, follow Upload Event Data steps on the same page, steps 1-3 to create an offline event set and associate it with your ad. These can be carried out in the Graph API Explorer by following the links in the examples. These can be done programmatically, but is out of the scope of making the event calls from the server for one campaign.
Once you have created the event set, then you can upload your CompleteRegistration events!
You will need to make a multipart form data request to FB, the data key will be an array of your conversion events. As #Cbroe mentioned, you must hash your match keys (the data you have available about your user to match them with a FB user) before sending to FB. The more match keys you are able to provide, the better chance at matching your user. So if you can get their email and phone at the same time, you're much more likely to match your user.
Here's an example of the call to FB using node.js:
var request = require('request')
// The access token you generated for your system user
var access_token = 'your_access_token'
// The ID of the conversion set you created
var conversionId = 'your_conversion_set_id'
var options = {
url: 'https://graph.facebook.com/v2.12/' + conversionId + '/events',
formData: {
access_token: access_token,
upload_tag: 'registrations', //optional
data: [{
match_keys: {
"phone": ["<HASH>", "<HASH>"]
},
currency: "USD",
event_name: "CompleteRegistration",
event_time: 1456870902,
custom_data: { // optional
event_source: "manager approved"
},
}]
}
}
request(options, function(err, result) {
// error handle and check for success
})
Offline Conversion Docs
Facebook has now a Server-Side API: https://developers.facebook.com/docs/marketing-api/server-side-api/get-started
Implementing this is similar to implementing the offline events outlined in the accepted answer.
Keep in mind that it will always be cumbersome to track and connect events from the browser and from your server. You need to share a unique user id between the browser and server, so that Facebook (or any other analytics provider) will know that the event belongs to the same user.
Tools like mixpanel.com and amplitude.com may be more tailored to your needs, but will get very expensive once you move out of the free tier (100+ EUR at mixpanel, 1000+ EUR at Amplitude, monthly). Those tools are tailored towards company success, whereas Facebook is tailored towards selling and measuring Facebook ads.
I tried accessing the facebook inbox using the graph API's https://graph.facebook.com/me/inbox?limit=0&access_token=<extended_access_token>
This returns few recent messages of the inbox without access to previous messages. There is no paging for inbox. Also, I couldn't find any documentation related to this. Any help would be appreciated.
Is the API designed to be this way?
Try using the until parameter for pagination of your inbox.
/me/threads?until=2011-05-01
The new inbox is now called threads rather than inbox. See https://developers.facebook.com/docs/reference/api/thread/ (yes in the Graph API Explorer it is plural rather than what the documentation shows as singular)
You can set any limit you want by adding ?limit=Amount on the request.
Example:
FB.api('/me/threads/?limit=50', function(response){
console.log(response);
});
we are working on a mobile app that accesses facebook user data.
We want to get the users activities, interests and favorite books, music, etc. We are fetching these information via the Graph API but now we are facing the problem, that the returned interests are in english language.
That are the steps we are taking to fetch common interests:
1) Get access token
2) Call https: //graph.facebook.com/me/interests&access_token=XXX0&locale=de_DE
The response is somewhat like:
{"data":[{"name":"Programming","category":"Interesse","id":"101882226520576","created_time":"2011-08-02T08:38:03+0000"}]}
You can see, that the category is tanslated, but we are also looking for the german version of the name field ("Programmierung").
When i try to access the english "Programming"-page on http://www.facebook.com/pages/Programming/101882226520576 i am forwarded to http://www.facebook.com/pages/Programmieren/106375099398136.
Accessing 106375099398136 with Graph API yields the correct response:
{
"id": "106375099398136",
"name": "Programmieren",
"link": "http://www.facebook.com/pages/Programmieren/106375099398136",
"likes": 6983,
...
}
How do i get this locale dependent link between "Programming"-page and "Programmierung"-page via the Graph API?
just want to share a possible workaround for the above problem.
Basically we are emulating what is happening when the user trys to access a facebook page and is redirected to the localized counterpart. So we are sending a HTTP request to "facebook.com/pages/PAGE_ID" with the user locale set in the HTTP header and follow the redirects until the last location. The URL of the last location is somewhat like "http://www.facebook.com/pages/LOCALIZED_PAGE_NAME/PAGE_ID" and we are extracting the page name from this.
This is an effective but far from efficient solution :) Would appreciate a more elegant way to handle this.
Bye,
Tobias