Create a skill (more details)

The interest of creating a skill is to modularize and structure your chatbot. We can also share the skill to the community

Structure of your competence

  • (my-skill)

    • my-skill.js

    • my-skill.converse

Let's create our scenario as usual in the JS file:

import code from './my-skill.converse'

export default {
    code
}

And in the ConverseScript

@Intent(/hello/i)
hey() {
    > Hey !
}

With parameters

If we want to send parameters, such as a token, the skill must return a function:

skills/my-skill.js

In your main script:

It is possible to write it this way too:

This time, the value of mySkill is an object with two properties:

  • skill: the path to competence

  • params: the parameters to send to the function of the competency

An asynchronous skill

The skill can return a promise

skills/my-skill.js

So let's send the skill to the resolve() function of the promise. In the main script:

Last updated

Was this helpful?