Sending Slack notifications from Vonage Contact Center

Using Vonage Contact Center (VCC) you can send real-time notifications from an interaction plan to a Slack app or an individual Slack user. You can configure the notifications to be triggered by important events in the interaction plan or in post-interaction processing. Events might include a VIP customer abandoning in a queue, or an agent missing a personal queue call.

To send Slack notifications from VCC, you must firstly create and configure a Slack app in Slack. Then you must configure a Data Connector in VCC to send notifications to that app. You can use a template within the Web Service Data Connector applet. The template will help you configure sending messages to Slack channels.

In this page

Create a Slack app for VCC to send notifications to

Make sure you are logged in to the Slack workspace you want to send Slack notifications to. Go to https://api.slack.com/apps.

Click Create an App then From an app manifest.

Choose the workspace you want to send Slack notifications to. Click Next.

Switch to the JSON tab and enter the app manifest provided below. For information about the app manifest, see Create and configure apps with manifests (Slack help).

Slack app manifest
{
	"display_information": {
		"name": "Vonage Contact Center",
		"description": "An app that allows Vonage Contact Center to post to your Slack workspace",
		"background_color": "#000000"
	},
	"features": {
		"app_home": {
			"home_tab_enabled": false,
			"messages_tab_enabled": true,
			"messages_tab_read_only_enabled": true
		},
		"bot_user": {
			"display_name": "Vonage Contact Center",
			"always_online": true
		}
	},
	"oauth_config": {
		"scopes": {
			"bot": [
				"app_mentions:read",
				"chat:write",
				"chat:write.customize",
				"chat:write.public",
				"groups:write",
				"im:write",
				"links:write",
				"users:write"
			]
		}
	},
	"settings": {
		"event_subscriptions": {
			"bot_events": [
				"app_mention"
			]
		},
		"interactivity": {
			"is_enabled": true
		},
		"org_deploy_enabled": false,
		"socket_mode_enabled": true,
		"token_rotation_enabled": false
	}
}

Click Next and then Create. You will be prompted to install and authorize the app. Click Install to Workspace and then click Allow to give the app permission to access your workspace.

In the left hand menu, click OAuth & Permissions. Copy and save the value in Bot User OAuth Token in the OAuth Tokens for Your Workspace section. You'll need this for the next stage of configuration.

Create a Data Connector that sends notifications to your Slack app

Next you need to create a Data Connector applet in Interaction Plans Architect. For information about creating and configuration the applet to send notifications to your Slack app, perform the following steps:

  1. Create a Data Connector applet. For information about creating an applet, see Creating an applet. Your new Data Connect applet appears.
  2. In Interface in the Interface section, click Web Service. The Action section appears.

  3. Optionally select the applet that the call is routed to if the interface fails in the Interface Failure list.

    An interface failure occurs when the request does not receive a response from the web service. A timeout or a DNS lookup failure, for example, might cause an interface failure. Do not confuse an interface failure with a response with a HTTP error status code. For more information about status codes, see Successful action.
  4. In the Action list in the Action section select Post a message.
    The Request/Response Definition section appears.

  5. In Message Body, paste in the message you'd like to send. Slack provides a tool to help you build your messages—see Block Kit Builder.

    You must add the channel ID to the beginning of the message body, after the first brace ({).

    For example:

    {
       "channel":"A1B2C3D4E",
       ...
    }

    To find channel IDs for channels and individual users, click the name of the channel or user in Slack to open the channel or user details. The channel ID appears at the bottom of the details pop-up window. Click the copy icon.

    Alternatively, get the IDs using the Slack API. For information, see https://api.slack.com/types/channel or https://api.slack.com/types/user.


    You can replace hardcoded values in the message body with data sources to customize messages. For example, you can include individual interaction IDs, account names, dialled numbers, and so on. For example message bodies, see Example messages later in this page.

  6. In OAuth Token, paste the value of Bot User OAuth Token you copied when you created your Slack app in the Create a Slack app for VCC to send notifications to section earlier in this page.
  7. In the Routing section, click the applet that Vonage Contact Center routes the interaction to after the Data Connector applet.
  8. Click Update. Configure the rest of your call plan as required.

Example messages

Data Connector failure

Data Connect applet failure

Message body code for Data Connector failure message
{
  "channel": "$(Slack|UserID)",
  "text": "Data Connector failed",
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "Data Connector 'Slack message' has returned a 500 error ($(Slack|DialledNumber))\n\n *Caller Details* \n *_Phone Number:_* $(Slack|CLID) \n *_Http Response Code:_* 500"
      }
    },
    {
      "type": "divider"
    },
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "Vonage Contact Center"
      },
      "accessory": {
        "type": "image",
        "image_url": "https://www.vonage.com/content/dam/vonage/us-en/resources/iconography/resources_logo.png",
        "alt_text": "Vonage logo"
      }
    }
  ]
}

