Gorgias logo
Gorgias logo

All articles

Gorgias rule glossaryUpdated 24 minutes ago

This glossary outlines the options for each block of the WHEN, IF, THEN rule builder. Read on for an overview of the WHEN triggers that determine when a rule fires, the IF/AND/OR/ELSE logic operators that control conditions, the available condition types, and all the possible THEN actions a rule can take.


Requirements


WHEN (triggers)

When building a rule, the first step is to configure the WHEN block. The event(s) in the WHEN block are what cause the rule to fire. Rules only run when their trigger event occurs and all IF conditions are met.

TriggerDescription
Ticket UpdatedRules with this trigger run any time a ticket is changed, including:

  • Ticket created, deleted, or removed from Trash
  • Opened or closed
  • Snoozed
  • Assigned or unassigned
  • Marked or unmarked as spam
  • Tag added or removed
  • Message sent or received
  • Subject updated
  • Customer updated

Note: this trigger does not fire on changes to message intents or message body.

Ticket Assigned To UserRules with this trigger run when a ticket is assigned to user. The rule will not run if the ticket is assigned to a team, unless the team has auto-assignment enabled. Auto-assignment will assign a user, which will then trigger the rule.
Ticket Snooze Delay EndsRules with this trigger run when a ticket's snooze timer expires. You can use this trigger to create time-delayed actions by pairing two rules: the first rule snoozes the ticket for a set duration; the second rule triggers when that snooze ends. For example, to send a chat follow-up if a customer hasn't responded in 15 minutes, create a rule that snoozes the ticket for 15 minutes after every agent message, and the second rule sends a follow-up message when the snooze ends.
New Message In TicketRules with this trigger run every time a new message arrives in a ticket, whether sent by a customer, an agent, or another rule.
Satisfaction Survey RespondedFires when a customer submits a response to a satisfaction survey.

IF, AND, OR, and ELSE

These operators control the relationship between conditions in a rule.

IF

Defines the criteria a ticket must meet for the action stated in the THEN block to run. A rule can technically work with only a WHEN and THEN block, but adding an IF block adds conditions, allowing you to be more specific about the tickets the rule runs for. Clicking an existing IF block shows options to add an AND condition, OR condition, or ELSE block.

AND

When AND is present in a rule, all the listed criteria in it's block must be true for the rule to run.

For example, if your rule is:

IF: message body contains test

AND: message sender email is [email protected]

AND: ticket created date is after 01/01/2021 

The rule will only fire on tickets that contain the word "test", from [email protected], created after January 1, 2021.

OR

When OR is present in a rule, at least one of the listed criteria must be true true for the rule to run.

For example, if your rule is:

IF: message body contains test

OR: message sender email is [email protected]

OR: ticket created date is after 01/01/2021,

The rule will fire on a ticket with the word "test", even if the other two conditions aren't true.

ELSE

ELSE is a fallback branch to determine what the rule does to tickets that don't meet all the conditions. When all of the IF conditions are met, the ELSE branch is ignored. If the IF conditions are not met, the rule moves on to the ELSE branch to take an action.

For example, if your rule is:

IF: message sender email is [email protected]

AND: message body contains test

THEN: add tag test-1

ELSE: add tag not-test

When the rule fires, it can take two actions:

  • Tickets from [email protected] with body test will be tagged tagged test-1
  • All other tickets will be tagged not-test

Rule conditions

When you add an IF/AND/ELSE block to your rule, you'll select the conditions that the rule looks out for. You can configure IF/AND/ELSE blocks with any of the conditions below.

Message conditions


ConditionDescription
Message BodySearches for specific text in the message, including visible hyperlinks in the ticket. Use the following operators to target specific text
  • Contains all of
  • Contains one of
  • Does not contain all of
  • Does not contain any of
  • Starts with / Ends with
  • Is
  • Is not
Message ChannelSelects which channel the message was sent or received on. Use is to target a specific channel or is not to exclude one.
Message Created DateMatches messages created before or after a specific date, during or outside business hours, or within/outside a relative time window (minutes, hours, days, weeks ago).
Message From AgentChecks whether the last message was sent by your team (is true) or a customer (is false). Messages sent from outside of Gorgias are considered agent messages. 

Tip: Use IF message from agent is false with a New Message In Ticket trigger to prevent a rule from firing when your team replies.
Message IntegrationMatches a specific integration. Use this to target a particular connected channel by its integration name.
Message IntentsMatches AI-detected intents in the message.
  • Contains all of
  • Contains one of
  • Does not contain any of
Message PublicChecks whether the message is public or an internal note. 

Tip: Use IF message public is not true to trigger on internal notes.
Message Sent DateMatches the date the message was sent. Options include before/after a specific date or time, within a relative window, or during/outside business hours. Message sent date is empty is useful for catching errors with unsent outgoing messages.
Message SentimentsMatches AI-detected sentiment (positive or negative tone) in the message.
Message ViaMatches the mechanism used to create or deliver a message within Gorgias. Unlike Message Channel (which identifies the platform), Message Via identifies the origin — for example, whether a message was sent from the Gorgias helpdesk UI, generated by a rule, or created through the API. 

Tip: Use this condition to handle messages differently based on how they entered the system, such as preventing rule-generated messages from triggering other rules, or auto-closing tickets only when an agent replies directly from Gorgias.
Message Receiver EmailTriggers when the customer's email (the recipient of your outgoing message) matches a specified address. This only applies when you are sending a message to the customer.
Message Source From AddressMatches the customer's email address on incoming messages. Use this to apply special handling for known addresses — for example, tagging tickets from a VIP customer's email with a VIP tag.
Message Source From NameMatches the sender's name for social media tickets. Matches on the sender's social media account name, not the name in the Gorgias customer profile.
Message Sender EmailTriggers when the email address the message was sent from matches a specified value. This looks at the actual sending address, not the customer profile email.

Ticket conditions


ConditionDescription
Ticket Assignee UserFilters by the agent currently assigned to the ticket.
  • Is / Is not
  • Is empty / Is not empty
Ticket Assignee TeamChecks whether the ticket is assigned to a specific team. A ticket can be assigned to both a user and a team simultaneously, but never to two different users or two different teams.
Ticket Assignee User EmailMatches the email address of the agent assigned to the ticket.
Ticket ChannelDetects the channel of the first message in the ticket. Note: this never changes unless tickets are merged (in which case the oldest message determines the channel). For more precise channel matching, use Message Channel or Message Integration instead.
Ticket Created DateMatches based on when the ticket (first message) was created.
Ticket From AgentChecks whether the ticket was initially created by a Gorgias user (not a customer).
Ticket LanguageMatches the detected language of the first message in the ticket — 54 language options available. The language cannot be identified if multiple languages appear in the same ticket, or if a contact form is in one language while the message body is in another.
Ticket Last Message DateMatches based on the most recent message in the ticket (excluding internal notes).
Ticket Last Received Message DateSame as Ticket Last Message Date, but only counts messages from customers (not agents).
Ticket PriorityMatches based on the ticket's priority level.
Ticket Reopened DateMatches based on when the ticket was last reopened.
Ticket Satisfaction Survey ScoreMatches based on the score the customer submitted in a satisfaction survey.
Ticket Unsnooze DateTargets tickets in snoozed or open status.
  • Is empty
  • Is not empty
Ticket StatusEvery ticket has one of five statuses: Spam, Deleted, Snoozed, Open, or Closed. Deleted tickets cannot trigger rules. Spam tickets cannot currently be targeted (see Ticket Spam above).
  • Is open
  • Is not open
Ticket SubjectMatches the ticket subject line. Useful for auto-closing predictable emails (e.g., out-of-office replies, order delivered notifications), routing specific form submissions, or handling Voice tickets (subject starts with "call from").
Ticket TagsMatches based on tags applied to the ticket.
  • Contains one of
  • Contains all of
  • Does not contain all of
  • Is empty / Is not empty
Ticket FieldsMatches based on the value of a custom Ticket Field.
Ticket ViaIdentifies the platform used to send the first message in a ticket (e.g., email, chat). Like Ticket Channel, this only reflects the first message.

Customer conditions


ConditionDescription
Customer EmailMatches based on a specified customer email value.
Customer FieldsMatches based on the value of a custom Customer Field.
Customer Other IntegrationsTemporarily decommissioned. Under development.
Customer DataTemporarily decommissioned. Under development.

Self Service conditions


These conditions are available to accounts with an AI Agent subscription.

ConditionDescription
Order Management FlowTargets tickets related to Order Management inquiries.
Self-Service StoreDetects tickets created via Order Management in a Help Center connected to your store, so you can tag and prioritize them appropriately.

E-commerce conditions


Shopify — Last Order


