What is a webhook?
A webhook is a set of REST endpoints that you, as a Sensedia client, must provide. When a developer requests credentials, the Developer Portal will call this set of REST endpoints. Thus, the developer will be able to access your protected APIs on the Developer Portal.
Below is a summary of the communication flow between Developer Portal and webhook during the credential request:
Developer goes to the Apps menu and creates a new AWS app (Sensedia API Manager apps do not use webhooks).
Developer Portal System makes an HTTP request to the webhook, passing information from the developer's AWS app.
IMPORTANTIt is your responsibility to implement the webhook in your infrastructure, but you can consult an implementation example. The only requirement is to follow the contracts of the REST endpoints to carry out the integration between Developer Portal and webhook.
To create the webhook, implement the contract below.
Also download the Open API Contract and the Python example.
NOTEThe specification was changed. The optional field
customCredentialswas added, and it can be used with API KEY and CLIENT CREDENTIALS.
Below are the endpoints you must implement and the details of request and response for each of them.
Action | Endpoint |
|---|---|
| Create credentials | POST /v1/createCredentials |
| Update credentials | POST /v1/updateCredentials |
| Revoke credentials | POST /v1/revokeCredentials |
| Check availability | GET /v1/health |
All endpoints will use basic authentication. You will receive the header Authorization: Basic <username:password base64> and should validate it as you see fit.
Endpoint responsible for creating and returning the app credentials.
Request
Response
Status code: 200 OK
Body:
The response can return either an API Key or Client Credentials.
For credentialType=API_KEY, the fields apiKeyId and apiKey should be returned.
For credentialType=CLIENT_CREDENTIALS, the fields clientId and clientSecret should be returned.
NOTEThe specification of
CreateCredentialsResponsewas modified. The optional fieldcustomCredentialswas added to return additional information, such as API KEY and CLIENT CREDENTIALS.
Request
Response
HTTP status: 204 No Content
Body: empty
NOTEThe specification of
UpdateCredentialsRequestwas modified. The optional fieldcustomCredentialswas added to return additional information, such as API KEY and CLIENT CREDENTIALS.
Endpoint responsible for revoking (effectively disabling or deleting) app credentials.
Request
Response
Status code: 204 No Content
Body: empty
NOTEThe specification of
RevokeCredentialsRequestwas modified. The optional fieldcustomCredentialswas added to return additional information, such as API KEY and CLIENT CREDENTIALS.
Application management endpoint. It must return 204 No Content if the request is successful. It may return other status codes like 401, 500 etc.
Request
Response
Status code: 204 No Content
Body: empty
If the webhook returns any error (status code 4xx or 5xx), the expected message format is:
AWS Lambda
Below is an example of an AWS Lambda, in python, implementing all the endpoints.
IMPORTANTThe code below is just a reference. You should modify it according to your security needs or business rules. The only requirement is to follow the contract defined in the Open API specification.
To download the example, click here.
There are two methods for creating credentials:
API Keys are generated with the name of the app from the Developer Portal and the email of the developer who created the app.
See the example below:
This method should generate a new key in the AWS console:

And associate it with the Usage Plans:

Client Credentials are configured by the App Clients of a Cognito User Pool.
See the example below:
This method should create a new App Client:

This app client will have the necessary configurations to generate Client Credentials:

To authenticate APIs using JWT tokens, you must have the authorizer set up in the AWS Gateway and linked to the Cognito user pool.

IMPORTANTTo enable developers to generate tokens, you will need to provide an endpoint giving the client ID and client secret generated during the app creation.
In the example below, a Cognito endpoint is used to generate the token according to the grant-type:
Request
Response
See the example below:
This method will delete the API Key from the AWS console.
See the example below:
This method will delete the app client from the AWS console.
We use cookies to enhance your experience on our site. By continuing to browse, you agree to our use of cookies.Learn more