Docs

Link Creation

Generate smart links programmatically in your web app

Use createLink to generate a smart link:

grovs.createLink(
    'Check out this product',              // title
    'Limited time offer',                  // subtitle
    'https://example.com/image.jpg',       // imageURL
    {                                      // data
        productId: '12345',
        screen: 'product_detail',
    },
    (response) => {
        console.log('Link created:', response);
    },
    (error) => {
        console.error('Error:', error);
    }
);

Parameters

ParameterTypeDescription
titlestringLink preview title
subtitlestringLink preview subtitle
imageURLstringLink preview image URL
dataobjectCustom payload delivered when the link is opened
successfunctionCallback on successful link creation
errorfunctionCallback on error

Full example

import Grovs from 'grovs';
 
const grovs = new Grovs('your-api-key', (data) => {
    console.log('Link data:', data);
});
 
grovs.start();
 
// Wait for authentication, then create a link
if (grovs.authenticated()) {
    grovs.createLink(
        'Share this page',
        'Check out what I found',
        'https://example.com/og-image.jpg',
        { page: '/products/12345', source: 'share' },
        (response) => console.log('Created:', response),
        (error) => console.error('Failed:', error)
    );
}