account-activity-dashboard icon indicating copy to clipboard operation
account-activity-dashboard copied to clipboard

Documentation incorrect

Open m-grzybek-first10 opened this issue 7 years ago • 10 comments

Hi, I'm wondering why is documentation totally different than this example? I mean creating webhook in that case - https://developer.twitter.com/en/docs/accounts-and-users/subscribe-account-activity/api-reference/aaa-premium#post-account-activity-all-env-name-webhooks ?

Or am I missing something?

m-grzybek-first10 avatar Nov 29 '18 19:11 m-grzybek-first10

Hey there, what specifically are you referring to that is different? I can happily get the documentation updated as needed. Are you referring to the OAuth mode for webhook registration, or something else?

andypiper avatar Dec 03 '18 11:12 andypiper

Hi @andypiper, yeah sorry for not being specific enough. Exactly, I meant auth for webhook registration and adding subscription. Looks like it's totally different than the examples scripts in that repo (which actually works).

m-grzybek-first10 avatar Dec 05 '18 16:12 m-grzybek-first10

I'll open this internally for our documentation, and I'll leave this issue open for now as a reminder.

andypiper avatar Dec 07 '18 14:12 andypiper

is this still valid? $ curl --request POST --url 'https://api.twitter.com/1.1/account_activity/all/:ENV_NAME/webhooks.json?url=https%3A%2F%2Fyour_domain.com%2Fwebhook%2Ftwitter' --header 'authorization: OAuth oauth_consumer_key="CONSUMER_KEY", oauth_nonce="GENERATED", oauth_signature="GENERATED", oauth_signature_method="HMAC-SHA1", oauth_timestamp="GENERATED", oauth_token="ACCESS_TOKEN", oauth_version="1.0"'

im getting this error {"errors":[{"code":32,"message":"Could not authenticate you."}]}

can't subscribe to account activity api

Mrwh0 avatar Feb 22 '19 09:02 Mrwh0

I have the same error. Do you find a solution ? @Mrwh0

Arkalo2 avatar Feb 27 '20 19:02 Arkalo2

Hi.. I have the same error..

renebizelli avatar Mar 25 '20 17:03 renebizelli

well i set up a flask_rest_enpoint.py

#!/usr/bin/python3.6
#-*- coding: utf-8 -*-
from flask import Flask, request , abort , make_response , jsonify
import base64
import hashlib
import hmac
import json
TWITTER_CONSUMER_SECRET = b'your_API_secret_key_here'
app = Flask(__name__)
@app.route("/webhook/twitter", methods=['GET'])
def webhook_challenge():
    try:
        if request.args.get('crc_token'):
            sha256_hash_digest = hmac.new(TWITTER_CONSUMER_SECRET,bytes(request.args.get('crc_token'),"utf-8"), digestmod=hashlib.sha256).digest()
            response = {
             'response_token': 'sha256=' + (base64.b64encode(sha256_hash_digest)).decode("utf-8")
            }
            return json.dumps(response)
    except:
        abort(make_response(jsonify(message="Internal Server Error"), 500))
if __name__ == "__main__":
   app.run(host='0.0.0.0', port=5060)

run that rest server and use the account-activity-dashboard https://github.com/twitterdev/account-activity-dashboard

  1. create the webhook config node example_scripts/webhook_management/create-webhook-config.js -e your_enviroment_here -u https://yout_domain.com_here/webhook/twitter response : {"id":"webhook_config_id","url":"https://your_domain.com/webhook/twitter","valid":true,"created_timestamp":"a_cool_unix_timestamp"}

  2. if you need re-validate the webhook node example_scripts/webhook_management/validate-webhook-config.js -e your_enviroment_here -i the_webhook_config_id_here

hope it helps..

Mrwh0 avatar Mar 25 '20 18:03 Mrwh0

Having recently integrated. I would ask that this feedback be relayed to the documentation teams in twitter. :pray:

If we wouldn't have discovered this repo we would not have been able to finish an integration. Many of the endpoints mentioned in the documentation around registering a webhook, registering subscriptions etc weren't even the right endpoint in the documentation. We had to locate the correct one from the code here.

geekgonecrazy avatar Mar 15 '21 18:03 geekgonecrazy

Can you be specific so that we can fix the reference documentation?

andypiper avatar Mar 16 '21 07:03 andypiper

Unfortunately we pushed our way through it and managed to find this code base with the correct api's. So with out going through it with out the knowledge again I wouldn't be able to find it.

I think this is an example of one:

https://developer.twitter.com/en/docs/twitter-api/enterprise/account-activity-api/api-reference/aaa-enterprise#get-account-activity-webhooks

https://api.twitter.com/1.1/account_activity/webhooks.json but needs environment like found: https://github.com/twitterdev/account-activity-dashboard/blob/master/example_scripts/webhook_management/delete-webhook-config.js#L8

geekgonecrazy avatar May 02 '21 22:05 geekgonecrazy