I need to send private message from my page (i am the admin) to user who already contacted my page
My reference on that this link
https://developers.facebook.com/docs/messenger-platform/send-api-reference
I am testing this feature via Facebook Graph Explorer
https://developers.facebook.com/tools/explorer
Using version V2.9
Request:
curl -X POST -H "Content-Type: application/json" -d '{
"recipient": {
"id": "USER_ID"
},
"message": {
"text": "hello, world!"
}
}' "https://graph.facebook.com/v2.6/me/messages?access_token=PAGE_ACCESS_TOKEN"
i replace the USER_ID with my id and access token of page i am admin of
But my response is:
{
"error": {
"message": "(#100) No matching user found",
"type": "OAuthException",
"code": 100,
"error_subcode": 2018001,
"fbtrace_id": "AeMT8VK2SbX"
}
}
I know it is required special permission pages_messaging so i am testing this feature using Facebook application Graph API Explorer not my application because it is not approved yet to use this permission
Any idea why i got this error ?
Related
I'm sending request to appassets edge endpoint, using user access token (I'm the owner ``of the app):
curl -i -X GET \
"https://graph.fb.gg/v15.0/1172368406965046/appassets?access_token=USER_ACCESS_TOKEN"
Instead of a list of assets I'm getting following error:
{
"error": {
"message": "Tried accessing nonexisting field (appassets) on node type (Application)",
"type": "FacebookApiException",
"code": 100,
"fbtrace_id": "AaJwxbXg7TKHb0EE53NLr0K"
}
}
How can I reach my app assets?
Currently, I am developing a messenger bot. For this purpose, I created a facebook app from facebook developer platform.
Now I need to subscribe facebook pages to my app using graph API, so for any message from the page, I can respond from my server.
I find one in Graph API Doc.
When I try it in the graph API explorer, I am encountering an error.
I followed the following steps:
1. Create a new app and page.
2. Get the page access token from my app.
3. In graph api explorer, Select my desired facebook app(newly created) from the drop-down menu.
5. When I was getting the user access token, made sure, I took permission for both 'publish_pages' and 'manage_pages'
6. Replaced the {page-id} with 'page access token'
I am getting this error:
{
"error": {
"message": "(#803) Some of the aliases you requested do not exist: EAAfIhxeHRsYBAD3VNK3BzOqkyhxOL8aZBPnUVZA94olvxYrZA93rNGKwUIJFFhS91ogEbBBlGQJxYGSyJe5I1dNntxsPnqNYFkoI1NcEroa4TunvZCWZAZA06U0UcpvUu5HgBIifGqZCWTDcUH6sCe7BCWdljg5LU7OjwbRgyLe2nCILijnuGqH",
"type": "OAuthException",
"code": 803,
"fbtrace_id": "BUv80nDC3jo"
}
}
I sent this code from graph API Explorer:
curl -i -X GET \
"https://graph.facebook.com/v3.1/EAAfIhxeHRsYBAD3VNK3BzOqkyhxOL8aZBPnUVZA94olvxYrZA93rNGKwUIJFFhS91ogEbBBlGQJxYGSyJe5I1dNntxsPnqNYFkoI1NcEroa4TunvZCWZAZA06U0UcpvUu5HgBIifGqZCWTDcUH6sCe7BCWdljg5LU7OjwbRgyLe2nCILijnuGqH/subscribed_apps?access_token=EAAfIhxeHRsYBAD8dPXQ6jR06FPFhsECXlALtumbecpEV1iZAk1BRFd580J3NEZBrH8mmn7DWZA9NqlefpskmpMjbZA7HrmdmLVhWmOsHOHzVS1nHLNizqX8ODAItZARTiIig34NZCbXnfwOyRqewiKvnh6fMIwEA4sVICGtFTEJXdsVUiTkZAkDrAI9pbZAAu5KQW5f6ZAktXvQZDZD"
FULL DEBUG INFORMATION:
==== Query
curl -i -X GET \
"https://graph.facebook.com/v3.1/EAAfIhxeHRsYBAD3VNK3BzOqkyhxOL8aZBPnUVZA94olvxYrZA93rNGKwUIJFFhS91ogEbBBlGQJxYGSyJe5I1dNntxsPnqNYFkoI1NcEroa4TunvZCWZAZA06U0UcpvUu5HgBIifGqZCWTDcUH6sCe7BCWdljg5LU7OjwbRgyLe2nCILijnuGqH/subscribed_apps?access_token=<access token sanitized>"
==== Access Token Info
{
"perms": [
"manage_pages",
"pages_manage_instant_articles",
"pages_show_list",
"publish_pages",
"read_page_mailboxes",
"pages_messaging",
"pages_messaging_phone_number",
"pages_messaging_subscriptions",
"public_profile"
],
"user_id": 1077587462403179,
"app_id": 2190807377856198
}
==== Parameters
- Query Parameters
{}
- POST Parameters
{}
==== Response
{
"error": {
"message": "(#803) Some of the aliases you requested do not exist: EAAfIhxeHRsYBAD3VNK3BzOqkyhxOL8aZBPnUVZA94olvxYrZA93rNGKwUIJFFhS91ogEbBBlGQJxYGSyJe5I1dNntxsPnqNYFkoI1NcEroa4TunvZCWZAZA06U0UcpvUu5HgBIifGqZCWTDcUH6sCe7BCWdljg5LU7OjwbRgyLe2nCILijnuGqH",
"type": "OAuthException",
"code": 803,
"fbtrace_id": "BUv80nDC3jo"
}
}
==== Debug Information from Graph API Explorer
- https://developers.facebook.com/tools/explorer/2190807377856198?method=GET&path=EAAfIhxeHRsYBAD3VNK3BzOqkyhxOL8aZBPnUVZA94olvxYrZA93rNGKwUIJFFhS91ogEbBBlGQJxYGSyJe5I1dNntxsPnqNYFkoI1NcEroa4TunvZCWZAZA06U0UcpvUu5HgBIifGqZCWTDcUH6sCe7BCWdljg5LU7OjwbRgyLe2nCILijnuGqH%2Fsubscribed_apps&version=v3.1```
[1]: https://developers.facebook.com/tools/explorer/?method=GET&path=%7Bpage-id%7D%2Fsubscribed_apps&version=v3.1
I am new to Google Cloud. I want to upload an image to my Bucket.
I did it successfully from the GCP Console and GCP Shell. However, I am unable to do it using REST Endpoint using API-KEY.
Here is my URL.
https://www.googleapis.com/upload/storage/v1/b/[MY_BUCKET]/o?uploadType=media&name=myhero&key=[MY_API-KEY]
I am getting the following message
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Anonymous caller does not have storage.objects.create access to [MY_BUCKET]/myhero.",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Anonymous caller does not have storage.objects.create access to [MY_BUCKET]/myhero."
}
}
This is because the bucket currently does not allow any way to allow users with the API-KEY even though the API-KEY allows the user of this key to upload an object to the bucket.
What should I do
1) if I want to go with the API-key way.
2) if I want to go with service-account way. What is the best way to generate Authorisation token? I have come till this point
{"alg":"RS256","typ":"JWT"}.
{
"iss":"761326798069-r5mljlln1rd4lrbhg75efgigp36m78j5#developer.gserviceaccount.com",
"scope":"https://www.googleapis.com/auth/prediction",
"aud":"https://www.googleapis.com/oauth2/v4/token",
"exp":1328554385,
"iat":1328550785
}.
But I am unable to generate {Base64url encoded signature} as I am unable to figure out the private and public keys...
You are getting “anonymous caller” because you are not properly authenticated. You can authenticate using a bearer token instead of the API-KEY.
You can run the following script:
BUCKET=<BUCKET_NAME>
OBJECT=<OBJECT>
TOKEN=$(gcloud auth print-access-token)
curl "https://www.googleapis.com/upload/storage/v1/b/$BUCKET/o?uploadType=media&name=$OBJECT" -H"Authorization: Bearer $TOKEN" -H'Content-Type: image/jpg' --data-binary #$OBJECT
I am testing facebook business manager API. https://developers.facebook.com/docs/marketing-api/business-manager-api.
I am testing (creating business manager API)
curl \
-F "name=Pomni Media" \
-F "vertical=ADVERTISING" \
-F "primary_page=<PAGE_ID>" \
-F "timezone_id=1" \
-F "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/<USER_ID>/businesses" with a test user.
I added postman
POST https://graph.facebook.com/v2.7/125157388313921/businesses
name : xxxx xxxx
vertical: ADVERTISING
primary_page: 2076479342635006
timezone_id: 1
access_token: EAAcikSwak2oBAI3...
appsecret_proof: 0db84ee1ded55f9ce0ef4a9d91449940014...
And it's result is
{
"error": {
"message": "(#200) Permissions error",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "FQmaUMdrdV3"
}
}
Permission of above user 125157388313921 is
"user_birthday",
"user_religion_politics",
"user_relationships",
"user_relationship_details",
...
"user_managed_groups",
"manage_pages",
"pages_manage_cta",
"pages_show_list",
"publish_pages",
"read_page_mailboxes",
"ads_management",
"ads_read",
"status": "granted"
"business_management",
"public_profile"
Gave all permissions.
And the the facebook app has business manager available level.
I am working with this issue for 5 days, but not success yet.
Any kind of hint will appreciate!
UPDATE: the test user 125157388313921 was created by this api.
https://graph.facebook.com/APP_ID/accounts/test-users?installed=true&name=XXX+XXX&permissions=public_profile,user_friends,email,...,pages_manage_cta,pages_manage_leads,ads_read,ads_management,business_management&method=post&access_token=XXXX
I tried to login at business.facebook.com as test user.
It said that "You are signed in to Facebook with a test user. Ad Manager is not available with this type of access, To use Business Manager sign in with your personal Facebook account", I tried with real user with permission business_manager and successed.
I'm trying to delete a request via Graph API Explorer. Request is generated by my mobile application. Of course, I use an access token from this application. And I've got the following error:
{
"error": {
"message": "(#2) Failed to delete any app request",
"type": "OAuthException",
"code": 2
}
}
The request exists, I can GET it.
The issue was that I tried to delete a request that didn't belong to me.