Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Go to Haptik Website
  • Contact Us
  • Home
  • Developer Guides

How to Access Variables From the Code on Output Step

Written by Soham Amburle

Updated on April 19th, 2023

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Getting Started
    Build Deploy Analyse Manage Account Bot Deactivation
  • Bot Building
    Essentials Smart Skills Steps User Messages Bot Responses Entities Connections Customisations User feedback collection Testing Whatsapp Bots NLU Bot Maintenance
  • Smart Agent Chat
    Set up Admin Settings MyChats Section (Agent Inbox) Live Traffic Section Teams Section Archives Section Analytics Plans on Smart Agent Chat
  • Conversation Design
    Design Basics Design Guides Designing for Platforms Designing WhatsApp Bots
  • Developer Guides
    Code Step Integration Static Step Integration Shopify Integration SETU Integration Exotel Integration CIBIL integration Freshdesk KMS Integration PayU Integration Zendesk Guide Integration Twilio Integration Razorpay Integration LeadSquared Integration USU(Unymira) Integration Helo(VivaConnect) Integration Salesforce KMS Integration Stripe Integration PayPal Integration CleverTap Integration Fynd Integration HubSpot Integration Magento Integration WooCommerce Integration Microsoft Dynamics 365 Integration
  • Deployment
    Web SDK WhatsApp Facebook Instagram Sunshine Conversation LINE Google Business Messages Telegram MS Teams Bot as an API iOS SDK Android SDK
  • External Agent Tool Setup
    Zendesk Chat Salesforce Service Cloud Freshchat Zoho NICE CXOne Gorgias
  • Analytics & Reporting
    Intelligent Analytics
  • Notifications
    SMS Notifications Success Measurement
  • Commerce Plus
    Catalog Integration Bot Building Guide Channel Deployments Unified ML Pipeline Documentation
  • Troubleshooting Guides
    Error Messages FAQs
  • Release Notes
+ More

Table of Contents

Accessing Variables 

Every time we add a code step, there is some functionality that is added to it. And to enable the functioning, we use variables for storing the various types of data, like email id, username, user id, etc.

Let us consider this example, wherein a user is trying to create a ticket on the Haptik platform.

 In the above image, we see 5 steps, namely:

  • Create ticket (Code step)
  • Response for external users without platform (Output step)
  • Response for external users with the platform (Output step)
  • System Error (Output step)
  • Try Again (Static step)

So in the above image, the flow goes from Create Ticket step to all the Output steps. 

Whereas, the System Error output steps direct us to the Try again step, which brings us back to Create ticket step. Well, this is a basic flow. 

So, the Create ticket code step will trigger any one of the output steps. It can either trigger Response for external users without platform step, Response for external users with platform step, or System Error step. All of this depends on the conditions that have been added by the user.

These conditions are added in the Connections, which determine which output step would be triggered next. As shown in the image below, if the Variable is Status, and its value is true, then it would trigger the System Error output step.

Similarly, there are conditions specified for other output steps as well.

Accessing Variables 

Since Create Step is the Code step here, we would be using certain code in the code editor for making it functional. Now, the variables that we have used in this code step, if we want to access those variables in the Output steps as well, we would have to follow certain stages. 

  • Navigate to the Create Ticket code step by selecting it. 
  • In the Sample Output JSON format text box, you need to add all the variables that you want to access in the following output steps., as shown in the image below. 

  • Once you have added all the variables that you need, you can select the Output steps.
  • Let's consider the System Error Output step here, and select the Bot response message, as shown in the image below.

  • After selecting the Bot response message, you would be able to edit the text, and you would also see the Add variable button, as shown in the image below.

  • Upon selecting Add variable, you would be able to access all the variables from the code step, that we had previously added in the Sample Output JSON format text box, of the Create Ticket Code step.

  • You can select the required Variables, by tapping the Select button alongside the variable, and it would reflect in the bot response, the message, as shown below.

  • Here, I had selected status, user_type, and name. And you can see at the Left-hand side of the image, the Bot Response message does reflect these variables.

So, this is how you can access the variables from the code on the Output step.

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • What are the Haptik API Requisites
  • How to Integrate an External Bot
  • How to Integrate Webviews on the Bot
  • Different APIs that Can be Used on Conversation Studio

Platform

  • Conversation Studio
  • Smart Skills
  • Advanced NLU
  • Intelligent Analytics
  • Omnichannel
  • Smart Agent Chat
  • Enterprise Security
  • Integrations

Solutions

  • Conversational Commerce
  • Lead Generation
  • Customer Care
  • WhatsApp
  • Conversational IVR
  • Google Business Messages

Industries

  • Retail/ E-Commerce
  • Financial Services
  • Travel & Hospitality
  • Telecom

Knowledge

  • ROI Calculator
  • Reports & Research
  • Case Studies
  • Webinars
  • ISAT
  • Tech Blog
  • Business Blog
  • Resources
  • Haptik v/s Yellow
  • Haptik v/s Liveperson
  • Haptik v/s IBM Watson
  • Haptik v/s Verloop
  • Conversations on AI

Company

  • Why Haptik
  • About Us
  • Careers
  • News & Media
  • Awards & Recognition
  • Contact Us
  • Partnerships
  • Investor Relations

Subscribe

Sign up to recieve the latest updates

Find us on

  • Twitter-footer
  • Linkedin-footer
  • YT-footer
  • Insta-footer
  • G2-footer
  • Facebook-footer

Knowledge Base Software powered by Helpjuice

Copyright © jio Haptik Technology Limited 2021 | Data Security & Privacy Policy | GDPR

North America | Asia Pacific | Africa | enterprise@haptik.ai

Definition by Author

0
0