# Integrations

**Integrations** is a feature to allow Ontime to share its data with other parts of your workflow. Meant for generic software and hardware integrations. This can be set up in the [Integration Settings modal](https://ontime.gitbook.io/v2/main-concepts/interface-1/integration-settings)

<div data-full-width="false"><figure><img src="https://2100860514-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5xSBdLnIwNcJR5fryFDs%2Fuploads%2FGAb9CHTnIJjI9CApteyy%2F212%20editor%20%2B%20integrations%20%2B%20osc%20sett.png?alt=media&#x26;token=cfce89a1-3bb6-4de0-9a71-c91b926d2d8e" alt=""><figcaption><p>OSC Settings</p></figcaption></figure> <figure><img src="https://2100860514-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5xSBdLnIwNcJR5fryFDs%2Fuploads%2F3mvZoY4I5ktraVPEeDgR%2F211%20editor%20%2B%20integrations%20%2B%20osc%20int.png?alt=media&#x26;token=70099ad3-cfbf-4eed-b00e-1bd6118957f8" alt=""><figcaption><p>OSC Integration Settings</p></figcaption></figure></div>

### The ontime lifecycle

During the running of your event, Ontime server will go through a few lifecycle events.&#x20;

The integration feature allows you to leverage these events to send data&#x20;

* On Load - Triggered when an event is loaded
* On Start - Triggered when an event starts
* On Pause - Triggered when an event is paused
* On Stop - Triggered when playback is stopped
* On Every Second - Triggered once a second (great for sending your timer data out)
* On Finish - Triggered when a timer passes the 0 mark and becomes in overtime

{% hint style="info" %}
Example:

If you add a message to the On Load lifecycle: eg: `/ontime/loaded-event` , you would see this message in the OSC Port you have configured in OSC Settings every time an event is loaded
{% endhint %}

### Using variables in integrations

You can embed data from the application runtime in the message using templates `/your-message/{{ontime-data}} {{ontime-more-data}}`

This means that any of the data described in the [runtime data ](https://ontime.gitbook.io/v2/control-and-feedback/runtime-data)is available to be sent as part of the message payload

When the lifecycle event is triggered, your message is parsed, and Ontime places the updated piece of data in place of the template

Extending the example above, you could compose a message that sends the id of the loaded event with

```
/send-this/load-{{loaded.selectedEventIndex}}
```

Inside the template (double brackets), you can add any of the keys described in [runtime data](https://ontime.gitbook.io/v2/control-and-feedback/runtime-data). Use the  `.` when referencing a subkey

`{{titlesPublic.noteNext}}`

`{{playback}}`

`{{timer.current}}`

### Human readable data

The above data defined in runtime data will give you the data from Ontime as it is consumed in-app. For example, all times are in milliseconds.

This is great for software - to - software communications, but it might not be ideal if you want to consume the data yourself.

For this use cases, we have defined a small list of human-readable timer values that you can use in your integration messages. The usage would look like

{% hint style="info" %}
\*Timer values will return "null" if no event is loaded
{% endhint %}

| Variable           | Usage                  | Result                                                                |
| ------------------ | ---------------------- | --------------------------------------------------------------------- |
| human.clock        | {{human.clock}}        | Current clock in (hh:mm:ss)                                           |
| human.duration     | {{human.duration}}     | Duration of current timer in  (hh:mm:ss)\*                            |
| human.expectedEnd  | {{human.expectedEnd}}  | Time at which the current event is expected to finish in (hh:mm:ss)\* |
| human.runningTimer | {{human.runningTimer}} | Current running timer in (hh:mm:ss)\*                                 |
| human.elapsedTime  | {{human.elapsedTime}}  | Elapsed time of current timer in (hh:mm:ss)\*                         |
| human.startedAt    | {{human.startedAt}}    | Time when the current time started (hh:mm:ss)\*                       |


---

# 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://ontime.gitbook.io/v2/control-and-feedback/integrations.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.
