Shopify

To integrate the plugin into your other flows, you need to install the library:

Install

npm

    npm install @builderbot-plugins/shopify
    import 'dotenv/config'
    import { createBot, MemoryDB, createProvider, createFlow } from '@builderbot/bot'
    import { createShopifyFlow } from '@builderbot-plugins/shopify'
    import BaileysProvider from "@builderbot/provider/baileys";

    const main = async () => {

        const provider = createProvider(BaileysProvider)

        const { flow } = await createShopifyFlow({
            modelName: 'gpt-3.5-turbo-16k',
            openApiKey: "YOUR_OPEN_API_KEY_HERE",
            shopifyApiKey: "YOUR_SHOPIFY_API_KEY_HERE",
            shopifyDomain: "YOUR_SHOPIFY_DOMAIN_HERE"
        })

        await createBot({
            database: new MemoryDB(),
            provider,
            flow: createFlow(flow)
        })

    }

    main()

SmartFlows

Okay, a smartflow is nothing more than a flow like we know, it's just that this one has something that makes it special!

That something is the ability to communicate with AI to understand what the user is trying to tell us.

To add a smartflow, follow the code I show you below


    /* stuff code */

    const byeFlow = addKeyword('bye').addAnswer('bye, i hope see you soon');

    const smartFlowBye = {
        name: 'BYE_FLOW',
        description: [
            "I'm an expert in goodbyes,",
            "I'm the right person to respond when the user says bye or is saying goodbye."
        ].join(' '),
        flow: byeFlow
    }

    const extra = { 
        flows: [smartFlowBye]
    }

    const { flow } = await createShopifyFlow({
        modelName: 'gpt-3.5-turbo-16k',
        openApiKey: "YOUR_OPEN_API_KEY_HERE",
        shopifyApiKey: "YOUR_SHOPIFY_API_KEY_HERE",
        shopifyDomain: "YOUR_SHOPIFY_DOMAIN_HERE",
    }, extra)


    await createBot({
        database: new MemoryDB(),
        provider,
        flow: createFlow(flows)
    })

The bot's response should be something like this.

ByeFlow

NormalFlows

Sometimes we just need a common flow to provide immediate and controlled responses. In this case, let's simply add the flow to trigger an action when the user says thank you.

    const gratefullFlow = addKeyword('/thanks/', 
    { sensitive: false, regex: true }).addAnswer("Thank you for trusting our store ❤️");


    const flows = flow.concat(gratefullFlow)

    const { flow } = await createShopifyFlow({
        modelName: 'gpt-3.5-turbo-16k',
        openApiKey: "YOUR_OPEN_API_KEY_HERE",
        shopifyApiKey: "YOUR_SHOPIFY_API_KEY_HERE",
        shopifyDomain: "YOUR_SHOPIFY_DOMAIN_HERE"
    })

    await createBot({
        database: new MemoryDB(),
        provider,
        flow: createFlow(flows)
    })

normalFlow

Tests

Some tests done in the plugin can be found at the following link.

The following tests were conducted in various real-life scenarios, ranging from unfamiliarity to ambiguity

Accuracy

ACCURACY FROM PLUGIN

The plugin was subjected to various conversational tests, ranging from direct questions to more conversational ones.

here somethings examples

pricing image colors

The plugin has a 97% of preccision when the conversation is not ambiguous

The plugin has a 96% accuracy when the conversation is unambiguous. This means it is as accurate as the question itself. This does not diminish its potential.

TODO:

  • Improve history conversation.

  • Manage ambiguous question in same flow.

  • Improve answer triguers by agents.

  • Dynamic language spoken by the user.

References

REFERENCE:
Shopify pluggin
Telegram provider