Primechat
API DocumentsWebsiteLog in
  • START HEREđź‘‹
  • FAQ's
  • Pricing Plans
  • Getting Support
  • PLATFORM
  • Registration
  • Overview
  • Workspace & Members
  • CHATBOT GUIDE FOR BEGINNERS
  • Introduction
  • What is a chatbot
  • Benefits & importance
  • Use cases
  • FLOW BUILDER
  • Flow builder overview
  • Field variable
  • Steps
    • Steps
    • Question Step
    • Variable Operation
    • JSON Operation
    • External Request
    • Send Notification
    • Condition Step
    • Split Step
    • Go to Step
  • Sub Flow
    • Sub Flow
    • Workflow
    • Function Flow
  • CHATBOT CHANNELS
    • Omni+Channel Chabot
    • Webchat Chatbot
    • Facebook Chatbot
      • Facebook Lead Generation
    • Instagram Chatbot
    • Telegram Chatbot
    • Slack Chatbot
    • Wechat Chatbot
    • WhatsApp, SMS & Voice ChatBot
      • WhatsApp Cloud API
      • Set Up Facebook App
      • Get Your Webhook From PrimeChat
      • Start With Test Numbers
      • Build WhatsApp Chatbot With Test WhatsApp Number
      • Supported Message Types
      • Template Message
      • How To Use Template Message
      • WABA: Com Bot
    • Google Business Messenger
  • INTEGRATIONS
    • WooCommerce
    • Stripe
  • OPENAI & PRIMECHAT
    • Create chat completion
    • ChatGPT & PrimeChat Use Cases
    • How to fine-tune ChatGPT for your business
    • Generate the chatbot flow using A.I
    • Power up your live chat with the AI assistant
    • Reply to Facebook and Instagram post comments
    • OpenAI embeddings & building your knowledge base
Powered by GitBook
On this page

Was this helpful?

  1. Steps

Variable Operation

PreviousQuestion StepNextJSON Operation

Last updated 1 year ago

Was this helpful?

Built-in operations for variable modification.

There are six types of variables:

Type

Storage

Example

Operation

Text

letters, words, sentences...

Hi, PrimeChat.

cutting, change case, encode, decode...

Number

number

123.45

+ - x Ă·, mod, power, log, root, round...

Boolean

either "yes" or "no"

yes

assign

Date

date

2021-03-30

format, add months/weeks/days

DateTime

date and time

2021-03-30 16:52:00

format, add months/weeks/days/hours/minutes

JSON

a series of variables

{"name":"jack", "age":"10"}

load, get, update, remove, count, sum, average, sort, shuffle, reverse...

Click "Basic Actions" in the Action step, and here are the "Set Variable Value" and "Clear Variable Value".

Clear Custom Field / Clear JSON

To clear text, number, boolean, date, datetime variables, please use the Clear Custom Field action.

To clear JSON variable, please use the Remove All Items operation in the JSON Operation.

Input Value

"input value" operation is used to assign value to a variable. This operation works for any variable type.

"input value" for text variables can be used to connect several text variables. See the picture below for where to put the original value and the operated value.

Math Formula

With this operation, you can now do formula calculation directly in the Action Step - "Set Variable Value" and Condition Step - "Value".

Math operations and function supported:

+, -, *, e, pi, PI, abs(), min(), max(), ceil(), floor(), log(), pow(), round(), sqrt(), sin(), cos(), tan()

If the formula is invalid, the system will return 0 to the number variable and empty to the text variable.

Set Text Variable

Trim Text

Description

e.g. Before

e.g. After

remove spaces before or after the text

" abc "

"abc"

Sub String

Description

e.g. Before

e.g. After

get part of the text

"Hi, Sendly!"

"Sendly"

The index starts from 0. Every character counts, including space and punctuation.

Replace string / replace string case sensitive.

Description

e.g. Before

e.g. After

replace part of the text

"Hi, primechat!"

"Hello, Primechat!"

In case sensitive situations, you have to put exactly "Hi" rather than "hi", "HI" or "hI".

To lower / upper case

Type

e.g. Before

e.g. After

to lower case

"Hi, Primechat!"

"hi, primechat!"

to upper case

"Hi, Primechat!"

"HI, PRIMECHAT!"

Generate random text

Description

e.g. Before

e.g. After

as the name

"code: XXXX-####-xxxx"

"code: UBWT-3657-lkzb"

This feature is useful when you need to generate one-time verification code or reference code.

URL Encode / Decode

Type

e.g. Before

e.g. After

encode

"Hi, Primechat!"

"Hi%2C%20Primechat!"

decode

"Hi%2C%20Primechat!"

"Hi, Primechat!"

Base 64 encode / decode

Description

e.g. Before

e.g. After

encode

"Hi, Sendly!"

"SGksIFVDaGF0IQ=="

decode

"SGksIFVDaGF0IQ=="

"Hi, Sendly!"

To URL Friendly Slug

Description

e.g. Before

e.g. After

replace spaces with hyphens and remove the rest signs

"it's a good day"

"its-a-good-day"

Get text before/after ...

Description: get part of the text.

Type

e.g. Before

e.g. After

get text before another text

name: Sendly, city: Melbourne

name

get text before last occur of another text

name: Sendly, city: Melbourne

name: Sendly, city

get text after another text

name: Sendly, city: Melbourne

Sendly, city: Melbourne

get text after last occur of another text

name: Sendly, city: Melbourne

Melbourne

Set Number Variable

Get text length

Description

e.g. Before

e.g. After

as the name

500.59

6

Generate random number

Description

e.g. Before

e.g. After

as the name

n/a

56

Add / subtract / multiply / divide / modulus / power / natural logarithm / square root

Description

e.g. Before

e.g. After

as the name

7

8

in "natural logarithm", when you are calculating log2(8) = ? put 8 as "Value" and 2 as

"Number".

Round

Description

e.g. Before

e.g. After

as the name

7.8693

7.87

Floor /Ceil

Description: get an approximate integer.

Type

e.g. Before

e.g. After

floor

6.55

6

ceil

6.55

7

Set DateTime Variable

From formatted text

Description

e.g. Before

e.g. After

get DataTime value from formatted text

00:00:00 30th Aug, 2020

2020-08-30 00:00:00

Add minutes / hours / days / weeks / months

Description

e.g. Before

e.g. After

as the name

2021-01-01 00:00:00

2021-01-01 00:01:00