Skip to content

Configuration

Khalil G edited this page Sep 20, 2021 · 2 revisions

Upon instantiating TenorJS, you're allowed to configure pretty much all necessary core options to ensure maximum satisfaction with the provided results. You will find below a list of the available client configuration options as well as other resources and references from the official Tenor API documentation.

Configuration Options

# Parameter Description Default Value Options
1 key The Tenor API developer key. n/a Get one here.
2 filter The content safety filter level (NSFW/SFW, etc). high off / low / medium / high
3 locale The default language to interpret the search string. en_US ISO 639-1 language code / 2-letter ISO 3166-1 country code
4 media Reduce the number of GIF formats returned. minimal minimal (tinygif, gif, mp4) / basic (nanomp4, tinygif, tinymp4, gif, mp4, nanogif)
5 date_format The default date format. D/MM/YYYY - H:mm:ss A Left to the developers' discretion.
6 ratio_range Filter the GIFs list to only include items with aspect ratios that fit the selected range. all all (no constraints) / wide (0.42 <= aspect ratio <= 2.36) / standard (.56 <= aspect ratio <= 1.78)

How this looks in practice

const { Tenor } = require("tenorjs");

const Client = new Tenor({
"key": "key",
"filter": "high",
"locale": "en_US",
"media": "minimal",
"date_format": "D/MM/YYYY - H:mm:ss A",
"ratio_range": "all"
});

Additional notes

  • If any value besides "key" is omitted here, it will be automatically replaced by TenorJS with the corresponding default value.

  • With regards to ratio_range, you can choose to not specify a default standard in the main client configuration, but rather give your users the choice to specify one of the three available options to ensure the best user experience. For more on this, see Examples.

Clone this wiki locally