Loop API

Loop is a tool that allows customers to submit missing events for review as well as provide feedback on existing events.

There are 2 main entry-points to the Loop system:

  • Loop UI - available at https://loop.predicthq.com and requires a PredictHQ user account.

  • Loop Links - low-code option to make the Loop functionality available to your end customers.

At this time the Loop Links functionality is available as an API (with other Loop functionality to follow in the future). Please see the Loop Integration Guide as well as the API reference docs below to get started.

Action

GET /v1/loop/links

Response

{
    "count": 1,
    "next": null,
    "previous": null,
    "links": [
        {
            "link_id": "kt9fJZXpWFXSAdky9Bunb2",
            "expire_dt": "2025-03-12T21:07:26.704000+00:00",
            "name": "Hotel A",
            "status": "active",
            "create_dt": "2023-03-12T21:12:51+00:00",
            "update_dt": "2023-03-12T21:12:51+00:00",
            "metadata": {
                "hotel_id": 123456789
            },
            "links": {
                "event": "https://loop.phq.link/event/kt9fJZXpWFXSAdky9Bunb2",
                "event_feedback": "https://loop.phq.link/event-feedback/kt9fJZXpWFXSAdky9Bunb2"
            }
        }
    ]
}

Action

POST /v1/loop/links

Response

{
  "link_id": "ber7ntO0ZHuFVCfrSNsN",
  "create_dt": "2021-11-01T11:12:34",
  "update_dt": "2021-11-01T11:12:34",
  "expire_dt": "2021-11-01T11:12:34",
  "name": "Hotel A",
  "links": {
    "event": "https://loop.phq.link/event/ber7ntO0ZHuFVCfrSNsN",
    "event_feedback": "https://loop.phq.link/event-feedback/ber7ntO0ZHuFVCfrSNsN"
  },
  "metadata": {
    "hotel_id": "123456789"
  },
  "status": "active"
}

Action

GET /v1/loop/links/<link_id>

Response

{
  "link_id": "ber7ntO0ZHuFVCfrSNsN",
  "create_dt": "2021-11-01T11:12:34",
  "update_dt": "2021-11-01T11:12:34",
  "expire_dt": "2021-11-01T11:12:34",
  "name": "Hotel A",
  "links": {
    "event": "https://loop.phq.link/event/ber7ntO0ZHuFVCfrSNsN",
    "event_feedback": "https://loop.phq.link/event-feedback/ber7ntO0ZHuFVCfrSNsN"
  },
  "metadata": {
    "hotel_id": "123456789"
  },
  "status": "active"
}

Action

PUT /v1/loop/links/<link_id>

Response

204 No Content

Action

DELETE /v1/loop/links/<link_id>

Response

204 No Content

Get Settings

These settings are used to control how certain elements might be displayed inside the Loop UI. Particularly for the Loop Links UI we take the org_name from Settings and display it at the top of the page.

Response Fields

Field Description
org_name
string
Name to display at the top of the Loop UI for end-users.

This defaults to your Org name as per your PredictHQ account, however you can customize it here to make it different.

E.g. My Org Name

Action

GET /v1/loop/settings

Response

{
  "org_name": "My Org"
}

Replace (Update) Settings

Body Parameters

Parameter Description
org_name
string
Name to display at the top of the Loop UI for end-users.

This defaults to your Org name as per your PredictHQ account, however you can customize it here to make it different.

E.g. My Org Name

Action

PUT /v1/loop/settings

Response

204 No Content

Action

GET /v1/loop/events

Response

{
    "count": 1,
    "events": [
        {
            "event_id": "tae8Mie8keiceicoMae2ie",
            "event": {
                "title": "Hotel A event",
                "description": "The 2023 edition of Hotel A festival.",
                "category": "festivals",
                "state": "active",
                "metadata": [
                    {
                        "maximum_attendance": 5000
                    },
                    {
                        "attendance": 3215
                    }
                ],
                "dates": {
                    "fixed_date": {
                        "start_date": "2023-06-02",
                        "end_date": "2023-06-04"
                    }
                },
                "labels": [
                    "festival",
                    "food",
                    "music"
                ],
                "lat": "38.901544",
                "lon": "-119.7030036",
                "address": "859 U.S. Highway 395 North",
                "formatted_address": "859 U.S. Highway 395 North\nGardnerville, Nevada 89410\nUnited States of America",
                "city": "Gardnerville",
                "region": "Nevada",
                "postcode": "89410",
                "country": "US",
                "geometry": {
                    "type": "Point",
                    "coordinates": [
                        -119.703022,
                        38.9012446
                    ]
                }
            },
            "create_dt": "2023-02-16T00:52:11.112355+00:00",
            "update_dt": "2023-05-09T02:05:51.695054Z",
            "version": 1,
            "phq_review": "approved",
            "org_review": "pending",
            "phq_auto_approved": false,
            "link_id": "ber7ntO0ZHuFVCfrSNsN"
        }
    ]
}

Action

GET /v1/loop/feedback/conversations

Response

{
    "count": 1,
    "conversations": [
        {
            "record_id": "5uRg7CqGu7DTtu4Rfk",
            "record_type": "loop-backend",
            "status": "open",
            "feedback": {
                "type": "submitted"
            },
            "log": [
                {
                    "action": {
                        "type": "created"
                    },
                    "timestamp": "2023-05-30T02:44:46+00:00",
                    "creator": {
                        "type": "unauthenticated_user",
                        "link_id": "m4Dk4g4DRA8Yqbp2PC54"
                    },
                    "note": "This event title should be different"
                },
                {
                    "action": {
                        "type": "comment"
                    },
                    "timestamp": "2023-05-30T02:59:11+00:00",
                    "creator": {
                        "type": "user",
                        "user_id": "hw8Dsmv4Djg"
                    },
                    "note": "Thank you for your feedback. Someone from PredictHQ will pick this up."
                },
                {
                    "action": {
                        "type": "comment"
                    },
                    "timestamp": "2023-05-30T03:41:06+00:00",
                    "creator": {
                        "type": "moderator"
                    },
                    "note": "Absolutely, we'll change this right away "
                }
            ],
            "create_dt": "2021-05-25T05:33:53+00:00",
            "update_dt": "2021-05-25T05:38:08+00:00",
            "link_id": "m4Dk4g4DRA8Yqbp2PC54",
            "conversation_id": "Eeh4ahnohghah0deeshahda"
        }
    ]
}