# Quick Start

## Sample Repo

<https://github.com/somewear-labs/hello-space-server>

## Configure

{% hint style="danger" %}
You must have a Somewear Organization to create webhooks. If you're interested in setting up a Somewear Organization with our team/enterprise plans, please inquire at <https://somewearlabs.com/> or contact <sales@somewearlabs.com>.
{% endhint %}

1. Sign into the Somewear web app at <https://somewear.app>.
2. Navigate to your **Organization Settings** page by clicking `Account > Settings`.
3. Click `Add Server Connection > Webhook`.
4. Fill out the name & URL for your webhook. Somewear will send a HTTP POST request to this address. You can include basic credentials in the **Authentication Credentials** section or any other required headers like API keys in the **Custom Headers** section.
5. Click submit and the webhook will be tested with a health check request.
6. Upon save, click the settings icon to configure which Workspaces will push data to your webhook.

## JSON

<details>

<summary>Location</summary>

```json
{
  "requestId": "66ef6f9b-8870-4e18-99e1-f14ee7eae91d",
  "payloads": [
    {
      "identity": {
        "id": "0",
        "name": "Example User",
        "type": "User",
        "email": "example@example.com"
      },
      "account": {
        "id": "0",
        "workspaceId": "0",
      },
      "workspace": {
        "id": "0",
        "name": "Example Workspace"
      },
      "device": {
        "id": "0",
        "serial": "SERIAL"
      },
      "events": [
        {
          "type": "Location",
          "latitude": "37.781001",
          "longitude": "-122.393456",
          "altitude": "1000.0",
          "timestamp": "2023-04-12T19:15:14Z"
        }
      ]
    }
  ]
}
```

</details>

<details>

<summary>Data</summary>

```json
{
  "requestId": "fe06b693-af2e-49da-963b-97fddaaa97eb",
  "payloads": [
    {
      "identity": {
        "id": "0",
        "name": "Example User",
        "type": "User",
        "email": "example@example.com"
      },
      "account": {
        "id": "0",
        "workspaceId": "0",
      },
      "workspace": {
        "id": "0",
        "name": "Example Workspace"
      },
      "device": {
        "id": "0",
        "serial": "SERIAL"
      },
      "events": [
        {
          "type": "Data",
          "payload": "VGVzdAo=",
          "timestamp": "2023-04-12T18:56:32Z"
        }
      ]
    }
  ]
}
```

</details>

<details>

<summary>Message</summary>

```json
{
  "requestId": "66ef6f9b-8870-4e18-99e1-f14ee7eae91d",
  "payloads": [
    {
      "identity": {
        "id": "0",
        "name": "Example User",
        "type": "User",
        "email": "example@example.com"
      },
      "account": {
        "id": "0",
        "workspaceId": "0",
      },
      "workspace": {
        "id": "0",
        "name": "Example Workspace"
      },
      "device": {
        "id": "0",
        "serial": "SERIAL"
      },
      "events": [
        {
          "type": "Message",
          "timestamp": "2023-04-12T19:15:14Z"
          "content": "Example content"
        }
      ]
    }
  ]
}
```

</details>

<details>

<summary>Sos Event</summary>

```json
{
  "requestId": "66ef6f9b-8870-4e18-99e1-f14ee7eae91d",
  "payloads": [
    {
      "identity": {
        "id": "0",
        "name": "Example User",
        "type": "User",
        "email": "example@example.com"
      },
      "account": {
        "id": "0",
        "workspaceId": "0",
      },
      "device": {
        "id": "0",
        "serial": "SERIAL"
      },
      "workspace": {
        "id": "0",
        "name": "Example Workspace"
      },
      "events": [
        {
          "type": "SosEvent",
          "eventType": "Alarm",
          "sessionId": "0",
          "latitude": "37.781001",
          "longitude": "-122.393456",
          "timestamp": "2023-04-12T19:15:14Z"
        }
      ]
    }
  ]
}
```

```
eventType:
  Alarm - When the user first triggers the SOS
  AlarmCancel - When the user resolves their SOS
```

</details>


---

# 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.somewear.app/developer-docs/webhooks/quick-start.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.
