Create an app
Before you start
Ensure you have access to Socotra Core and have deployed a product
Sign into App MarketPlace (AMP) as a publisher or admin account, refer to your dashboard
Install the AMP CLI
# Install globally npm install -g @socotra/app-cli # Install as a local package npm install @socotra/app-cli
Create your listing
Click on Publish New App under the publish tab
Fill out required fields, keeping note of your App Name. This will be referenced when in the CLI.
Make use of the image crop tool to center your content
Describe your product offerings and the app’s capabilities in the About section
Include technical details users will need to run your app successfully in the App Requirements section
Publish your content and confirm a Draft state
Deploy your app
These steps follow our .NET example from our public AMP repository
Create your app bundle
Code
Dockerfile - App runs as a Docker container (Dockerfile example). Docker container must use base OS image with
amd64
architecture. To do that, Docker file must have an explicit flag--platform
in it’sFROM
statement when specifying a base image for container:FROM --platform=linux/amd64 node:current-alpine AS base
.Configurable port - Ensure your app listens to a configurable port, this port will be overridden by AMP via an environment variable called
SMP_PORT
. All calls to an instance of the container will be routed only on the port provided in this environment variable.Health endpoint - The Marketplace platform will ping a default
/health
endpoint in your container to monitor health. Application must expose an endpoint/health
responding toGET
request with200 OK
status code. This endpoint will be called by various infrastructure services to verify that application container is available, responsive and in a healthy state. Developer can use this endpoint to verify necessary app connectivity or required integrations.State - Apps are stateless and event driven, state is provided by AMP on each call.
This state can be used to differentiate inbound requests to your app; remember that a single instance of your app can be serving multiple customers that have each configured the app with their own unique settings and product schemas.
Use settings and mapping fields, defined in the manifest, to help your app be as universal as possible and serve the widest possible audiences.
State request example
const key = req.headers["x-SMP-key"]; const response = await axios.get(`${stateApi}/state/${key}`);
State response example
{ "settings": { "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" }, "mappings": [ { "productName": "string", "fields": { "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" } } ], "socotraApiUrl": "string", "tenantHostName": "string", "token": "string" }
Manifest
This file allows you to define the end-user experience when launching your app. Your app will receive the values inputted by the users as part of the state response.
File Name - AMP will look for
socotra-app.json
at the root of your Docker imageIntegration Triggers - Leverage the Socotra platform to trigger requests to your app
Webhooks (Socotra Policy Admin) - Receive request when certain events occur in the policy system
Autofill (Socotra Policy Admin) - Modify policy data when requested
External Rater (Socotra Policy Admin) - Return pricing information for policies
Lifecycle Hooks (AMP) - Run custom logic during different app lifecycles (ex. on install, uninstall)
Use the manifest editor on your app listing to import, modify, and download your manifest visually!
Deploy your app bundle
Authenticate with your organizations AMP credentials
socotra-app login # Provide Client ID and API Key
API credentials are managed in the API Keys section of your dashboard
Build and test example app locally (from DotNet example)
# Build project dotnet build # start and build docker container $ make dr-start-local # test locally $ curl -d "@src/Socotra.VinLookup/Models/AutofillPayloadExamples/ExposuresPayload.json" -H "Content-Type: application/json" -X POST http://127.0.0.1:10101/vehicleLookup
Deploy your container to your listing
# this cmd will increment the second digit of the version number in the `socotra-app.json` # deploys updated version of the app to socotra marketplace make publish-app
Test your app
Click Test Launch. Only the publishing organization can launch their draft apps.
Provide all configuration details
Your app is now running!
Congratulations, your app is deployed and running on Socotra App Marketplace!
The Socotra team will guide you through the final moderation steps if you want to make it public.