Peach Apps
Developers

Low Code UI App

20min

Building a low code Peach app is great when you want to:

  • Extend your native or web based app's functionality into WhatsApp, or
  • Build and launch workflows for your customers, employees or vendors, directly on WhatsApp.

In both these cases, you would want to load data from your systems and present them to the user. Such apps also require validations, and need fine-grained control on the screen the user is taken to, based on the data captured or already available in your systems. Let's dive in to learn building such an app on Peach.

ο»Ώ

Development Lifecycle

Peach requires you to build the screens first on our editor. Add screens and components to your screens to group fields and information in logical groups. Once you have finalized the screens, you can add a backend URL and start adding validations, changing screen transitions or simply end the execution of an app. The following diagram illustrates a lifecycle of developing an app.

Document image
ο»Ώ

ο»Ώ

Architecture

Architecture

Think of Peach apps as an extension to WhatsApp Flows. WhatsApp Flows provide APIs to build UI extensions within the chat window. Peach leverages this and allows you to quickly build user journeys using little to no-code, based on your requirements.

ο»Ώ

Document image
ο»Ώ

Runtime

ο»Ώ

Document image
ο»Ώ

Reference

  1. A call is made to the backend, that the user is launching the app
  2. Backend URL initializes the session andΒ 
  3. Returns any data that the flow requires
  4. Screen transitions, dropdown/radio/checkbox selections can optionally trigger a call to backend URL
  5. Optionally, backend URL updates/fetches data from your systems
  6. The data returned from backend url is used to update UI
  7. This continues for as many screens/interactions you have configured
  8. Optional calls to your APIs
  9. When the journey is complete, backend URL ends the flow, and WhatsApp closes the app UI.

Building App UI

Create a new low code app from your Peach dashboard. You should see a UI editor loading on your screen. This is where you'll be building the components for your WhatsApp app's UI. Create one or more screens and add components to them to complete the UI.

Field Names

All form components like text fields or checkboxes have a field name. You can find this on the right sidebar, in the advanced section, when you click on an element on the main section. The field names are just like the field names in HTML forms, and the payload to your backend URL will include this name against the value entered or selected by your users.

Document image
ο»Ώ

Validations

You can add simple validations directly from the editor. This includes validations like length of text for input elements, restricting date users to select only future or past dates etc. You can add custom validations from your backend URL.

Validations can be added either at a screen level or field level, for supported components (at the moment, only text, number, email and phone number fields).

Backend URL

Register a backend URL for your app from the develop tab in the app editor. Once you have done that, Peach will hit this endpoint when a user does any of these actions on the app UI:

  • Launches your app
  • Navigates to a new screen
  • Makes a selection for any date field (when enabled)
  • Makes a selection for any radio, checkbox or list components (when enabled)

Request and Response Specs

The request from Peach will be of the following format:

Request from Peach
ο»Ώ

Peach expects your backend URL to return a response with details on how the app should function. A sample response expected by Peach would be in the following format:

Expected Response
ο»Ώ

Typically, your response defines on or more of the following: action, validations or ending execution.

Action

Define if the user should be navigated to a screen, or if the app execution should end.

Suppose you are building an expense submission flow, and you'd like your users to provide additional details, only if they have chosen a specific category. You can check for the category in your backend when the user submits a screen, and if you require the user to provide additional details, you can transition them to a screen that includes fields for the same. If this is not required, you can just end the app execution.

You can control the actions by using one of the following values for the action key in your response:

  • navigate: if you'd like to keep the app still running - use the screen_name attribute to define which screen the user navigates to (you can keep the user on the same screen too)
  • end: if you'd like to end the app execution, use this value, and the flow will end for the user.

Dynamic Data

Input Components

In your response to a Peach app request, you can optionally include one or more attributes in the data section of the json response. If a key in data corresponds to a field name on the screen you are navigating your users to, then Peach will automatically bind the UI with these values. The value for this attribute can be a string, integer or timestamp. It can also be an object, if you'd like to include validation errors or hide or show a component.

Text & Labels

Peach allows you to use dynamic data in your display components like text body, caption or headings. This is supported by allowing you to enter liquid placeholders for these components from the UI. Peach will replace these placeholders from the data attributes in your response.

For example, suppose your UI includes a Caption component, and you'd like to replace the text for this dynamically from your data. Suppose your response includes this as a data attribute like below:

JSON
ο»Ώ

Update the caption's text to the following:

Text
ο»Ώ

When the screen is rendered, your users will see Lazyman for this caption.

Input Fields

For example, suppose your UI includes 2 fields on a screen - name and city. If your response includes this section:

Response Snippet
ο»Ώ

Peach will automatically display the values for name and city fields. If the city field is a list or a radio/checkbox field, then a value will be selected that has the id set as Bangalore.

Validations

Validate data entered by your users based on your business logic. You can add validations either for specific input fields or at a screen level.

Suppose you have a screen with an input field for postal_code. Let's say you'd like to check if the user resides in a postal code that you serve. If you find that the user is outside your service zone, you can add a validation error like below:

Validations
ο»Ώ

Visibility

You might want to show or display fields conditionally. This can be achieved by including visible attribute against the field name in your payload data.

Suppose you have a screen called with an input field for postal_code. Let's say you'd like to hide this field if your user selected US as their country of residence. You can do this by including this in the data section of your payload:

Visibility
ο»Ώ

Required/Optional

You might want to make some fields as required or optional conditionally. This can be achieved by including required attribute against the field name in your payload data.

Suppose you have a screen called with an input field for postal_code. Let's say you'd like to make this field mandatory if your user selected US as their country of residence. You can do this by including this in the data section of your payload:

json
ο»Ώ

Request/Response Schema Specs

A detailed spec for the request from Peach and the expected response from your servers is available here.

Local Development

When developing a low-code app, it is much faster to build your backend URL on localhost before deploying and testing your app. To do this, we recommend that you use a service like Ngrok or LocalTunnel to set up a proxy for your localhost server. Copy the proxy url to the Backend URL on Peach, now all the requests will be forwarded to your server running locally.

Testing

From the app editor on Peach, click on the Test button to bring up a QR code. Scan this code on your phone, this will launch WhatsApp with a pre-filled command. When you hit send, a message will show up that will include a button to launch your app.

You should be able to see the logs of all the requests and responses between Peach and your server with complete payload.

ο»Ώ

Getting Help

If you need any help, don't hesitate to reach out to us. Our contact info is available hereο»Ώ.