Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Documentation incorrect #8

Open
m-grzybek-first10 opened this issue Nov 29, 2018 · 10 comments
Open

Documentation incorrect #8

m-grzybek-first10 opened this issue Nov 29, 2018 · 10 comments
Labels
bug Something isn't working documentation

Comments

@m-grzybek-first10
Copy link

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?

@andypiper
Copy link
Collaborator

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 andypiper self-assigned this Dec 3, 2018
@m-grzybek-first10
Copy link
Author

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).

@andypiper andypiper added bug Something isn't working documentation labels Dec 7, 2018
@andypiper
Copy link
Collaborator

andypiper commented Dec 7, 2018

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

@Mrwh0
Copy link

Mrwh0 commented Feb 22, 2019

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

@Arkalo2
Copy link

Arkalo2 commented Feb 27, 2020

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

@renebizelli
Copy link

Hi.. I have the same error..

@Mrwh0
Copy link

Mrwh0 commented Mar 25, 2020

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..

@geekgonecrazy
Copy link

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

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.

@andypiper
Copy link
Collaborator

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

@geekgonecrazy
Copy link

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

@andypiper andypiper removed their assignment Feb 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working documentation
Projects
None yet
Development

No branches or pull requests

6 participants