Queue breakout

Queue timeout

Message body code for queue breakout message
{
  "channel": "$(Slack|UserID)",
  "text": "VCC notification",
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "A VIP customer ($(Slack|DialledNumber)) has left the queue due to a timeout \n\n *Caller Details* \n *_First name:_* $(Contact|First Name) \n *_Account name:_* $(Account|AccountName) \n *_Phone number:_* $(Slack|CLID)"
      }
    },
    {
      "type": "divider"
    },
    {
      "type": "actions",
      "elements": [
        {
          "type": "button",
          "text": {
            "type": "plain_text",
            "text": "$(Contact|First Name)",
            "emoji": true
          },
          "value": "click_me_123",
          "url": "https://my-domain.lightning.force.com/$(Contact|ContactID)"
        },
        {
          "type": "button",
          "text": {
            "type": "plain_text",
            "text": "$(Account|AccountName)",
            "emoji": true
          },
          "value": "click_me_123",
          "url": "https://my-domain.lightning.force.com/$(Account|Id)"
        }
      ]
    },
    {
      "type": "divider"
    },
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "Vonage Contact Center"
      },
      "accessory": {
        "type": "image",
        "image_url": "https://www.vonage.com/content/dam/vonage/us-en/resources/iconography/resources_logo.png",
        "alt_text": "Vonage logo"
      }
    }
  ]
}

Abandoned in queue

Abandoned queue

Message body code for abandoned in queue message
{
  "channel": "$(Slack|UserID)",
  "text": "VCC notification",
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "A VIP customer ($(Slack|DialledNumber)) has abandoned the call without breaking out\n\n *Caller Details* \n *_First name:_* $(Contact|First Name) \n *_Account name:_* $(Account|AccountName) \n *_Phone number:_* $(Slack|CLID)"
      }
    },
    {
      "type": "divider"
    },
    {
      "type": "actions",
      "elements": [
        {
          "type": "button",
          "text": {
            "type": "plain_text",
            "text": "$(Contact|First Name)",
            "emoji": true
          },
          "value": "click_me_123",
          "url": "https://my-domain.lightning.force.com/$(Contact|Id)"
        },
        {
          "type": "button",
          "text": {
            "type": "plain_text",
            "text": "$(Account|AccountName)",
            "emoji": true
          },
          "value": "click_me_123",
          "url": "https://my-domain.lightning.force.com/$(Account|Id)"
        }
      ]
    },
    {
      "type": "divider"
    },
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "Vonage Contact Center"
      },
      "accessory": {
        "type": "image",
        "image_url": "https://www.vonage.com/content/dam/vonage/us-en/resources/iconography/resources_logo.png",
        "alt_text": "Vonage logo"
      }
    }
  ]
}
Support and documentation feedback

For general assistance, please contact Customer Support.

For help using this documentation, please send an email to docs_feedback@vonage.com. We're happy to hear from you. Your contribution helps everyone at Vonage! Please include the name of the page in your email.