Esri's Geotrigger Service is replacing Geoloqi! Learn More | FAQ

Create the Layer

You will first need to create a new layer to hold your collection of places. You can do this on the website by clicking the "New Layer" button from the layers page, https://geoloqi.com/layers, or you can create a layer via the API.

  layer = geoloqi.post 'layer/create', {
    :name        => 'My Sweet Layer',
    :key         => 'my_layer',
    :description => 'My layer for testing'
  }

Create Places

Places exist on a layer. You can create places by using the place/create API method.

For the Calagator layer which reminds people of upcoming events nearby, we create a place record corresponding to the venue of the event. The Geoloqi API will not create duplicate places with the same name, so it's safe to run this multiple times for the same venue.

<?php
  $place = $geoloqi->request('place/create', array(
    'layer_id'    => $layerID,
    'name'        => $event->venue->title,
    'description' => trim($event->venue->description.' '.
                          $event->venue->address.' '.
                          $event->venue->url),
    'radius'      => 500,
    'latitude'    => $lat,
    'longitude'   => $lng
  ));
?>
  place = geoloqi.post 'place/create', {
    :layer_id    => layer[:layer_id],
    :name        => event[:venue][:title],
    :description => event[:venue][:description],
    :radius      => 500,
    :latitude    => event[:venue][:latitude],
    :longitude   => event[:venue][:longitude]
  }

Create Triggers

Triggers can do things such as send messages when people enter places. There are other options as well, such as sending messages when users leave, or after they have been at a place for 5 minutes. You can see the full list of options on the trigger/create API documentation page.

For the Calagator layer, we create a trigger at a venue with the message we want to deliver to users.

<?php
  $geoloqi->request('trigger/create', array(
    'place_id'  => $place->place_id,
    'type'      => 'message',
    'date_from' => date('c', strtotime('-3 hours', strtotime($event->dateStart))),
    'date_to'   => date('c', strtotime($event->dateStart)),
    'one_time'  => 1,
    'text'      => $message,
    'url'       => 'http://calagator.org/events/'.$event->id
  ));
?>

date_from, date_to: The trigger is set to be active 3 hours before the start of the event, and expires at the event start time so people won't get notifications of past events.

one_time: Setting this to "1" ensures a user will only receive this message the first time they enter the place, and will not receive it if they come back. Set to "0" or leave it out if you want the message to be recurring.

text: The text is a sentence we constructed from the event data such as "Are You Smarter than Your Lawyer and Venture Capitalist? at Urban Airship at 11/01 6:30pm". If the text specified is longer than will fit in a push notification or SMS, it will be trimmed automatically.

url: The URL is a link to the event on Calagator. If the message is sent via push notification, clicking on the notification will open the web page. If sent via SMS, the link will be appended to the end of the SMS.

Timeline Stories

When a user picks up the message, it gets added to their timeline on the web, with links to the layer page and place page. The story will also contain a link to the URL provided in the trigger.

What Next?