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

403 Forbidden when using example #25

Open
DanielBUBU opened this issue Jun 3, 2024 · 4 comments
Open

403 Forbidden when using example #25

DanielBUBU opened this issue Jun 3, 2024 · 4 comments

Comments

@DanielBUBU
Copy link

I want to grab posts, processing, and send it to discord when there's a new post.
Access token has Read, Write, and Direct Messages permissions for sure.
Here's my code

const express = require('express');
const bodyParser = require('body-parser');
const twitterWebhooks = require('twitter-webhooks');

const app = express();
app.use(bodyParser.json());
const userActivityWebhook = twitterWebhooks.userActivity({
    serverUrl: 'https://discord.com/api/webhooks/112885559..../GLecKr.....',
    route: '/', //default : '/'
    consumerKey: ,
    consumerSecret: ,
    accessToken:,
    accessTokenSecret: ,
    environment: '', //default : 'env-beta'
    app
});

//Register your webhook url - just needed once per URL
userActivityWebhook.register();

//Subscribe for a particular user activity
userActivityWebhook.subscribe({
    userId: 'DanielBUBUACG',
    accessToken: ,
    accessTokenSecret: 
}).then(function (userActivity) {
    userActivity
        .on('tweet_create', (data) => {
            console.log(userActivity.id + ' - tweet_create')
            console.log(data);
        })
});

Here is the error

D:\PD_maid\node_modules\twitter-webhooks\lib\helpers.js:34
                        error = new Error(json.errors[0].message);
                                ^

Error: Forbidden.
    at Request._callback (D:\PD_maid\node_modules\twitter-webhooks\lib\helpers.js:34:33)
    at self.callback (D:\PD_maid\node_modules\request\request.js:185:22)
    at Request.emit (node:events:518:28)
    at Request.<anonymous> (D:\PD_maid\node_modules\request\request.js:1154:10)
    at Request.emit (node:events:518:28)
    at IncomingMessage.<anonymous> (D:\PD_maid\node_modules\request\request.js:1076:12)
    at Object.onceWrapper (node:events:632:28)
    at IncomingMessage.emit (node:events:530:35)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 200,
  statusCode: 403,
  body: { errors: [ { code: 200, message: 'Forbidden.' } ] }
}

Node.js v20.12.2
@bircher044
Copy link

Hello! Did you find a solution?

@DanielBUBU
Copy link
Author

Hello! Did you find a solution?

Not yet.
But I think the package might works like a stand alone webhook client instead of a proxy, so the serverUrl: might needs to redirect to the nodejs runtime.

@bircher044
Copy link

Not yet. But I think the package might works like a stand alone webhook client instead of a proxy, so the serverUrl: might needs to redirect to the nodejs runtime.

Thanks for the answer.
So do you think is it possible to get live tweets withouth having a $5k+/mo apikey?

@DanielBUBU
Copy link
Author

Not yet. But I think the package might works like a stand alone webhook client instead of a proxy, so the serverUrl: might needs to redirect to the nodejs runtime.

Thanks for the answer. So do you think is it possible to get live tweets withouth having a $5k+/mo apikey?

you can see that I left blanks, which are the places that enter the keys.
Key shouldn't be post publicly.
It won't pass the code check if you don't fill ur own key.

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

2 participants