Publishing a Lapp

When you publish a Lapp –

  • You’ll receive an API URL and security token for each environment (test and live).
  • Calls to the Lapps API URL should always be POST.
  • This security token should be passed in the request header as x-api-key.
  • Once a Lapp is published, if you’ve written logs, the Logs option will show up in your navigation menu.
  • Published Lapps can be used in automation, webhooks and rules and notifications in your LeadSquared application.

Note: To learn more about calling Lapps APIs, please refer to Invoking Lapp APIs.

 

Procedure

  1. Click the Save button to save your code.
  2. Once your code is saved, the Publish button will appear alongside the Save button. When you click the Publish button, the option to publish your Lapp to the test environment will appear. You can only publish a Lapp to live once it is published to the test environment.
  3. Once published to test, you’ll see a pop-up with your API URL and Token.
  4. The Logs link will also appear in your navigation menu on the left side of the page.

how to publish a lapp

 

Viewing Logs

Logs will only appear after your Lapp is published. In the example below, we’re pushing some data to a Lapp using Postman (https://www.getpostman.com) and then reviewing the logs –

  1. Copy and paste the Lapp API URL in Postman (you can use any similar tool).
  2. Set the HTTP Method to POST.
  3. Create the API Header “x-api-key” in Postman and copy and paste the Lapp security token.
  4. Pass the API body (“Message”: “Hello World” in this example) in JSON format.
  5. Click the Logs option in the navigation pane in LeadSquared.
  6. Click the Edit (wheel) icon to view Lapp Request Details and Code Logs.

Updated Lapp test

Note:

  1. There might be a delay of maximum 1 minute between calling the Lapp API and the logs showing up.
  2. Logs will be auto-deleted after a certain period of time.

 

Lapps Audit History

The Audit section records changes made to meta-information (name, description, published/unpublished, etc.), settings, and code for each Lapp. You can also export the code by clicking the download download batch job icon.

The following filters are available –

  • Category – All, Meta Info, Code, Settings.
  • Source – Filters requests based on origin: All, UI, SDK, API.
  • Modified By – Filters the changes by user.
  • Modified On – Filters the changes by date.

Build LeadSquared apps

 

Next Steps

After publishing a Lapp you can call it from –