Skip to main content Link Search Menu Expand Document (external link)

Slack

The Slack plug-in gives Jancy the ability to “talk” to one or more Slack servers.

Quick Setup

Go here https://api.slack.com/tutorials/tracks/getting-a-token:

  • a slack bot token
  • a slack app-level token with connections:write scope

On the Jancy settings page you can choose Slack from the different sections and input these tokens there.

Detailed Setup

  1. Go here … https://api.slack.com/tutorials/tracks/getting-a-token
  2. Press Create app under “Create a pre-configured app”
  3. In the dialog that appears, select your workspace
  4. In the “Review summary & create your app”, click Edit Configurations and change name under display_information to Jancy Bot
  5. Press the Next button
  6. In the “Welcome to your app’s configuration” press the “Got It” button
  7. Click the “Install to Workspace” button
  8. In the next screen that comes up press the “Allow” button

Quirks

  • If you add the bot to a channel in slack you will have to refresh the channels in your Jancy settings. Slack doesn’t provide an event for the bot getting added to channels
  • Slack doesn’t list private channels, but see below

Getting a bot slack token for an existing bot

  1. Go to Settings & Administration → Manage Apps image
  2. Click Build in the page that opens image
  3. Click the bot you want the token for image
  4. Click Install App image
  5. Copy the token displayed - it starts with xoxb- image

Get App-Level Token

  1. Go to the Basic Information setting in the bot image

  2. Scroll down to the App-Level Tokens section image

  3. Click Generate Token and Scopes button. A dialog will show that looks like the next image

  4. Choose connections:write and name the token whatever you like image
  5. Once the previous dialog closes, click on the new entry on the page like highlighted below image
  6. Copy the token string for later - it starts with xapp- image

Add bot to channels

You must add bots to channels in slack. To do that follow these steps:

  1. In the upper right corner of the slack app you’ll find the button to manage the users, click it: image

  2. Go to the integrations tab and then press the Add an App button image

  3. Find Jancy Bot in the list and click Add image

Adding to Jancy

  1. Go to jancy settings page and choose the Slack option. The page will look like this: image

  2. Click Add a Token and you’ll see a dialog like this: image

Fill out the information that you’ve gathered above, the fields are:

  • Name: you can put anything you want
  • Token: the bot token saved earlier - starts with xoxb-
  • App Token: the app level token saved earlier - starts with xapp-

Adding private channels

In slack you cannot list out the private channels like the public ones, even if the bot is invited to the channel. The bot still can send messages to private channels. On the slack settings panel in Jancy you can press the “Add Private Channel” for the specific token.

To get the channel ID you need to go to your slack app. Right click the channel. Choose View Channel Details. Scroll to the bottomw of the window that opens and use the copy button to get the channel ID: image

Then add it by pressing the button as shown: image

Then put the channel ID and name of the channel in the inputs

Custom Formats

You can now customize the default format on a provider to provider basis. When adding a new Slack provider for Namath you will be able to choose what fields to see.

Click the Edit button

image

A new window will appear:

image

Also, you can now create your own custom slack formatter by creating a JYL file. The format looks like:

<jyl>
  <namath-slack-format name="example1">
    console.log(cart)
    let msgBody = 'This is the example1'
    let event = cart.find((c) => c.id==='event')
    const msgDataBlocks = [
      {"type": "header", "text": {"type": "plain_text", "text": `${event.value}`}},
      {"type": "divider"},
      {"type": "section", "text": {"type": "mrkdwn", "text": "Hello"}},
      {"type": "section", "fields": [
        {"type": event.type, "text": `*${event.name}:* ${event.value}`}
      ]
      }
    ]
    return {msgDataBlocks, msgBody}
  </namath-slack-format>
</jyl>

It is provided the follow parameters:

  • cart is a cart an array of objects that will have the following fields, each field is an object with id and value keys e.g. {id:'uuid', value:'128ksnir'}:
    • uuid - the unique ID of the cart
    • tab - information about the tab the cart is from
    • row - the row
    • section - the section
    • seats - the seats in a string
    • event - the event name
    • venue - the venue name
    • quantity - the total number of tickets
    • currency - the format of the currency (USD)
    • total - the total cost of the cart
    • tax - the tax associated with the cart
    • costPerTicket - the cost of only the ticket (not including tax and fees)
    • dateTime - the date and time of the event as a formatted string
    • oddEven - if the seats are odd/even
    • deliveryMethod - the delivery method of the tickets
    • isInsured - boolean if insurance is selected
    • marketplace - the marketplace the ticket is coming from
    • feeAndCostPerTicket - the cost of each ticket including the tax and fees
    • ticketType - the type of the ticket
    • feesPerTicket - the amount of fees per tickets
    • seatMapURL - the url for the image of the seat map - sometimes this is corrupt and cannot be viewed
    • ticketcount_data - data from the ticketcount plugin, may or may not be null
    • jancyUser - a string representing the user logged into jancy
    • jancyUsername - the name that you can set in the jancy settings to show instead of the jancy account email
    • quantity - the full amount of tickets in the cart
    • accountEmail - the email of the user logged into the marketplace
    • profileName - the name of the profile in use if any
    • groupName - the name of the profile group
  • cartObj - this is a simple version of the cart. It has no name or anything associated with it. It is just an object. e.g. cartObj.row will give you the row
  • jancy - (Jancy object)
  • require - the require library

It must return a Javascript object with msgDataBlocks and msgBody

You can choose it when you create a new provider:

image