function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Hemant Pareek 8Hemant Pareek 8 

Integrating facebook messanger with salesforce

I want to send message from a rest api hit to facebook messanger. for this I reffered the link : https://developers.facebook.com/docs/messenger-platform/send-messages/?translation#sending_text but on hitting the api am getting error.
Httprequest req = new httpRequest();
req.setEndPoint('https://graph.facebook.com/v5.0/me/messages?access_token=EAAUpiIiiEvMBANfxlHZCNRffZAcBahCcpoJ5AxiGYg6ip9t82uNxIXx6HB91w7KNi48S2BilBJLlyu1n9gurdBKerBfVOcMPQv3flGoBWZBCzKYkoL2ZBYYGMokZCcJF63y2uYhY1ZBQNTZBrc0o7zdEVy12s2PuljnBIef9ZBh6PKJXTQ4PcL71wmy0PiO9GpPr3DLlkoljIDzKrvgO4UOm');
String body = '{'+
                '"recipient": {'+
                '"id": "1229442117258672"'+
                '},'+
                '"message": {'+
                '"text": "hello, world!"' +
                '}' +
                '}';
req.setMethod('POST');
req.setBody(body);
req.setHeader('Content-Type','application/json');
Http h = new Http();
HttpResponse res = h.send(req);
system.debug(res.getBody());

Error: { "error": { "message": "(#100) No matching user found", "type": "OAuthException", "code": 100, "error_subcode": 2018001, "fbtrace_id": "AHlqjvar_5mQ78CT1iMu4Ac" } }

Note: The page access token is alive when I tested it and the id provided is recipient is a valid id retrieved by hitting get request using graph api explorer via recipient's facebook account also the sender have the page_messaging permission.
Henny GoelHenny Goel
Check ford f150forum (https://f150mag.com/)