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

How to pass data from one code step to another code step?

Written by Soham Amburle

Updated on December 17th, 2021

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

How do you pass the data from one code step to another?Storing the data in a code stepRetrieving the stored data from the code step

Every time we use a code step, it comes with a code, that enables the code step to function properly. At times, we might have to use multiple code steps, since every code step serves a certain purpose. It is not advisable to have all the functionalities embedded in a single code step as it might get confusing.

It might happen that, you are on a particular code step, and you want to use the data that is stored in another code step, so how do you do that?

How do you pass the data from one code step to another?

The data is stored in the conversation_details variable of a code step. You can pass data from one code step to another using this global variable. conversation_details acts as a common store between all the code steps. The data stored in conversation_details is shared between all the code steps in the bot.

conversation_details is made available to the users in the code step, in the following way - 

conversation_details = body.get('conversation_details')


There are two main steps here, that we need to take care of - 

  • Storing the data in a code step.
  • Retrieving the stored data from the code step.

Storing the data in a code step

Consider, you want to store an email id. You can do it by storing the email id in the conversation_details variable as shown below. You need to give a key and value pair at the time of storing the data.

Here, email_id is the key, and abc@rmail.com is the value.

conversation_details = body.get('conversation_details')


conversation_details["email_id"]="abc@rmail.com"

Retrieving the stored data from the code step

To retrieve the data that has been stored in a code step, assign the conversation_details to a variable, in this case, retrieve_email_id. This way you can retrieve the data from the code step.

conversation_details = body.get('conversation_details')


retrieve_email_id = conversation_details["email_id"]

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • How to share the bot?
  • How to deploy Haptik's bot on Whatsapp?
  • Why are the Menu options not visible on the Production bot?
  • UI elements supported on Telegram
  • How to handle Bot Breaks?

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