# Add Custom Event

## How this example works

In this example, we will create a sample custom event to trigger the previously created achievement.

***

## Try yourself <a href="#to-try-it-yourself" id="to-try-it-yourself"></a>

* Input the previous saved [token](https://help.openloyalty.io/technical-guide/getting-started-guide/authentication) and [storeCode](https://help.openloyalty.io/technical-guide/member-registartion-configuration#to-try-it-yourself) in the request header
* Add  a transaction\
  Endpoint: `POST /api/{storeCode}/customEvent`

  ```postman_json
  {
    "event": {
      "type": "app_login",
      "eventDate": "2024-05-01T00:00:00", // add current time
      "customerData": {
        "email": "john.smith@example.com"
      }
    }
  }
  ```
* This action should trigger `MemberAchievementProgressWasChanged` [webhook](https://help.openloyalty.io/technical-guide/add-webhook#to-try-it-yourself)

{% hint style="warning" %}
The webhook will be triggered each time there is progress made towards the achievement's goal, not only when the achievement is completed.

In this example, the custom event would have to be sent each day over the span of 7 days for the member to complete the previously set up achievement.
{% endhint %}

***

## Endpoints used

{% openapi src="<https://content.gitbook.com/content/gIv2CyIIYf7vRfuhMKQ6/blobs/2xnMWXnOETp8Vxl2YZoi/openapi-5.61.0%20(1).json>" path="/api/{storeCode}/customEvent" method="post" %}
[openapi-5.61.0 (1).json](https://content.gitbook.com/content/gIv2CyIIYf7vRfuhMKQ6/blobs/2xnMWXnOETp8Vxl2YZoi/openapi-5.61.0%20\(1\).json)
{% endopenapi %}

***

## More resources

For a detailed overview and description of the transactions creation and management, please refer to these series of articles:

{% content-ref url="<https://app.gitbook.com/s/cNVX03KZzmrGwJihLiEx/main-features/custom-events>" %}
[Custom Events](https://app.gitbook.com/s/cNVX03KZzmrGwJihLiEx/main-features/custom-events)
{% endcontent-ref %}
