https://developer.twitter.com/en/docs/basics/authentication/guides/single-user.html
Python implementation
CONSUMER_KEY = 'YOUR CONSUMER KEY'
CONSUMER_SECRET = 'YOUR CONSUMER SECRET'
ACCESS_TOKEN = 'YOUR ACCESS TOKEN'
ACCESS_TOKEN_SECRET = 'YOUR ACCESS TOKEN SECRET'
CALLBACK_ADDRESS = 'CALLBACK ADDRESS TO REGISTER'
def oauth_req(url, key, secret, http_method='GET', post_body='', http_headers=None):
consumer = oauth2.Consumer(key=CONSUMER_KEY, secret=CONSUMER_SECRET)
token = oauth2.Token(key=key, secret=secret)
client = oauth2.Client(consumer, token)
resp, content = client.request(url, method=http_method, body=post_body, headers=http_headers)
return content
post_body = 'url=' + CALLBACK_ADDRESS
oauth_req('https://api.twitter.com/1.1/account_activity/all/env-beta/webhooks.json', ACCESS_TOKEN, ACCESS_TOKEN_SECRET, 'POST', post_body)