R
Railway•5mo ago
Akhil

Webhook's using Public API

Can we create webhook on a particular project using the Public API key? I tried re-creating my api key but no use, I also create API token for individual project and also no use. Error Message:
{
"errors": [
{
"message": "Not Authorized",
"locations": [
{
"line": 8,
"column": 3
}
],
"path": [
"webhookCreate"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
}
],
"data": null
}
{
"errors": [
{
"message": "Not Authorized",
"locations": [
{
"line": 8,
"column": 3
}
],
"path": [
"webhookCreate"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
}
],
"data": null
}
Solution:
i was able to replicate this issue using a team token, if i use a "no team" token i am able to add webhooks to pro projects that im a part of
Jump to solution
29 Replies
Percy
Percy•5mo ago
Project ID: N/A
Akhil
Akhil•5mo ago
N/A
Duchess
Duchess•5mo ago
New reply sent from Help Station thread:
Any update? We really need this to provide our application as SAAS to our end users. Vercel is providing this feature though.
You're seeing this because this thread has been automatically linked to the Help Station thread.
Brody
Brody•5mo ago
adding webhooks works just fine, you might be trying to use the wrong api key
No description
Akhil
Akhil•5mo ago
hey @Brody , I'm created a team and created another project within it and would like to add webhook to it. All other queries like create project, redploy or template deploy are working with my api but not the webhook, any idea what's getting wrong? Also, I need to create the API token in my personal account right? I was not able to create any api token in my team workspace It is working in personal projects but not in team
Brody
Brody•5mo ago
you need to create the API token for the team account
Akhil
Akhil•5mo ago
can I know, the URL for it I can't find it
Akhil
Akhil•5mo ago
No description
Brody
Brody•5mo ago
select your hobby account and then select the team when creating a token
Akhil
Akhil•5mo ago
when, doing it, I'm getting auth errors
Brody
Brody•5mo ago
what is your status on the team you may have to ask the owner to create the API token for you
Akhil
Akhil•5mo ago
I'm the admin
Brody
Brody•5mo ago
please show me the errors
Akhil
Akhil•5mo ago
sure This is the request:
mutation createWebhook {
railway {
webhookCreate(input: {projectId: "19f097bd-c834-48f1-b55e-50123c01f982", url: "https://webhook.site/ba79d712-b3b4-4221-a5d5-3acf9ff296f7"}) {
id
lastStatus
projectId
url
}
}
}
mutation createWebhook {
railway {
webhookCreate(input: {projectId: "19f097bd-c834-48f1-b55e-50123c01f982", url: "https://webhook.site/ba79d712-b3b4-4221-a5d5-3acf9ff296f7"}) {
id
lastStatus
projectId
url
}
}
}
This is the response
{
"data": null,
"errors": [
{
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
},
"locations": [
{
"column": 26,
"line": 1
}
],
"message": "Not Authorized",
"path": [
"webhookCreate"
]
}
]
}
{
"data": null,
"errors": [
{
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
},
"locations": [
{
"column": 26,
"line": 1
}
],
"message": "Not Authorized",
"path": [
"webhookCreate"
]
}
]
}
Just created a new empty project, and new API token and tested it out Even tried creating a project token and used it for creating webhook, but facing the same issue
Brody
Brody•5mo ago
try using a "No Team" token
Akhil
Akhil•5mo ago
Same, error
Solution
Brody
Brody•5mo ago
i was able to replicate this issue using a team token, if i use a "no team" token i am able to add webhooks to pro projects that im a part of
Akhil
Akhil•5mo ago
Let me create a new token and project and then check with it. Nice, I was able to replicate it and create webhook. But don't you think it is not the desired way?
Brody
Brody•5mo ago
if it works it works 🙂
Akhil
Akhil•4mo ago
Seems like the personal tokens are throwing errors now, but a new error message:
{
"errors": [
{
"message": "Nice try. Psst, we have a bug bounty! See the Discord",
"locations": [
{
"line": 2,
"column": 5
}
],
"path": [
"webhookCreate"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
}
],
"data": null
}
{
"errors": [
{
"message": "Nice try. Psst, we have a bug bounty! See the Discord",
"locations": [
{
"line": 2,
"column": 5
}
],
"path": [
"webhookCreate"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
}
],
"data": null
}
Brody
Brody•4mo ago
have you tried using the team token?
Akhil
Akhil•4mo ago
yes, no use
Brody
Brody•4mo ago
can you add a webhook via the dashboard?
Akhil
Akhil•4mo ago
yes
Brody
Brody•4mo ago
if you can add a webhook via the dashboard you can do so via the API as well
Akhil
Akhil•4mo ago
But, using the public API, I was not able to create webhook using both the teams API token or the Personal Token. Am I missing something here, based on our previous conversation, I was able to create webhooks using personal token, but now I was not able to create using them. Error with team token:
{
"data": null,
"errors": [
{
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
},
"locations": [
{
"column": 26,
"line": 1
}
],
"message": "Not Authorized",
"path": [
"webhookCreate"
]
}
]
}
{
"data": null,
"errors": [
{
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
},
"locations": [
{
"column": 26,
"line": 1
}
],
"message": "Not Authorized",
"path": [
"webhookCreate"
]
}
]
}
The error with personal token.
{
"errors": [
{
"message": "Nice try. Psst, we have a bug bounty! See the Discord",
"locations": [
{
"line": 2,
"column": 5
}
],
"path": [
"webhookCreate"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
}
],
"data": null
}
{
"errors": [
{
"message": "Nice try. Psst, we have a bug bounty! See the Discord",
"locations": [
{
"line": 2,
"column": 5
}
],
"path": [
"webhookCreate"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
}
],
"data": null
}
no issues, I guess using url to be localhost is getting me the error. In order to create webhook with Public API. 1. use personal token (even though the project is in a team) 2. the URL, cannot he http://localhost:3000
Brody
Brody•4mo ago
may I ask why you thought localhost would work?
Akhil
Akhil•4mo ago
No our developers used it, for testing purpose via a env variable.
Brody
Brody•4mo ago
okay
Want results from more Discord servers?
Add your server