Support » Plugin: My Chatbot » Enabling multiple agents

  • Resolved softra

    (@softra)


    Hi,

    Thanks for this amazing plugin. I would like to know if we could enable two Dialogue Flow agents in same wordpress installation. If yes, how could I use that feature..

    “== Changelog ==

    = 0.6 (28/11/2017) =
    * New: Now supports multiple chatbots on the same page ”

    Thank you,
    Tony Thomas

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello.

    I have same question.
    anyone can help this?

    thanks
    akio

    Hello!
    Same question!

    Thanks

    Plugin Author dpowney

    (@dpowney)

    It is possible to add different agents to different pages by change the access token based on the page.

    The access token is accessed via the mys_script_vars JavaScript variable. This is set using the wp_localize_script() function.

    Then on the client side, the access token is accessed as follows to construct the AJAX call to query Dialogflow:
    myc_script_vars.access_token

    I’ve allowed the access token value to be changed via a WordPress filter as follows:
    'access_token' => apply_filters( 'myc_script_access_token', $general_settings['myc_access_token'] ),

    For example:
    function myc_set_access_token( $access_token) {
    if ( is_home() ) { // add different access token for home page
    $access_token = ‘djkdsk378dshdsndsi8sdids’; // new dummy access token
    }
    return $agent_token;
    }
    add_filter( ‘myc_script_access_token’, ‘myc_set_access_token’ );

    I have no tested the code above. But hopefully you understand what I mean.
    Daniel

    can you help me to develop dialog flow api v2 plugin in wordpress or if you have sample code for v2 dialog flow pleas share it will help for me. I have no idea about v2.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Enabling multiple agents’ is closed to new replies.