# Event

This task is triggered anytime an event in Shopify happens. When task is created, Shopify webhook is created as well. The payload of the webhook will be available for your use inside task's code.

Here is an example of how you can add a tag to order anytime new order is created.

{% code lineNumbers="true" %}

```javascript
{% assign order = payload %}

{% capture mutation %}
  mutation tagsAdd($id: ID!, $tags: [String!]!) {
    tagsAdd(id: $id, tags: $tags) {
      node {
        id
      }
      userErrors {
        field
        message
      }
    }
  }
{% endcapture %}

{% json variables %}
  {
    "id": "{{ order.admin_graphql_api_id }}",
    "tags": "datajet-tag"
  }
{% endjson %}

{% assign result = mutation | graphql: variables %}
```

{% endcode %}

Object payload is preloaded anytime task is triggered that is why it is available for us at very first line of the code. For readability we assign payload to `order` variable.

If you are not sure what is inside webhook payload you can reference this site provided by Shopify:

{% embed url="<https://shopify.dev/docs/admin-api/rest/reference/events/webhook>" %}

Complete list of events available in the app:

`checkouts/delete`\
`checkouts/create`\
`checkouts/update`\
`collections/delete`\
`collections/create`\
`collections/update`\
`customers/create`\
`customers/delete`\
`customers/disable`\
`customers/enable`\
`customers/update`\
`customer_groups/create`\
`customer_groups/delete`\
`customer_groups/update`\
`draft_orders/create`\
`draft_orders/delete`\
`draft_orders/update`\
`fulfillments/create`\
`fulfillments/update`\
`inventory_items/create`\
`inventory_items/delete`\
`inventory_items/update`\
`inventory_levels/connect`\
`inventory_levels/disconnect`\
`inventory_levels/update`\
`locations/create`\
`locations/delete`\
`locations/update`\
`orders/cancelled`\
`orders/create`\
`orders/delete`\
`orders/edited`\
`orders/fulfilled`\
`orders/paid`\
`orders/partially_fulfilled`\
`orders/updated`\
`order_transactions/create`\
`products/create`\
`products/delete`\
`products/update`\
`refunds/create`\
`shop/update`\
`tender_transactions/create`\
`themes/create`\
`themes/delete`\
`themes/publish`\
`themes/update`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.datajet-app.com/scripts/blank/event.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
