# PagerDuty

### Setting up the integration

{% stepper %}
{% step %}
**Create a Custom Event Transformer in PagerDuty**

To set up your PagerDuty integration, create a Custom Event Transformer in PagerDuty, which will allow you to map Luciq events to a PagerDuty Incident.

Link: <https://developer.pagerduty.com/docs/ZG9jOjExMDI5NTc5-custom-event-transformer>
{% endstep %}

{% step %}
**Edit the transformer code**

Once the Custom Event Transformer is created, edit the code portion to look something like this (feel free to change this to customize it for your needs):

{% code title="transformer.js" %}

```javascript
var body = PD.inputRequest.body

var normalized_event = {
  event_type: PD.Trigger,
  description: `Luciq | ${body.application} | ${body.trace} ${body.trigger_operator}`,
  details: PD.inputRequest,
  client: "Luciq",
  client_url: body.url
};

PD.emitGenericEvents([normalized_event]);
```

{% endcode %}
{% endstep %}

{% step %}
**Add the PagerDuty webhook URL**

Simply add the PagerDuty webhook URL to which Luciq should forward your alerts.

![](/files/8e1f2c0f1c49f597a53a07768269fd52f7c7cfc5)
{% endstep %}

{% step %}
**Test the integration**

At this point, test your integration so that you're sure everything is working smoothly.

![](/files/5047a67b490c5e83609380612f051da631efd3a7)
{% endstep %}

{% step %}
**Finish and name your integration**

All done! Your integration is now set up — give your integration a name and you're ready to go.

![](/files/3c81f35980733e5ed8ac25c6547e2f5cacf768fa)
{% endstep %}
{% endstepper %}

### JSON model

{% code title="JSON" %}

```json
{
  "application": "String", // Luciq App Name, 
  "platform": "String", // the App Platform (IOS, ...)
  "title": "String", // Rule title
  "app_version": "String", // The App Version, Example: 1.0.1,...
  "metric": "String", //the Metric that the incident is related to, Example: Screen Loading, App Launches, ..
  "trace": "String", //Crash Cause: exception name, Filename, and line, or Group name example Hot/cold App Launch
  "trigger": "String", // The Alert Trigger, Example: Crash-free sessions in the last 24 hours
  "trigger_operator": "String", // [Tigger] + [Tigger operator] + [Trigger value] + [Time frame]
  "conditions": [ //[Alert conditions] 
    {
      "key": "String",
      "operator": "String",
      "value": "String"
    }
  ],
  "conditions_operation": "String", // the conditions are ANDed or ORed
  "current_value": "String",// the Actual value of the metric at the time of the incident
  "url": "String" // in case the rule is a crashes rule, URL will be the Crash URL, other wise it will be the incident url
}
```

{% endcode %}


---

# 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.luciq.ai/product-guides-and-integrations/integrations/pagerduty.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.
