Aha! Develop | Endpoint extension contributions
Endpoint extension contributions run on the Aha! Develop servers using the permissions of the user who installed the extension.
Click any of the following links to skip ahead:
Definition
An endpoint represents a web server URL that accepts requests either from within Aha! Develop or from a third party (often called a webhook).
An endpoint that can be used without authenticating to Aha! Develop first is marked as "public": true
in package.json
. Public endpoints have URLs that contain system-generated random tokens so they cannot be guessed. You should treat a public endpoint URL with the same care that you would treat a password. Public endpoints only respond to POST requests.
Schema
An extension that provides a public endpoint to handle GitHub webhooks would specify it in the extension package.json
file:
{
"ahaExtension": {
"contributes": {
"endpoints": {
"webhook": {
"title": "Webhook from GitHub",
"entryPoint": "src/webhooks/webhook.js",
"public": true,
}
}
}
}
}
title
The title of the endpoint that is visible when viewing the endpoint logs.
entryPoint
Points to the JavaScript file implementing this contribution.
public
Specifies whether the endpoint can be used without authenticating to Aha! Develop first. Public endpoints have URLs that contain system-generated random tokens so they cannot be guessed. You should treat a public endpoint URL with the same care that you would treat a password.
API
aha.on("endpointName", ({ headers, payload }, { identifier, settings }) => {
// code goes here.
})
headers
— object containing the HTTP headers used for the request.payload
— object containing the query parameters for a GET request or the combined query parameters and body of a POST request.identifier
— set to the string identifier of the extension.settings
— the settings for the extension as a JSON object.