Socket
Socket
Sign inDemoInstall

appurl

Package Overview
Dependencies
8
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    appurl

Official AppURL API Library


Version published
0
Maintainers
1
Install size
781 kB
Created
Weekly downloads
 

Readme

Source

Official AppURL API for NodeJS

About

This module provides easy access to the AppURL API for NodeJS.

The AppURL API requires an API key / access token. To get your access token, visit https://docs.appurl.com/api/get-access-token.

For more information on the API structure, check out the AppURL API Docs.

Installation

NPM

npm install appurl

YARN

yarn add appurl

Usage:

Remember, this library uses an API key provided by AppURL. To get your access token check out docs.appurl.com/api/get-access-token.

If you would like more info on the underlying API check out docs.appurl.com.

Example:

import { AppUrlClient } from 'appurl';

const appurl = AppUrlClient('TOKEN');

 async function getShortedUrl(url) {
  let result;
  try {
    result = await appurl.shorten(url);
  } catch (err) {
    throw err;
  }

  return result;
}

getShortenedUrl('https://google.com');

Additional Features

Because the AppURL API is protected by an API key which you are responsible for we are able to offer more access.

Image Upload

The AppURL API and this Module accept image uploads. This allows for very specific control of how your link preview looks when shared across a variety of mobile devices and apps.

To use the image upload you must for BASE64 encode your image, then pass that string as the second argument of your shorten function call. Here is an example.

Example:

import { AppUrlClient } from 'appurl';

const appurl = AppUrlClient('TOKEN');
const base64EncodedImage = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=';

 async function getShortedUrl(url, base64EncodedImage) {
  let result;
  try {
    result = await appurl.shorten(url, base64EncodedImage);
  } catch (err) {
    throw err;
  }

  return result;
}

getShortenedUrl('https://google.com', base64EncodedImage);

The code above will upload the image at set it as your preview image. This is extremely handy for sharing.

Optional Properties

Optional properties are one more way you have complete control over your AppURL. The third optional argument of the shorten function is an object containing a very specific list of settings for your AppURL allowing you to control every aspect of it's functionality.

Properties

    'appName'
    'fallbackUrl'
    'iosIphoneAppUrl'
    'iosIphoneFallbackUrl'
    'iosIpadFallbackUrl'
    'iosIpadAppUrl'
    'androidAppPackage'
    'androidAppScheme'
    'androidFallbackUrl'
    'windowsPhoneAppUrl'
    'windowsPhoneFallbackUrl'
    'blackberryFallbackUrl'
    'clickSendUsername'
    'clickSendApiKey'
    'googleAnalyticId'
    'ogDescription'
    'ogImageUrl'

This example would upload the custom preview image and set the redirect landing page title to "My App" and the share preview description to "This is my amazing app!".

Example:

import { AppUrlClient } from 'appurl';

const appurl = AppUrlClient('TOKEN');
const base64EncodedImage = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=';

 async function getShortedUrl(url, base64EncodedImage, props) {
  let result;
  try {
    result = await appurl.shorten(url, base64EncodedImage);
  } catch (err) {
    throw err;
  }

  return result;
}

getShortenedUrl('https://google.com', base64EncodedImage, {
  appName: 'My App',
  ogDescription: 'This is my amazing app!'
});

Contact us

We are proud of the products we are making! If you have any questions please don't hesitate to reach out to AppURL Support.

Keywords

FAQs

Last updated on 23 Oct 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc