DOCUMENTATION

Shopify Discounts

Shopify Discounts

Basics

For Shopify platform users, our Webhooks feature will allow you to generate unique coupon codes, associated to Price Rules in your Shopify account, for users in your Rejoiner journeys.

To facilitate this, you will need to add a Send Webhook node, which initiates the process. You can then configure the discount code to be available in a subsequent journey node, such as in a Send Email node. This allows you to cause the unique coupon code to be generated and added to your Shopify Price Rule and then sent to your users via email.

In order to accomplish this, you will need to:

1 Get the Price Rule ID for the discount you want the generated codes on

2 Add the Send Webhook node to your journey

3 Add a Wait for Event delivery rule to capture the Inbound Webhook

This will attach the discount code to the user's session and make it available for use in your email template with the template tag:

{{session.metadata.discount_code }}

We'll walk you through each of these steps below.

Getting the Price Rule ID

Access the Rejoiner2 Shopify app

1 Access your Shopify Admin dashboard, and navigate to the Apps section.

2 Next, select the Rejoiner2 app from the list of installed apps.

Update access scopes

If your integration has been installed for some time, you may need to update the access scope permissions for your account.

Find your Price Rule ID

1 Select the Price Rule dropdown from the Active Price Rule IDs section in the Rejoiner2 Shopify app.

2 Select the specific Price Rule for which you wish to associate the generated discount code.

This will display the Price Rule ID for the selected Price Rule, which you should then copy to the clipboard for use in the Send Webhook node.

Add the Send Webhook node

Now you'll need to access your Rejoiner2 account and find the Journey you want to use the discount codes in and edit it. If your Journey is already active, you will need to create a copy in order to modify it. After you've completed the changes, you can then activate the copy, which will replace the existing Journey.

Once you are editing the Journey you want to use the discount codes, you can open the list of available Journey nodes.

And select the Send Webhook node.

Configure the Send Webhook node

1 For the Set Webhook URL value, use:

https://integrations.rejoiner.com/platforms/shopify/webhooks/rejoiner/discount

2 Then Add New Metadata Key for price_rule_id

3 And click Save New Field.

4 For the value of the price_rule_id metadata field, paste in the Price Rule ID you copied earlier.

5 Then click Save Changes.

Get the Inbound Webhook URL

1 Back in the Journey Editor, open the list of available Journey nodes again.

We'll create the node we want to receive the discount code and make it available on the user's session for the rest of the Journey.

In this guide, we'll use a Send Email node, but any type of node can be used.

2 Once editing the selected node, under Set Delivery Rules, select Wait for Event.

3 Choose Inbound Webhook.

4 Click Save Changes.

5This returns you to the Journey Editor again, so you'll need to go back into the node in order to get the Inbound Webhook URL that was generated.

6 To do this, you'll want to open the options for the node you just created or modified, and choose to Edit it.

7 Once back in, you'll be able to copy the Webhook Endpoint URL.

8 And then just Cancel Changes to return to the Journey Editor again.

Add the Destination URI for the Send Webhook node

1 Now you'll want to open the options for the Send Webhook node you created previously.

2Click on Edit.

3 Then Add New Metadata Key for destination_uri.

4 And click Save New Field.

5 Paste in the Webhook Endpoint URL value you copied earlier.

6 And click Save Changes.

Now when your users reach the Send Webhook node in your Journey, the unique discount code will be created in your Shopify account and sent back to the node that is waiting for the Inbound Webhook.

The discount code will be available as a template tag in the waiting node, as well as any subsequent nodes in the journey, as the discount code will now be part of the user's session metadata for the rest of the journey.

Generated code character set and patterns

By default, the generated code uses upper case alphanumeric characters and follows a pattern of ####-####-####-####.

This can be overridden by sending additional metadata parameters on the Send Webhook configuration.

Charset

You can pass a charset metadata key with values of:

value charset
numbers 0123456789
alphabetic abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
alphanumeric 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

Or you can simply pass a set of specific characters to create your own charset.

Pattern

You can pass a pattern metadata key which uses hash (#) as a placeholder for random characters from whatever charset is used. For example, ##-###-### with the alphanumeric charset might result in a code such as P7-ofW-Ka.

Back to Top