Webhooks
Testing
In order for partners to test their implementation of the webhook processing, we offer an HTTP endpoint to trigger a sample webhook delivery.
| HTTP Method | POST |
| URL | https://www.selfmade-energy.com/api/v2/webhooks/trigger/ |
| Headers | Authorization: Token <partner secret> |
Example using cURL
$ curl \
-X POST \
-H 'Authorization: Token 123abc456def789ghi' \
https://www.selfmade-energy.com/api/v2/webhooks/trigger/
The necessary secret is identical to the one you received from Selfmade Energy when the webhook was initially configured and that is used for signing the webhook requests.
Example Response
{
"delivery": {
"id": "a7f9606e-5d0c-4dc1-b4d0-a019c18d156a",
"event": "lead.created",
"status": "success",
"reason": null
}
}
In case of a delivery error, the status is set to failed and a description of the error is provided using the reason key.
Webhook payload data
The webhook will be sent with a completely random and fake payload but the data will adhere to the partner's lead requirements with the exception of the zip code and geoposition which might be in an area that is not actually covered by the partner.
You can override the ZIP code in the customer payload using the zipcode POST parameter.
Example
$ curl \
-X POST \
-H 'Authorization: Token 123abc456def789ghi' \
-d zipcode=999999 \
https://www.selfmade-energy.com/api/v2/webhooks/trigger/
Specifying the event
You can specify the event type for which a test webhook should be send by using the event POST parameter.
If you do not specify an event, one of the events for which your subscription is registered is selected randomly.
Example
$ curl \
-X POST \
-H 'Authorization: Token 123abc456def789ghi' \
-d event=heatpump-lead.created \
https://www.selfmade-energy.com/api/v2/webhooks/trigger/
Custom URL
In case you want the test webhook to be delivered to a URL that is not the regular URL for your webhook subscription, you can override it with a url POST parameter.
Example
$ curl \
-X POST \
-H 'Authorization: Token 123abc456def789ghi' \
-d url=https://www.example.com \
https://www.selfmade-energy.com/api/v2/webhooks/trigger/