Skip to content

Instantly share code, notes, and snippets.

View heathermhargreaves's full-sized avatar

Heather heathermhargreaves

View GitHub Profile
@heathermhargreaves
heathermhargreaves / gist:e58971e4a8b1457d45f75a18169914f3
Created May 10, 2022 14:07
segment-sentiment-studio-flow.json
{
"description": "A New Flow",
"states": [
{
"name": "Trigger",
"type": "trigger",
"transitions": [
{
"event": "incomingMessage"
},
require('dotenv').config({ debug: process.env.DEBUG });
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.DIRECT_MESSAGES], partials: ['MESSAGE', 'CHANNEL'] });
const fetch = require('node-fetch');
const base64 = require('base-64');
const twilioClient = require('twilio')(process.env.TWILIO_ACCOUNT_SID, process.env.TWILIO_AUTH_TOKEN);
// ---------------------------------------------------------------------------------------------------------------------------
// Discord bot
require('dotenv').config();
const _ = require('lodash');
const Analytics = require('analytics-node');
const analytics = new Analytics(process.env.SEGMENT_KEY);
// ////////////////////////
// //// User Profile //////
// ////////////////////////
let discord_id;
let discord_handle;
const express = require('express')
const app = express()
const port = 4000
require('dotenv').config()
const https = require('https')
const { last } = require('lodash')
const user_id = '902273325076717588' // make this dynamic to the user id from discord
let url = `https://profiles.segment.com/v1/spaces/${process.env.SEGMENT_SPACEID}/collections/users/profiles/${user_id}/traits`
const express = require('express')
const app = express()
const port = 3000
require('dotenv').config()
const _ = require('lodash')
const Analytics = require('analytics-node');
const analytics = new Analytics(process.env.SEGMENT_KEY);
//////////////////////////
////// User Profile //////
{
"description": "Appointment Reminder",
"states": [
{
"name": "Trigger",
"type": "trigger",
"transitions": [
{
"event": "incomingMessage"
},