See related
No related articles

Manage Instagram story mentions using a workflow

Last Update: Oct 2024 • Est. Read Time: 3 MIN
To check plan availability, see the pricing page.

Instagram stories allow users to post photos or videos that automatically disappear within 24 hours. This feature includes the @mention option, which allows someone to mention or tag your Instagram Professional account in a story.

If you have Instagram integrated in your instance, these story mentions will be created as Instagram direct messages (IG DMs). 

You may want to process mentions differently from other types of direct messages.

For this, you can use a workflow to manage story mentions.

Who can access this feature?
User typesAdmins can access the Workflows page.


In this article:

Prerequisites

Before following this guide, we recommend that you are comfortable with the basics of using workflows. See Workflows Overview for more information.

Create the workflow

You can create custom workflows from the Kustomer app.

To create a workflow:

  1. Go to Settings> Platform > Workflows.
  2. Select Add Workflow > Custom Workflow. The New Workflow window opens.
  3. Enter a Workflow Title and add your own description for the workflow in the Description field.
  4. Select Create to save the workflow and begin working in the Workflow Editor.

Enter the workflow JSON code

Use the Workflow Editor to paste in the workflow code supplied below. This JSON code will identify story mention messages and allow you to update the conversations those messages are created in.

1. In the Workflow Editor, use the Workflow Optionsto select Edit Workflow JSON.

2. A window opens where you can edit the code for this workflow directly. Select and delete all the current JSON code.

3. Copy the below code block, and paste it into the JSON text field in your Workflow Editor. Then, select Update to dismiss the JSON editor and save the changes to the workflow.

{
  "description": "",
  "name": "instagram-story-mentions",
  "steps": [
    {
      "transitions": [
        {
          "target": "YL7tWDGA3",
          "condition": {
            "op": "contains",
            "values": [
              "/#steps.1.meta.messageType",
              "storyMention"
            ]
          },
          "meta": {
            "name": "Is a Story Mention"
          }
        }
      ],
      "errorCases": [],
      "id": "85csR397j"
    },
    {
      "transitions": [
        {
          "target": "oLHIQR1F7",
          "condition": {
            "op": "exists",
            "values": [
              "/#steps.YL7tWDGA3.id",
              ""
            ]
          },
          "meta": {
            "name": "Conversation Found"
          }
        }
      ],
      "errorCases": [],
      "id": "YL7tWDGA3",
      "action": "kustomer.conversation.find-by-id",
      "params": {
        "id": "/#steps.1.conversation"
      },
      "meta": {
        "displayName": "Find Conversation"
      },
      "appVersion": "kustomer-^1.9.2"
    },
    {
      "transitions": [],
      "errorCases": [],
      "id": "oLHIQR1F7",
      "action": "kustomer.conversation.update",
      "params": {
        "id": "/#steps.YL7tWDGA3.id"
      },
      "meta": {
        "displayName": "Update Conversation"
      },
      "appVersion": "kustomer-^1.9.2"
    },
    {
      "transitions": [
        {
          "target": "85csR397j",
          "condition": {
            "op": "eq",
            "values": [
              "/#steps.1.channel",
              "instagram"
            ]
          },
          "meta": {
            "name": "Is an Instagram Message"
          }
        }
      ],
      "errorCases": [],
      "id": "scM9jq52e"
    }
  ],
  "trigger": {
    "transitions": [
      {
        "target": "scM9jq52e",
        "condition": {
          "op": "eq",
          "values": [
            "/#steps.1.direction",
            "in"
          ]
        },
        "meta": {
          "name": "Is an Inbound Message"
        }
      }
    ],
    "eventName": "kustomer.message.create",
    "id": "1",
    "appVersion": "kustomer-^1.9.2"
  }
}


The workflow will look like the image below.


Customize the workflow

You can add the changes you'd want the workflow to make on the conversation in the Update Conversation step. You can also change this step if you want to update the message or another object instead.

When you're finished, Save all and other workflow changes, and turn the workflow on using the togglethe toggle to activate the workflow.