Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitter free plan no longer supports direct messaging, logic change required #102

Open
sts-ryan-holton opened this issue Dec 6, 2023 · 0 comments

Comments

@sts-ryan-holton
Copy link

Hi, I recently posted this, but I think it won't initially be possible resolve as the free plan only supports posting tweets, and not running queries.

I wonder whether the logic can be changed to post a tweet via a username, or some workaround implemented for

/**
     * Get Twitter direct message receiver.
     *
     * @return string|mixed
     *
     * @throws CouldNotSendNotification
     */
    public function getReceiver(TwitterOAuth $twitter): mixed
    {
        if (is_int($this->to)) {
            return $this->to;
        }

        $user = $twitter->get('users/show', [
            'screen_name' => $this->to,
            'include_user_entities' => false,
            'skip_status' => true,
        ]);

        if ($twitter->getLastHttpCode() === 404) {
            throw CouldNotSendNotification::userWasNotFound($twitter->getLastBody());
        }

        return $user->id;
    }

As I need to utilise the approach of sending a message to someone's account via their twitter handle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant