Skip to content

Commit 41ea0ec

Browse files
committed
testing features and making tweaks
1 parent 28c3abe commit 41ea0ec

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/Exceptions/CouldNotSendNotification.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public static function serviceRespondsNotSuccessful(mixed $response): CouldNotSe
1111
if (isset($response->error)) {
1212
return new static("Couldn't post notification. Response: ".$response->error);
1313
}
14-
15-
$responseBody = print_r($response->errors[0]->message, true);
14+
15+
$responseBody = print_r($response->detail, true);
1616

1717
return new static("Couldn't post notification. Response: ".$responseBody);
1818
}

src/TwitterChannel.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public function send($notifiable, Notification $notification): array|object
3232
} else {
3333
$requestBody = $twitterMessage->getRequestBody();
3434
}
35+
36+
// api V2 does not support sending media yet, so I wait till after sending media to switch api version
37+
$this->twitter->setApiVersion('2');
3538
$twitterApiResponse = $this->twitter->post(
3639
$twitterMessage->getApiEndpoint(),
3740
$requestBody,
@@ -42,7 +45,6 @@ public function send($notifiable, Notification $notification): array|object
4245
throw CouldNotSendNotification::serviceRespondsNotSuccessful($this->twitter->getLastBody());
4346
}
4447

45-
dd($twitterApiResponse);
4648
return $twitterApiResponse;
4749
}
4850

src/TwitterServiceProvider.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ public function boot()
2121
config('services.twitter.access_token'),
2222
config('services.twitter.access_secret')
2323
);
24-
$connection->setApiVersion('2');
25-
24+
2625
return $connection;
2726
});
2827
}

src/TwitterStatusUpdate.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ public function getRequestBody(): array
111111
->values();
112112

113113
if ($mediaIds->count() > 0) {
114-
$body['media_ids'] = $mediaIds->implode(',');
114+
$body['media'] = [
115+
'media_ids' => $mediaIds->toArray()
116+
];
115117
}
116118

117119
if ($this->inReplyToTweetId) {

0 commit comments

Comments
 (0)