Hi,
Im trying to send direct message but im getting this bellow error
403 Forbidden response: {“errors”:[{“code”:220,“message”:“Your credentials do not allow access to this resource.”}]}
My code
$oauthParams = [
'consumer_key' => $request->input('consumer_key'),
'consumer_secret' => $request->input('consumer_secret'),
'oauth_token' => $request->input('oauth_token'),
'token_secret' => ''
];
$profileOauth = new Oauth1($oauthParams);
$stack = GuzzleHttp\HandlerStack::create();
$stack->push($profileOauth);
$client = new GuzzleHttp\Client([
'handler' => $stack
]);
$friendsList = $client->request('POST', 'https://api.twitter.com/1.1/direct_messages/new.json?text=hello%2C%20tworld.%20welcome%20to%201.1.&screen_name=carol_med654', [
'auth' => 'oauth'
]);
$friends = json_decode($friendsList->getBody(), true);
return response()->json($friends);