Saltar al contendio prinicipal

Create Survey-Triggered Parametrized Bot

Advertencia

Esta página aún no se encuentra traducida al español.

Tutorial on how to activate a bot after submitting a survey.

Time: 25 minutes

Company Requirements

We want to improve HR's idea exposed in the Create Survey Tutorial for welcoming new employees. To help break the ice, we propose that every time an in-coming employee answers the "New Pal" survey, a bot representing the company mascot or some fictional character welcomes them with a message and an animated gif.

The welcoming message would go something like this:

Welcome {nickname}! I wish you all the best of luck in this new journey in the company! Hey team, say hi to our new pal from the {department} area!

Pre-Requisites

Access Role

  • User with the admin-groups-write, admin-properties-write and admin-bots-write permissions to create and modify groups, databases and bots.
  • Or the admin-*-write which allows all of the above.
  • User with the read admin access role .

Survey

User

  • Having completed the Create User Tutorial
  • A fictional character or company mascot created as a user. We will need to use their email address later on in the tutorial.
    note

    In this example, pet@cotalker.com is the email of the created pet/fictional user.

Steps

I. Create the Bot

  1. Access the Administrator and open Bots.

  1. Press + icon to create a new bot.

  1. Set up the following:

    1. In the General information section, set:

      • Name: New pal bot
      • Code: newpalbot_1
      • Description: Welcomes new members to the company.
    2. In the Access section, set:

      • Access Roles: default
    3. In the Functions section, set:

      • It's a survey command: activate option
      • Form: New pal

So far, your screen should look something like this:

settings

  1. Build the routine:

    1. In the Routine builder section:
      • Press the + Add Routine button.
      • New settings will appear. You should see something like this:Routine builder

    1. Add the first stage by pressing the + Add stage button, and set the following:
      • Code: property_request
      • Type: Network Request
      • URL : $JOIN#/#($ENV#BASEURL)#api#properties#($VALUE#data|[find=>identifier=department]|process|0)
        note

        The Cotlang string in the URL field gets the department's URL address.

      • Method: GET
      • Default authentication: activate option

    1. Scroll back up the Routine builder section to add the second stage by pressing the + Add Stage button again. Set the following:
      • Code: message
      • Type: Send Message
      • Content: $JOIN# #Welcome#($VALUE#data|[find=>identifier=nickname]|process|0)#! I wish you all the best of luck in this new journey in the company! Hey team, say hi to our new pal from the#($OUTPUT#property_request#data|name|display)#area.
      • Content type: text/plain
      • User: ($CODE#user#email#pet@cotalker.com)|_id
        note

        This [Cotlang] string will return the COTuser that matches the email pet@cotalker.com and then obtain its id.

      • Channel: $VALUE#channel
        note

        The context being accessed is COTanswer.


    1. Scroll back up and press + Add Stage to add the third stage. Set the following:
      • Code: gif
      • Type: Enviar Gif
      • In Búsqueda, press the + Add item, and set:
        • Item: Welcome Pal
      • Channel: $VALUE#channel
      • User: ($CODE#user#email#pet@cotalker.com)|_id

    1. Scroll back up again and set:
      • Max. Iterations: 10
      • Initial Stage: property_request

    1. Select the property_request stage. Then, scroll to the bottom of the section and configure the following:
      • Under Outputs, in the Succeed field: message

    The stages can be selected from this menu bar: stages menu bar


    1. Select the message stage. Scroll to the bottom of the section and configure the following:
      • Under Outputs, in the Default field: gif

  1. Press Save.

II. Configure the Channel

  1. Access the Administrator and open Groups.

  1. Press the group that has the channel with the whole team.
    note

    The team channel was created in the Create Survey Tutorial.


  1. Press the channel where the whole team is found.

  1. Configure the Participants section:
    • Bots: New pal bot

Your screen should look something like this:

edit channel

  1. Press Save.

Congratulations!

Now that you finished, go to the team channel and try to send the New Pal survey.

team channel

Result

After submitting the survey, you should see a message like the following in the channel chat window :

team channel