Skip to content

Simulating Events

After creating one or more webhooks, you can simulate events to see how these will be delivered to your webhooks. This document outlines how to simulate events and test the delivery of these events to your webhooks.

Testing PriceCurveCreated Events

When we create a price curve targeting any of your resources, our system generates a PriceCurveCreated event and sends it to all webhooks that subscribe to that event type.

You can test your webhook by simulating PriceCurveCreated events by making a POST request to the /simulation/events/priceCurve endpoint. Doing so will create the event, send it to your webhook endpoint, and make it available under the /events endpoint.

Request Headers

  • Content-Type: application/json
  • Accept: application/json
  • Authorization: Bearer YOUR_API_TOKEN

Request Body

Depending on your needs, you can specify the resources and locations for which you want to simulate the event or leave them blank, and we will pick them for you.

If you want our API to pick random resources and locations, you can use an empty request body:

{}

This will create a PriceCurveCreated event, send it to your webhook endpoint, and make it available under the /events endpoint.

If you want to specify the resources and locations, you can provide the following details in the JSON body of your request:

{
"targets": [
{
"resourceId": "id of the resource",
"locationId": "id of the location that the resource belongs to"
}
]
}

You can simulate specific values by specifying other parameters, such as priceArea and priceCurveDelta.

Description of the parameters:

  • targets: (Optional) An array of objects containing the resourceId and locationId of the resources and locations for which you want to simulate the event. They will be randomly picked from available resources and locations if not provided.
  • priceCurveDelta: (Optional) The price curve delta value for the event. There will be a randomly generated curve if not provided.
  • priceArea: (Optional) The price area for the event. Will randomly generate values if not provided.

Sample cURL Command

Terminal window
curl -X POST "{{baseUrl}}/simulation/events/priceCurve" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"targets": [{ "resourceId": "6f81de1", "locationId": "9fbb535" } ]
}'

Testing UserEligibilityUpdated Events

When a user’s eligibility changes, our system generates a UserEligibilityUpdated event and sends it to all webhooks that subscribe to that event type.

You can test your webhook by simulating a UserEligibilityUpdated event by making a POST request to the /simulation/events/userEligibility endpoint. This will create the event, send it to your webhook endpoint, and make it available under the /events endpoint. There is no request body for this call.

Request Headers

  • Authorization: Bearer YOUR_API_TOKEN

Sample cURL Command

Terminal window
curl -X POST "{{baseUrl}}/simulation/events/userEligibility" \
-H "Authorization: Bearer YOUR_API_TOKEN"

Testing actual eligibility changes

To have the user eligibility updated, you need to create or move an existing location inside an eligible neighbourhood. You can do this by either:

  • Set a MeterPointId (Mpid) at a location corresponding to a specific Mpid that our analysis has shown exists in an eligible Neighbourhood.
  • Or, has Coordinates set on it that land within that specific neighbourhood polygon/boundary box

The easiest way is to set the following coordinates on a location that lands inside of the test Neighbourhoods:

{
"coordinates": {
"latitude": 60.52485052347296,
"longitude": 5.060012082871939
}
}

This should make the user who owns the location eligible (after some processing time), and you should receive a UserEligibilityUpdate event.