ConditionDescription
Created DateTargets customers based on when their last order was placed. Useful for following up on unfulfilled orders (e.g., last order created date is more than 5 days ago).
Financial StatusMatches the payment status of the last order.
Fulfillment StatusMatches the fulfillment status (fulfilled, partially fulfilled, restocked, etc.).
TagsMatches Shopify order tags. Gorgias can't automatically sync Shopify tags, but this condition lets you check for them and act accordingly. This looks at unfulfilled Shopify orders (there may be more than one).
Total PriceMatches the total price of the last order. Use is greater than, is less than, etc. The currency is whatever your Shopify store uses — enter a number only. Example: IF total price of last order is greater than 20 triggers for orders over $20.
Last Fulfillment Created DateTargets tickets based on when the customer's last fulfilled order was created.
Last Fulfillment Shipment StatusMatches the current shipment status of the last fulfillment.
Last Fulfillment StatusMatches the fulfillment status of the current order.
Last Fulfillment Tracking NumberChecks whether the last fulfillment has a tracking number (is empty / is not empty). Useful for auto-replies: send the tracking number when one exists, or notify the customer when no tracking is available.
Shipping Address CountryTriggers based on the country the last order is being shipped to.
Shipping Address ProvinceSame as Shipping Address Country, but for province/state.

Shopify — Customer


ConditionDescription
Created DateTriggers based on when the customer's Shopify profile was created.
Order CountMatches how many orders the customer has placed. Note: order count cannot be 0 — use is less than 1 to target customers who have not yet placed an order.
TagsMatches Shopify customer tags. Use this to transfer tags from Shopify to Gorgias or trigger actions based on customer segments.
Total SpentMatches the total amount the customer has spent across all orders. Useful for flagging high-value customers.

Shopify — Metafields

If you've imported Shopify metafields into your helpdesk, you can use them in rules to trigger when the metafield on the ticket matches the metafield defined in the rule.


Magento 2 — Last Order


ConditionDescription
Date of Last OrderTargets customers based on when their most recent order was placed. Combine with the State condition to catch delayed shipments: e.g., IF date of last order is more than 5 days ago AND state is not completed, closed, or canceled.
Grand TotalMatches the total price of the last order. Currency follows your Magento store's default.
Created DateRefers to the shipping date of the last order. Useful for auto-tagging tickets about delayed deliveries.
StateMatches the order state. Combine with Date of Last Order for shipping delay auto-replies.

Magento 2 — Customer


ConditionDescription
Created DateTriggers based on when the customer's Magento profile was created.

BigCommerce — Last Order


ConditionDescription
Created DateTargets customers based on when their last order was placed.
StatusMatches the status of the last order.
Total PriceMatches the total price of the last order, including tax.
Shipping DateMatches the date the last order was shipped.
Last Order Shipments — Tracking NumberChecks whether the last order shipment has a tracking number (is empty / is not empty).
Last Shipping — CountryTriggers based on the destination country of the last order.
Last Shipping — StateTriggers based on the destination state of the last order.
Last Shipping — CityTriggers based on the destination city of the last order.

BigCommerce — Customer


ConditionDescription
Created DateTriggers based on when the customer's BigCommerce profile was created.

Instagram profile conditions


ConditionDescription
Business Follows CustomerChecks whether your business account follows the customer on Instagram.
Customer Follows BusinessChecks whether the customer follows your business account on Instagram.
Followers CountMatches the customer's Instagram follower count.
UsernameMatches the customer's Instagram username.
VerifiedChecks whether the customer's Instagram account is verified.

THEN (actions)

ActionDescription
Send emailSends an email to specified recipients (To, Cc, Bcc) with a subject and body. Maximum 15 total recipients.
Reply to customerSends a reply to the customer on the ticket.
Add internal noteAdds an internal note to the ticket, visible to agents only.
Apply macroExecutes a predefined macro on the ticket.
Add tagsAdds one or more tags to the ticket without removing existing tags.
Remove tagsRemoves one or more specified tags from the ticket.
Reset tagsReplaces all existing ticket tags with the specified ones.
Set subjectUpdates the ticket subject line.
Set statusChanges the ticket status (e.g., open, closed, snoozed).
Set prioritySets the ticket priority level.
Set ticket fieldSets the value of a custom ticket field.
Set customer fieldSets the value of a custom field on the customer record.
Snooze forSnoozes the ticket for a specified duration. Cannot be used on closed tickets.
Assign agentAssigns the ticket to a specific agent.
Assign teamAssigns the ticket to a specific team.
Distribute to teamsDistributes the ticket across teams.
Delete ticketMoves the ticket to trash.
Hide Facebook commentHides a Facebook comment from public view. Note: excessive use may deactivate your Facebook page.
Like Facebook commentAdds a like to a Facebook comment. Note: excessive use may deactivate your Facebook page.
Exclude ticket from Auto-MergePrevents this ticket from being automatically merged with other tickets.
Exclude ticket from CSATPrevents a CSAT satisfaction survey from being sent for this ticket.

Was this article helpful?
Yes
No