Uspacy Knowledge Base
All materialsFor developers

App development for a Marketplace using External Lines

App development for a Marketplace using External Lines

Here is described the process of creating a marketplace app, including registration, backend development, and working with external lines

App Registration

To register your app in our system, prepare and provide the following information ⬇️

💡Note: You can provide descriptions and names in multiple languages for better localization. Currently, we support the following languages ⬇️

LocaleLanguage
ukUkraine
en-USEnglish US
pt-BRPortuguese
plPolish
es-ESSpanish
deGerman

After providing this information, you will receive a client_id and secret_id for further development.

Backend Development

We have prepared a Laravel PHP template with basic settings. Review the link

🔍 Review the link ➡️ HERE

App Installation

When a user installs the app, you will receive the following request:

❗️We use a JWT token. To determine the portal that is installing the app, you need to parse the token and verify its authenticity. An example implementation of this logic can be found ➡️ HERE

You need to save:

  • token – valid for 1 day
  • refresh_token – valid for 30 days
  • expiry_date – to check the token's validity

It is recommended to create a cron job to update portal tokens.

When developing an integration, you will encounter two types of tokens: a user token and an integration token. These tokens are signed with different keys and contain different sets of fields in their payloads.

Access Token Renewal

In the previous step, we obtained a token. This token has a lifetime of 1 day, after which requests using it will stop working. To renew the token, we recommend using the following request:

App deletion

When the app is uninstalled, you will receive:

💡 The token is in the Authorization header. You need to parse the token, get the domain value, and verify the token's authenticity.

Working with External Lines (EL)

Creating external line

To send messages to external lines (EL), you first need to create them. Typically, one connection has one EL. For example, in the Instagram app, the user can add multiple accounts (connections), and we create a separate EL for each of them.

Save the identifier of the created EL, as you will need it later.

🔍 More information about EL interaction methods can be found ➡️ HERE

Creating a Chat

Next, you need to create a chat. If, for example, webhooks will be receiving events about messages, then having the identifier of the user sending these messages, you can create a chat. Then, in subsequent similar events, you will know which chat to send the processed messages from your service to the EL.

Save the identifier of the created chat.

These are the basic required fields.

🔍 More information about chat interaction can be found ➡️ HERE

Sending Messages

If your message will contain attachments, you need to upload them first.

  1. Uploading files (if needed):

🔍 More information about file storage can be found ➡️ Here

2. Sending a message:

💡 You can use Markdown to format the message text.

🔍 More information about message manipulation can be found ➡️ HERE

3. Receiving a message event:

When you registered the app, you provided the sns_subscription_url field. We will send a webhook about the message in the EL to this URL. You need to check the event that comes in and extract only the payload. For example, you can use the nipwaayoni/laravel-aws-sns package for PHP and add the following code to the controller:

Here is an example of a received message event with an image:

After that, we recommend checking that it is a message, and that it is from the EL:

Next, you can find the corresponding chat in your system by the chatId identifier.

If you have additional questions or you need to contact the support, send a request to this email [email protected]

Created: September 26, 2024 / Updated: September 24, 2025