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

webhooks.create vs webhooks.createWebhook #269

Open
kamicut opened this issue Aug 11, 2022 · 1 comment
Open

webhooks.create vs webhooks.createWebhook #269

kamicut opened this issue Aug 11, 2022 · 1 comment

Comments

@kamicut
Copy link

kamicut commented Aug 11, 2022

I was unable to create a webhook using the webhooks.createWebhook(params) call. I was getting an invalid request error, even with the shape of data according to the documentation

const params = { data: { resource: PROJECT_ID , target: TARGET_URL } }

error:

{
    "message": "Invalid Request",
    "stack": "Error: Invalid Request\n    at InvalidRequest.AsanaError (/var/task/index.js:31:15)\n    at new InvalidRequest (/var/task/index.js:62:18)\n    at Request._callback (/var/task/index.js:55389:27)\n    at Request.self2.callback (/var/task/index.js:48561:27)\n    at Request.emit (events.js:400:28)\n    at Request.<anonymous> (/var/task/index.js:49309:15)\n    at Request.emit (events.js:400:28)\n    at IncomingMessage.<anonymous> (/var/task/index.js:49240:17)\n    at Object.onceWrapper (events.js:519:28)\n    at IncomingMessage.emit (events.js:412:35)\n    at endReadableNT (internal/streams/readable.js:1333:12)\n    at processTicksAndRejections (internal/process/task_queues.js:82:21)",
    "status": 400,
    "value": {
        "errors": [
            {
                "message": "You should specify one of resource",
                "help": "For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors"
            }
        ]
    }
}

Looking into the tests and internal code of this library, I found webhooks.create(resource, target) https://github.com/Asana/node-asana/blob/master/lib/resources/webhooks.js#L28. This worked for me. I'm opening this issue in case this is a missing documentation issue.

@terryjiang2020
Copy link

From the latest SDK, it seems webhooks.createWebhook and webhooks.create_webhook are both removed and replaced by webhooks.create. Similar things happen to other related functions like webhooks.getWebHook. I do think the doc needs to be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants