Tito redux

Tito Documentation

Webhooks

Tito provides the option to add a webhook for when tickets are created and updated.

You can specify a webhook in the Webhooks tab in the Customize section.

Webhooks will POST a JSON payload to the endpoint you specify, with a X-Webhook-Name header. This will be either ticket.created, ticket.updated, ticket.voided, ticket.unsnoozed or ticket.reassigned.

The payload will look something like this for a basic ticket:

{
  "event": {
    "title": "AwesomeConf ๐Ÿ‘",
    "url": "https://ti.to/paulca/awesomeconf",
    "account_slug": "paulca",
    "slug": "awesomeconf",
    "currency": "EUR",
    "start_date": "2020-12-01",
    "end_date": null
  },
  "name": "Paul Campbell",
  "first_name": "Paul",
  "last_name": "Campbell",
  "email": "funconf@gmail.com",
  "phone_number": null,
  "company_name": null,
  "reference": "1i5nfwf2t",
  "price": "1.00",
  "tax": "0.19",
  "price_less_tax": "0.81",
  "slug": "1i5nfwf2t24",
  "state_name": "void",
  "gender": "male",
  "release_price": "1.00",
  "discount_code_used": "",
  "total_paid": "1.00",
  "total_paid_less_tax": "0.81",
  "updated_at": "2012-05-08T20:08:39.000+10:00",
  "url": "https://ti.to/tickets/1i5nfwf2t24",
  "admin_url": "https://ti.to/paulca/awesomeconf/admin/tickets/1i5nfwf2t24",
  "release_title": "AwesomeConf ticket",
  "release_slug": "31az2uvoh4",
  "release_id": 90,
  "release": {
    "id": 90,
    "title": "AwesomeConf ticket",
    "slug": "31az2uvoh4",
    "metadata": null
  },
  "custom": null,
  "registration_id": "bdtyap3hguq",
  "registration_slug": "bdtyap3hguq",
  "metadata": null,
  "answers": [

  ],
  "upgrade_ids": [

  ],
  "registration": {
    "url": "https://ti.to/registrations/bdtyap3hguq",
    "admin_url": "https://ti.to/paulca/awesomeconf/admin/registrations/bdtyap3hguq",
    "total": "1.00",
    "currency": "EUR",
    "payment_reference": null,
    "source": null,
    "name": "Paul Campbell",
    "email": "funconf@gmail.com",
    "receipt": {
      "total": "1.00",
      "tax": "0.19",
      "payment_provider": "Unknown",
      "paid": true,
      "receipt_lines": [
        {
          "total": "1.00",
          "quantity": 1,
          "tax": "0.19"
        }
      ]
    }
  }
}

If the ticket has answers to questions, it will look a bit like this:

{
  "event": {
    "title": "AwesomeConf ๐Ÿ‘",
    "url": "https://ti.to/paulca/awesomeconf",
    "account_slug": "paulca",
    "slug": "awesomeconf",
    "currency": "EUR",
    "start_date": "2020-12-01",
    "end_date": null
  },
  "name": "Paul Test",
  "first_name": "Paul",
  "last_name": "Test",
  "email": "paul+test@rslw.com",
  "phone_number": null,
  "company_name": null,
  "reference": "A8FV-3",
  "price": "1.00",
  "tax": "0.19",
  "price_less_tax": "0.81",
  "slug": "pGZ3De1X3wLslG7yQwO7QFg",
  "state_name": "complete",
  "gender": "male",
  "release_price": "1.00",
  "discount_code_used": "",
  "total_paid": "1.00",
  "total_paid_less_tax": "0.81",
  "updated_at": "2014-07-09T02:50:29.000+10:00",
  "url": "https://ti.to/tickets/pGZ3De1X3wLslG7yQwO7QFg",
  "admin_url": "https://ti.to/paulca/awesomeconf/admin/tickets/pGZ3De1X3wLslG7yQwO7QFg",
  "release_title": "AwesomeConf ticket",
  "release_slug": "31az2uvoh4",
  "release_id": 90,
  "release": {
    "id": 90,
    "title": "AwesomeConf ticket",
    "slug": "31az2uvoh4",
    "metadata": null
  },
  "custom": null,
  "registration_id": "pbidGD4FWx7r47py0dYdDeg",
  "registration_slug": "pbidGD4FWx7r47py0dYdDeg",
  "metadata": null,
  "answers": [
    {
      "question": {
        "title": "Phone Number",
        "description": "",
        "id": 200
      },
      "response": "12345",
      "humanized_response": "12345"
    },
    {
      "question": {
        "title": "Country",
        "description": "",
        "id": 1005357
      },
      "response": "IE",
      "humanized_response": "IE"
    }
  ],
  "responses": {
    "phone-number": "12345",
    "country": "IE"
  },
  "upgrade_ids": [

  ],
  "registration": {
    "url": "https://ti.to/registrations/pbidGD4FWx7r47py0dYdDeg",
    "admin_url": "https://ti.to/paulca/awesomeconf/admin/registrations/pbidGD4FWx7r47py0dYdDeg",
    "total": "3.00",
    "currency": "EUR",
    "payment_reference": "ch_4MkyHRycVDKfCp",
    "source": null,
    "name": "Paul Campbell",
    "email": "paul@rslw.com",
    "receipt": {
      "total": "3.00",
      "tax": "0.56",
      "payment_provider": "Stripe (live)",
      "paid": true,
      "receipt_lines": [
        {
          "total": "3.00",
          "quantity": 3,
          "tax": "0.56"
        }
      ]
    }
  }
}

Verifying the payload

Each payload comes with a signed HMAC signature so that you can verify the origin of the webhook request.

In Customize -> Webhooks, you'll find a shared security token. You can use the to sign the payload.

The security token is used as a key to sign the payload data with an HMAC key.

The HMAC key is your security token, the HMAC digest is SHA2, and the data is the raw payload JSON that is sent. The key is sent Base64 encoded via the Tito-Signature HTTP header.

If youโ€™re using Ruby, for example, you can verify the authenticity of your payload with the following code:

key = 'YOUR EVENT SECURITY TOKEN'
hash = OpenSSL::Digest.new('sha256')
data = 'THE WEBHOOK REQUEST'

Base64.encode64(OpenSSL::HMAC.digest(hash, key, data)).strip

If you ever need some help, don't hesitate to contact us…