Skip to content

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

@sts-ryan-holton

Description

@sts-ryan-holton

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions