-2

i'm using dialogflow in application website but now stopped

 readonly toKen = environment.dialogFlow.chatbotAngular;
  readonly client = new ApiAiClient({accessToken : this.toKen});

  conversation = new BehaviorSubject<Message[]>([])
  

  constructor() 
  { 
    const botMessage = new Message('Bienvenue dans votre univers du chatbot,' +
    ' puis-je vous aider ?', 'bot','./assets/media/Awb/chatbot.gif','botcolor');
    this.update(botMessage);
  }


  playAudio()
  {
    let sound = new Audio();
    sound.src = './assets/media/to-the-point-568.ogg';
    sound.load();
    sound.play();
  }

  update(msg : Message)
  {
    this.conversation.next([msg])
  }



  converse(msg : string)
  {

    const userMessage = new Message(msg,'user','./assets/media/users/icon-5359553_1280.png','usercolor');
    this.update(userMessage);

    return this.client.textRequest(msg).then(res =>{

      setTimeout(()=>{
        const speech = res.result.fulfillment.speech;
        const botMessage = new Message(speech, 'bot','./assets/media/Awb/chatbot.gif','botcolor');
        this.update(botMessage);
        this.playAudio();
      }, 5000);

    })
  }

ERROR Error: Uncaught (in promise): ApiAiRequestError: The Dialogflow V1 API is shutting down and can no longer be queried. More details at https://cloud.google.com/dialogflow/docs/release-notes#June_15_2021. Code: 400

Jessica Rodriguez
  • 2,899
  • 1
  • 12
  • 27
rymka
  • 1

1 Answers1

0

As mentioned in the error message, you’ve encountered this issue due to the shutdown of Dialogflow V1 API. With that, you need to migrate your agent to Dialogflow ES or Dialogflow CX to continue working with Dialogflow.

It seems that you want to migrate to Dialogflow ES which uses the V2 API. Kindly note that the request body from Dialogflow V1 API is different from Dialogflow V2 API.

For example, you may check this request body for V2 REST API's detectIntent method that is equivalent to V1 API's /query method.

You may also check the available client libraries for Dialogflow V2 API, and see their respective reference documentations and related resources for installation and guidance.

For webhook, you may see the following documentation for the proper format of request and response.

For Angular applications, you may check this discussion and article on how to implement and use it with Dialogflow V2 API.

Moreover, note that the Client Access Token and Developer Access Token that were used as part of the V1 API authentication process are no longer used or available for use in V2 API.

Instead, interactions with the Dialogflow V2 API depend on the use of service accounts. You may visit the following links for further guidance on setting up your service accounts to migrate any services that may be interacting with Dialogflow's API to V2's authentication method:

Riel
  • 444
  • 2
  • 5
  • I have downloaded the private key JSON file from services, which contains the private key, id. So from that file how can we get the client access token? – rymka Aug 11 '21 at 10:59
  • As mentioned above, note that Dialogflow V2 API now uses a service account instead of a client access token. Once you’ve downloaded the private JSON key, you can now add it in your [environment](https://cloud.google.com/dialogflow/es/docs/quick/setup#auth-env) to provide authentication credentials to your application code. – Riel Aug 12 '21 at 21:27
  • thank you so much for response, Pls Is it possible to explain in a simple way how to use a file? – rymka Aug 13 '21 at 17:15