Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Passing parameters from API to Playbook (Routine)

I have the following API implementation:

 

 

 

 const session = client.projectLocationAgentSessionPath(
      this.projectId,
      this.location,
      this.agentId,
      this.requestData.sessionId
    );

    const request = {
      session,
      queryInput: {
        text: {
          text: this.requestData.query,
        },
        languageCode: this.requestData.languageCode || 'en-US',
      },
      queryParams: {
        parameters: {
          fields: {
            uid: { stringValue: this.requestData.uid },
            conversationId: { stringValue: this.requestData.sessionId },
            token: { stringValue: '1234567890' }
          }
        }
      }
    };
    return client.serverStreamingDetectIntent(request);

 

 

 

Here is my playbook.

ajbarry99_0-1743106158628.png

 

This is not working, how can I pass custom variables into the Playbook from an API integration?

 

 

 

 

 

0 1 65
1 REPLY 1

Hi @ajbarry99

Welcome to the Google Cloud Community!

To integrate custom variables into your Playbook from an API, make sure the variables are correctly included in your API request and appropriately handled within the Playbook.

Here are key considerations that might help you to resolve the issue: 

  1. Check Playbook Expectation -  Verify that the Playbook you are using can recognize and process the uid, conversationId, and token parameters. Confirm the required structure and naming conventions for custom variables in the Playbook's documentation or source code.
  2. Data Types -  Ensure the data types you're sending from your API match the data types defined in your Playbook parameters.
  3. Session Management -  Make sure your sessionId is consistent across multiple turns of the conversation. This is essential for maintaining session state and ensuring the Playbook can access the parameters you're setting.
  4. Test Variations - For instance, try adjusting how parameters are passed, using tests with fewer variables, or adjust their structure to rule out format issues.

For more information about Playbook best practices, you may read this documentation.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.