Omnichannel for Customer Service – Agent Scripts & Macros (and slugs)

Omnichannel for customer service contains a number of features to help improve agent productivity. In this post I will explore two of these …. Agent scripts and Macros. Plus we’ll see some slugs along the way!

I’m covering the theory of agent scripts and macros in one post as I believe they are concepts that go hand in hand. (As an agent script can be used to trigger a macro.)

I am assuming here that you already understand the basics of Omnichannel for Customer Service. (Sorry.) Before looking into agent scripts you will have installed Omnichannel for Customer Service and configured at least one channel. At that point you will have it basically working, so looking into agent productively gains will be a useful next step.

Enable Productivity Pane

Before you can use agent scripts you will need to enable the productivity pane. This is a panel that shows in the right hand side of Omnichannel for Customer Service. I have show my agent experience below with the pane enabled and expanded. Agents can expand / collapse this panel as they require and within it they will find any agent scripts you have configured.

Tip ….
Notice below how the agent can drop down a list of agent scripts. You could therefore create multiple scripts for different purposes. (I will expand on this concept later in this post, as you might need to control which script shows first.)

Below you can see that as an administrator I have opened the “Omnichannel Administration” app. Within the admin app you will find a group of options which can be used to enhance the agent experience. The first of these options is the productivity pane configuration option. You can simply use this option to enable the pane and also decide if it is expanded by default or not.

Tip: I do like to expand the productivity pane by default. As if I didn’t expand it how would the agents know the scripts are available!

Agent scripts – Overview

Our next step is to define one or more agent scripts. Once your scripts have been created they will be ready to be used to give guidance to agents. (At least they will be once you have defined when they will load, more on that later!)

Each agent script is made up of a number of steps. We have three types of steps.

  1. Text – Simple text steps give the agents prompts.
  2. Macros – Macro steps run macros to perform automations. (More on Macros later!)
  3. Scripts – Script steps link one agent script to another.

You create agent scripts in the omnichannel administration app. You will need to give the script a name, keep in mind that this name will be seen by the users. So make it meaningful!

After you save your agent script you can add your steps. In my example you can see that I’ve added four steps. Notice that my steps have an order, this defines the sequence they will display on the screen to the agent.

Tip: I decided to number mine 20, 30 etc. This means I could easily add extra steps at a later date! (Without needing to renumber the existing ones.)

Text Steps

My first agent script step was a text step. These are the simplest type of step but still very useful. You can see below that all I do is give them a name and enter the text I would like the agent to see.

You can add slugs into the text instructions. (I will mention slugs in more detail later.) But adding “slugs” lets me personalise the scripts. For example, to insert the customer name into the text add ${customerName}.

Scripts Steps

You may want to call an agent script from an agent script. This might allow you to reduce the number of steps in each script and therefore avoid overwhelming the user with loads and loads of options. Below you can see I created a step which called another agent script. In my example I imagined that any steps to be followed at the end of a conversation might sit in a separate script.

To achieve this you simply say the action type is “script” and then select the target script. (So it will be a good idea to create the target script before creating this step!!)

Macro Steps

The next and possibly most powerful type of agent script step is a macro. As the name suggests macros can be used to automate simple functions. This could include many things but searching for a customer or creating an incident might be just two good examples.

I will cover defining the macros in more detail later in this post. As before you create these steps you will need to create your macros!

But creating the step is simple enough. Just give it a name, set the action type of be macro and select the required marco.

Entering a description is optional but might be useful to further explain what the macro will do. As agents will be able to see this description.

Adding scripts to sessions

Once you have created your agent scripts you will need to decide when they should show. It might be (for example) that you have different scripts available for handling customers on web chat compared to say SMS. We can therefore attach one (or more) agent scripts to each session type.

Note: In Omnichannel for Customer Service each workstream links to a template that defines how sessions for the workstream will operate. So you will have at least one session template defined for each channel . But you could have mulitples!

Below you can see that I’ve selected the sessions option. I have then opened my Teams session. (By default I will have a different session definition for each channel I have enabled.)

In my example I have added two agent scripts. It maybe be common to add just one script per session template but you may need to have multiple scripts. The agents can then select which script they wish to access as they deal with customers.

Although you may wish to force one of the scripts to be the script which is loaded by default. For this we create an “auto load script expression”, more on that in a second!

Defining Auto load scripts

As mentioned above we could add multiple scripts into each session. When doing this you may wish to force one to be the default. To do this we use the “Auto Load Script” option. First you tick the box to enable the expression builder, then click the button to open the expression builder.

In my simple example I wanted to show how we might use a “slug” to control which script is loaded based on the queue being used. For example, maybe I have a queue for sales querys and one for customer support. So based on the conversation queue I might want to define which is the most appropriate agent script to use at the start of the chat.

Below you can see I’ve added a condition into my expression builder. I have used the ${queueId} slug to know which queue the conversation is starting from. Notice I have needed to find the GUID of the required queue.

Within the true and false sides of my condition I have added a step that is “Set default agent script”. With this I have simply selected which script to show.

Tip: It might be worth considering that a real world example might be much more complex than this. You can use different slugs and also nest conditions as required.


So you’ve created your agent scripts and linked them to sessions. Now you might want to consider what we can do with macros within the agent script steps ….

I’m not going to attempt to cover all of the possible macro actions we could perform. (Maybe that will be a future post or even two!) For now, I simply want to introduce the concept of Macros and offer you an example.

Macros are just a list of steps that we want to automate. I have shown a very simple example below, I have just one step to open a new form. In my example that will be a case linked to the contact / account I am in conversation with. (I will give some more detail on that shortly.)

You can of course have multiple steps, so this is a very simple example.

As I have already explained I don’t plan to try and explain all the possible actions here. But you can see below that I have quite a few options available. Including actions to search for records, update existing records or open new ones.

Lets look at my actions to create a record in a little more detail. When the user clicks the agent script to run this macro I want a case form to open. And in addition I would like the title of the case to be pre-filled and the case linked to the customer I’m in conversation with. Below you can see that I have given the entity name as “incident”. As I want to create a case!

I can also provide the ID for a specific form to load. This is optional, in my example I only have one case form so I didn’t need to specify this option. But this might be a really useful feature if you need to force using the correct form in the correct circumstance.

Next I wanted to control how certain fields on the case behaved. So I used “show advanced options”. (In my example I wanted to prefill the case title and also the customer lookup.)

In the advanced options I can add field names and then set their values. The values I use can include slugs.

For example, on the title of my case I have added the customer name. And just because I could , I also added the type of customer. (As in a contact or account.) So my case title might actually be something like “Case for Neil Parkhurst (contact)“.

I also needed to set the customer on the case to be linked to the contact or account I have linked to my conversation. I needed to set three attributes for that. Being a lookup I need to the id, type and name fields. So;

  • My customerid is set to ${customerRecordId} slug. This contains the GUID of the customer in my conversation.
  • My customeridtype is set to ${customerEntityName} slug. This will contain the entity type, that being either contact or account.
  • My customeridname is finally set to the actual customer name, so I sued the ${customerName} slug for that.


I guess I should conclude this post by mentioning a little more about slugs. As I have already referenced quite a few you might want to use!

The link below will help you, as Microsoft do provide details of all of the slugs you can use. You may benefit from reviewing this and experimenting with these in your macros.

One cool thing to experiment with might be OData queries. (Maybe that is yet another post I should write.)

Hopefully this post will have been useful for anyone experimenting with agent scripts and macros within Omnichannel for Customer Service. Enjoy.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s