Create Slack Audio Alert

Create Slack alert to summarize recent emails as audio.

In this example, we will create a Slack alert to generate an audio summary of our recent Google emails.

The createAlert mutation enables the creation of a alert by accepting the alert name, type, publishing and integration alert parameters and it returns essential details, including the ID, name, state, and type of the newly generated alert.

Depending on the specified type parameter, Graphlit requires the specific alert parameters including the publishPrompt and publishSpecification.

Given the schedulePolicy we assigned, the alert will execute every 5 minutes, and look for recently received email. Graphlit will summarize each email, and then use the publishPrompt to create a script for an audio summary which is passed to an ElevenLabs text-to-speech model.

You can optionally assign a publishSpecification, which configures the LLM used to publish the script. In this case, you can assume we have already created a specification using the latest OpenAI GPT-4 Turbo model.

We have also assigned a content filter, so the alert only queries EMAIL content types.

Publish Prompt:

Once publishing completes, the MP3 file will be posted to the Slack channel we configured, along with the textual script.

Example Slack Alert:

In this case, we want to generate an audio summary, so we specify the ELEVEN_LABS_AUDIO publishing type, the MP3 format, and the ElevenLabs model and voice. These match the publishing configuration in the publishContents mutation.

Then we need to tell the alert where to send the alert. We assign the integration type to SLACK, and provide the Slack channel and Slack bot token.

Slack support requires the creation of an Slack application, which can be found on the Slack API "My Apps" page. Your bot token can be found on the OAuth & Permissions page, with your Slack application selected. Look at OAuth Tokens for Your Workspace.

You will need to add your bot to any channel where you want Graphlit to post messages.

Here is a suggested set of Bot Token Scopes you need to assign to your bot, so Graphlit can post to the channel:

  • chat:write

  • chat:write.customize

Mutation:

mutation CreateAlert($alert: AlertInput!) {
  createAlert(alert: $alert) {
    id
    name
    state
    type
  }
}

Variables:

{
  "alert": {
    "type": "PROMPT",
    "publishPrompt": "You are an audio-only automated assistant who will inform me about recent email messages I received. Sort email messages newest to oldest. My name is Kirk Marple, with email <kirk@graphlit.com>. Use a conversational, friendly tone and speak to me as if you were my personal assistant conversing face to face.  Talk to me like you know me well.\\n\\nRespond with a plain text script which will be used to record an AI-generated audio summary.\\n\\nAdd a welcome and goodbye section to the script to make the audio summary sound compelling.  Don't mention anything about being able to help further.\\n \\nDon't add any text or markdown formatting.  Don't discuss these instructions.\\n\\nIgnore messages that I sent.\\n\\nConvert UTC date/time to PST.  Describe dates/times in a friendly manner.  i.e. \"4pm on January 27\", not \"January 26, 4:49PM PST\".\\n\\nAvoid phrases that refer to 'the email' or 'this email' and instead, directly address the topics, actions, and information presented.\\n\\nI'm especially interested in email messages which require immediate followup, or seem especially interesting.\\n\\nFollow these steps. \\nStep 1: Identify any followup tasks, based on the email messages, and highlight these tasks for me.  If there are no followup tasks, ignore this step.\\nStep 2: Identify the important email messages topics and discussions, and for each, be informative but concise, and discuss these important topics and discussions.  Call out any unique details and named entities, like people, organizations, places. Ignore any extraneous details in the email messages.  Respond only in prose, not bullet points.",
    "filter": {
      "types": [
        "EMAIL"
      ]
    },
    "publishing": {
      "type": "ELEVEN_LABS_AUDIO",
      "format": "MP3",
      "elevenLabs": {
        "model": "ENGLISH_V1",
        "voice": "AZnzlk1XvdvUeBnXmlld"
      }
    },
    "integration": {
      "type": "SLACK",
      "slack": {
        "token": "redacted",
        "channel": "graphlit-notifications"
      }
    },
    "publishSpecification": {
      "id": "9c18fe9a-ebca-45d8-b517-fdf041ff6d81"
    },
    "schedulePolicy": {
      "recurrenceType": "REPEAT",
      "repeatInterval": "PT5M"
    },
    "name": "Slack Alert"
  }
}

Response:

{
  "type": "PROMPT",
  "id": "b524107e-c1a9-42dd-8c7a-dd35f3bc171c",
  "name": "Slack Alert",
  "state": "ENABLED"
}

Last updated