Developer › Guides › Using deep linking to create solar projects

Using deep linking to create solar projects

1. Use cases for deep linking

If you have a system such as a CRM or lead provider which gives you a customer’s location, you may want to allow a user to click a link and be taken right to that location in Pylon.

If you want to give your users the ability to create a new project by clicking a link, you can use one of the two approaches below: searching for the project’s address, or jumping to a latitude/longitude coordinate. When your users click these links, they will be prompted to confirm project creation as usual.

Jump to a location

When you have the customer’s precise location, e.g. from a lead provider which asks the customer to choose their own location on a map, this is the most direct way to create a project creation link.

To create a link which directly opens a location on the map, use the following format:

https://app.getpylon.com/map/at/{latitude},{longitude}

The latitude and longitude must be floating-point numbers. Our map uses the WGS84 coordinate reference system used by Google Maps and other popular web-based mapping providers.

Search for an address

When you don’t already have the customer’s precise location, but you do have their address, you can perform a search. Address search links will lookup the textual address,

To create a link which searches for an address, use the following format:

https://app.getpylon.com/map/address?search={text}&country={iso_code}

The search query parameter must be the full address properly URL-encoded.

The country query parameter is optional, and may be a two-digit ISO country code. If you provide this parameter, we can use it to make your address searches more accurate by using country-specific databases.

See below for advice on properly creating URLs with query parameters.

Providing project properties

When you create a deep link to /map for the purpose of creating a project, you can pass in extra query parameters to reduce manual data copying.

For example, to create a project with a customer’s name from your CRM, you could create a link like this:

https://app.getpylon.com/map/at/-33.8512,151.2191
    ?customer_name=Luke+Skywalker
    &customer_email=luke@skywalker.com
    &reference_number=1234

The following parameters are available:

Query parameterTypeUsage
customer_namestringThe project’s customer name used on the proposal
customer_emailstringEmail address of the customer
customer_phonestringPhone number of the customer
reference_numberstringA reference number for this project, which must be unique to this project. You can use this to link projects across different systems.

3. Creating URLs programatically

Because URLs and query strings must be properly formatted and encoded, we do not recommend simply concatenating string values to create a URL. If you are creating deep links to Pylon, please use the features of your programming environment to ensure all values are correctly formatted.

All of the examples below will result in the following URL:

https://app.getpylon.com/map/address
    ?search=5+George+St%2C+North+Strathfield+NSW
    &country=AU
    &customer_name=Luke+Skywalker
    &customer_email=luke@skywalker.com
    &reference_number=1234

Opening this URL will search for the address “5 George St, North Strathfield NSW”. A solar project then created from that link will be assigned the customer name “John Doe” and email address example@example.com.

JavaScript

"https://app.getpylon.com/map/address?" + new URLSearchParams({
    search: "5 George St, North Strathfield NSW",
    country: "AU",
    customer_name: "John Doe",
    customer_email: "example@example.com",
});

PHP

'https://app.getpylon.com/map/address?' . http_build_query([
    'search' => '5 George St, North Strathfield NSW',
    'country' => 'AU',
    'customer_name' => 'John Doe',
    'customer_email' => 'example@example.com',
]);

Python

import urllib

"https://app.getpylon.com/map/address?{}".format(urllib.urlencode({
    "search": "5 George St, North Strathfield NSW",
    "country": "AU",
    "customer_name": "John Doe",
    "customer_email": "example@example.com",
}))