Note, all requests must be authenticated with Bearer Authentication. Make sure your request has a header containing your Nextmv Cloud API key, as such:
- Key:
Authorization
- Value:
Bearer <YOUR-API-KEY>
Export your API key as an environment variable:
Create a webhook
The following snipped uses curl to create a webhook. Please change the id
, endpoint_url
, and description
to your desired values. Also note that at the time of writing, only the run.status
event type is supported.
Getting the webhook secret
After creating a webhook, you can retrieve the secret for the webhook. Note that we are using a placeholder for the id
in the URL. The secret is used to recompute the HMAC signature of the request to verify its authenticity.
Writing a webhook handler
We will send POST requests to the endpoint_url
with a JSON payload. In the header of the request, we will include the Nextmv-Signature
that you can use to check the authenticity of the request. It has the following format:
In order to check the authenticity of the request, you need to recompute the HMAC signature using the secret, the payload (the request body), and the timestamp t
from the header.
See the following example in Python:
The following code snippet shows a basic self-contained FastAPI web server that listens for POST requests on the /webhookhandler
endpoint. It checks the signature and returns a 200 status code if the signature is valid. Simply place the code in a file named main.py
and run it with uvicorn
(see below).
The required dependencies can be installed with:
You can run the server with:
Once you have a webhook set up and the handler is ready, you can use the trigger function to send a request to the webhook:
Currently there is only one event type supported: run.status
. The request body of a triggered event of this type will look like this:
For further endpoints to interact with webhooks, see the OpenAPI specification.
OpenAPI specification
Get a list of webhooks.
Get a list of webhooks.
Get a single webhook.
Get a single webhook.
Update all fields of a webhook.
Update all fields of a webhook.
Delete a webhook.
Delete a webhook.
Get a list of all webhook conversations.
Get a list of all webhook conversations. A conversation is the request to and the response of the endpoint.
Get a single conversation.
Get a single conversation.
Get the signing secret of the webhook.
Get the signing secret of the webhook.