Hello, do I need to apply for Enterprise access to use stream feature so that I can detect when someone mentions me even if I need only 1 webhook?

Also I can’t register the webhook bcz there is no proper explanation about how to regester.
I tried to make post request to https://api.twitter.com/1.1/account_activity/webhooks.json?url=https://tweetdesigner.vercel.app/webhook/twitter with my Access token and API key, but it keeps saying “Invalid or expired token.” althugh I had regenerated the credentials freshly.

No, the free Premium Account Activity API is enough: Overview | Docs | Twitter Developer Platform but you need v1.1 API access, for which you need an Elevated Access project.

Try GitHub - twitterdev/account-activity-dashboard: Sample web app and helper scripts to get started with the premium Account Activity API or GitHub - twitterdev/autohook: Automatically setup and serve webhooks for the Twitter Account Activity API

Thanks for replying.
I have made a webhook which takes a post req and also takes a get req and returns the hmac as in helpers/security.js.

I am making a post req like

const fetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args));
require('dotenv').config();


fetch('https://api.twitter.com/1.1/account_activity/webhooks.json?url=https://tw.up.railway.app/webhook/twitter', {
  method: 'POST',
  headers: {
    'Authorization': `OAuth oauth_consumer_key=${process.env.API_KEY}, oauth_nonce="GENERATED", oauth_signature="GENERATED", oauth_signature_method="HMAC-SHA1", oauth_timestamp="GENERATED", oauth_token=${process.env.ACCESS_TOKEN}, oauth_version="1.0"`
  }
})
  .then(res => {
    try {
      return res.json();
    } catch (e) {
      return res.text();
    }
  })
  .then(json => console.log(json))

What should I put in oauth_nonce, oauth_signature, and oauth_timestamp ?

When I make the req, I get error like

{ errors: [ { code: 215, message: 'Bad Authentication data.' } ] }

So this didn’t work…

Then tried Autohook

const { Autohook } = require('twitter-autohook');
require('dotenv').config();

(async ƛ => {
  const webhook = new Autohook({
    token: process.env.ACCESS_TOKEN,
    token_secret: process.env.ACCESS_TOKEN_SECRET,
    consumer_key: process.env.API_KEY,
    consumer_secret: process.env.API_KEY_SECRET,
    // ngrok_secret: 'value', // optional
    env: 'env',
    port: 1337
  });
  
  // Removes existing webhooks
  await webhook.removeWebhooks();
  
  // Listens to incoming activity
  webhook.on('event', event => console.log('Something happened:', event));
  
  // Starts a server and adds a new webhook
  await webhook.start();
  
  // Subscribes to a user's activity
  await webhook.subscribe({oauth_token: process.env.ACCESS_TOKEN, oauth_token_secret: process.env.ACCESS_TOKEN_SECRET });
})();

This throws error

     throw new AuthenticationError(response);
           ^

AuthenticationError: Forbidden. (HTTP status: 403, Twitter code: 200)
    at tryError (d:\new-stuff\Tweet designer\node_modules\twitter-autohook\errors\index.js:53:12)
    at Autohook.getWebhooks (d:\new-stuff\Tweet designer\node_modules\twitter-autohook\index.js:242:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Autohook.removeWebhooks (d:\new-stuff\Tweet designer\node_modules\twitter-autohook\index.js:261:22)    at async d:\new-stuff\Tweet designer\autohookt.js:16:3 {
  code: 200
}

Am I doing anything wrong in both cases ?

My project has Elevated access

Oh, account activity API environments are configured on https://developer.twitter.com/en/account/subscriptions

What should I put in oauth_nonce , oauth_signature , and oauth_timestamp ?

And for authentication, i recommend having an oauth library https://developer.twitter.com/en/docs/twitter-api/tools-and-libraries/v1 handle things - implementing this yourself is error prone: OAuth 1.0a | Docs | Twitter Developer Platform

I found this tutorial Let's explore how to build an autoresponder using the Autohook command line tool and less than 100 lines of code. | Docs | Twitter Developer Platform

Did everything it said App was already created, Set up Dev enviroment, installed autohook and ran the given code in index.js
Even I regenerated the API key and secret & Access token and secret an updated in .env.twitter and .env, but when I ran the index.js, it threw error:

TypeError: 'token' is empty or not set. Check your configuration and try again.
    at Array.map (<anonymous>)
    at new Autohook (d:\new-stuff\Tweet designer\node_modules\twitter-autohook\index.js:128:85)
    at d:\new-stuff\Tweet designer\autohookt.js:5:21
    at Object.<anonymous> (d:\new-stuff\Tweet designer\autohookt.js:20:3)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)

My access token is correct though

Sometimes this means that the .env file wasn’t read - but i don’t know enough javascript to guess what could be wrong unfortunately.