Documentation ¶
Index ¶
- Variables
- func GQLInputToGo(microsoftTeamsChannels []*modelInputs.MicrosoftTeamsChannelInput) []*model.MicrosoftTeamsChannel
- func GetAadGroupIDFromActivity(activity schema.Activity) string
- func GetAccessToken(ctx context.Context, tenantID string) (*oauth2.Token, error)
- func GetChannelSuggestions(workspace *model.Workspace) ([]*model.MicrosoftTeamsChannel, error)
- func GetChannels(tenantID string, teamResponse TeamResponse) ([]*model.MicrosoftTeamsChannel, error)
- func GetOAuthConfigForTenant(tenantID string) (*oauth2.Config, []oauth2.AuthCodeOption, error)
- func MakeAdaptiveCard(templateString []byte, payload interface{}) (map[string]interface{}, error)
- func SendLogAlertsWelcomeMessage(ctx context.Context, alert *model.LogAlert, input *WelcomeMessageData) error
- type BasicTemplatePayload
- type BotAdapter
- type ChannelResponse
- type ErrorAlertTemplatePayload
- type Fact
- type GraphResponse
- type MicrosoftTeamsBot
- func (bot *MicrosoftTeamsBot) SendErrorAlert(channelId string, payload integrations.ErrorAlertPayload) error
- func (bot *MicrosoftTeamsBot) SendErrorFeedbackAlert(channelId string, payload integrations.ErrorFeedbackAlertPayload) error
- func (bot *MicrosoftTeamsBot) SendLogAlert(channelId string, payload integrations.LogAlertPayload) error
- func (bot *MicrosoftTeamsBot) SendMessageWithAdaptiveCard(channelId string, rawTemplate []byte, templateData interface{}) error
- func (bot *MicrosoftTeamsBot) SendMetricMonitorAlert(channelId string, payload integrations.MetricMonitorAlertPayload) error
- func (bot *MicrosoftTeamsBot) SendNewSessionAlert(channelId string, payload integrations.NewSessionAlertPayload) error
- func (bot *MicrosoftTeamsBot) SendNewUserAlert(channelId string, payload integrations.NewUserAlertPayload) error
- func (bot *MicrosoftTeamsBot) SendRageClicksAlert(channelId string, payload integrations.RageClicksAlertPayload) error
- func (bot *MicrosoftTeamsBot) SendTrackPropertiesAlert(channelId string, payload integrations.TrackPropertiesAlertPayload) error
- func (bot *MicrosoftTeamsBot) SendUserPropertiesAlert(channelId string, payload integrations.UserPropertiesAlertPayload) error
- type NewSessionAlertPayload
- type TeamResponse
- type TeamsApp
- type TeamsAppResponse
- type WelcomeMessageData
Constants ¶
This section is empty.
Variables ¶
View Source
var BasicMessageTemplate = []byte(`{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.6",
"body": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"text": "{{.Title}}",
"spacing": "Small",
"horizontalAlignment": "Left",
"verticalContentAlignment": "Center"
},
{
"type": "TextBlock",
"text": "{{.Description}}",
"wrap": true,
"spacing": "Small",
"horizontalAlignment": "Left",
"verticalContentAlignment": "Center"
},
{
"type": "FactSet",
"facts": {{.Facts}}
}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "{{.ActionTitle}}",
"url": "{{.ActionURL}}"
}
]
}`)
View Source
var BotMessagesHandler = activity.HandlerFuncs{ OnMessageFunc: func(turn *activity.TurnContext) (schema.Activity, error) { if strings.EqualFold(turn.Activity.Text, "ping") { return turn.SendActivity(activity.MsgOptionText("POOONGGGG!!!!!!!!!!!!!")) } return schema.Activity{}, nil }, OnConversationUpdateFunc: func(turn *activity.TurnContext) (schema.Activity, error) { if len(turn.Activity.MembersRemoved) > 0 { for _, memberRemoved := range turn.Activity.MembersRemoved { if memberRemoved.ID == turn.Activity.Recipient.ID { return turn.SendActivity(activity.MsgOptionText("highlight.io bot uninstalled successfully!")) } } } if len(turn.Activity.MembersAdded) > 0 { for _, member := range turn.Activity.MembersAdded { if member.ID == turn.Activity.Recipient.ID { return turn.SendActivity(activity.MsgOptionText("👋 Your highlight.io notifications bot has been installed successfully. You can now set a Teams channel as recipient for your alerts.")) } } } return schema.Activity{}, nil }, }
View Source
var ErrorAlertMessageTemplate = []byte(`{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.6",
"body": [
{
"type": "Container",
"style": "{{.ContainerStyle}}",
"items": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"text": "{{.Title}}",
"spacing": "Small",
"horizontalAlignment": "Left",
"verticalContentAlignment": "Center"
},
{
"type": "TextBlock",
"text": "{{.Description}}",
"wrap": true,
"spacing": "Small",
"horizontalAlignment": "Left",
"verticalContentAlignment": "Center"
},
{
"type": "FactSet",
"facts": {{.Facts}}
},
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "ActionSet",
"actions": [
{
"type": "Action.OpenUrl",
"title": "{{.SessionLabel}}",
"url": "{{.SessionURL}}",
"isEnabled": {{.DisplayMissingSessionLabel}}
},
{
"type": "Action.OpenUrl",
"title": "View Error",
"url": "{{.ErrorURL}}"
}
]
}
]
}
]
}
]
},
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "ActionSet",
"actions": [
{
"type": "Action.OpenUrl",
"title": "Resolve Error",
"url": "{{.ErrorResolveURL}}"
},
{
"type": "Action.OpenUrl",
"title": "Ignore Error",
"url": "{{.ErrorIgnoreURL}}"
},
{
"type": "Action.OpenUrl",
"title": "Snooze Error",
"url": "{{.ErrorSnoozeURL}}"
}
]
}
]
}
]
}
]
}
]
}
]
}`)
View Source
var (
MicrosoftGraphUrl = "https://graph.microsoft.com/v1.0"
)
View Source
var NewSessionAlertMessageTemplate = []byte(`{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.6",
"body": [
{{ if .AvatarURL }}
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "Image",
"url": "{{.AvatarURL}}",
"size": "Small",
"style": "Person"
}
],
"width": "auto"
},
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"text": "{{.Title}}",
"width": "stretch",
"spacing": "Small",
"horizontalAlignment": "Left",
"verticalContentAlignment": "Center"
}
]
}
]
},
{{else}}
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"text": "{{.Title}}"
},
{{end}}
{
"type": "TextBlock",
"text": "{{.UserIdentifier}}"
},
{
"type": "FactSet",
"facts": {{.Facts}}
}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "View Session",
"url": "{{.SessionURL}}"
}
]
}`)
View Source
var TrackPropertiesTemplate = []byte(`{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.6",
"body": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"text": "{{.Title}}"
},
{
"type": "TextBlock",
"text": "{{.Description}}"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "Matched Track Properties"
},
{
"type": "TextBlock",
"text": "{{.MatchedValues}}",
"wrap": true,
"width": "stretch",
"spacing": "Small"
}
]
}
]
}
{{ if .RelatedValues }}
,{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"text": "Matched Track Properties"
},
{
"type": "TextBlock",
"text": "{{.RelatedValues}}",
"wrap": true,
"width": "stretch",
"spacing": "Small"
}
]
}
]
}
{{end}}
]
}`)
View Source
var UserPropertiesTemplate = []byte(`{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.6",
"body": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"text": "{{.Title}}"
},
{
"type": "TextBlock",
"text": "{{.Description}}"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"text": "Matched Track Properties"
},
{
"type": "TextBlock",
"text": "{{.MatchedUserProperties}}",
"wrap": true,
"width": "stretch",
"spacing": "Small"
}
]
}
]
}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "{{.ActionTitle}}",
"url": "{{.ActionURL}}"
}
]
}`)
Functions ¶
func GQLInputToGo ¶
func GQLInputToGo(microsoftTeamsChannels []*modelInputs.MicrosoftTeamsChannelInput) []*model.MicrosoftTeamsChannel
func GetAccessToken ¶
func GetChannelSuggestions ¶
func GetChannelSuggestions(workspace *model.Workspace) ([]*model.MicrosoftTeamsChannel, error)
func GetChannels ¶
func GetChannels(tenantID string, teamResponse TeamResponse) ([]*model.MicrosoftTeamsChannel, error)
func GetOAuthConfigForTenant ¶
func MakeAdaptiveCard ¶
Types ¶
type BasicTemplatePayload ¶
type BotAdapter ¶
type ChannelResponse ¶
type ChannelResponse struct { OdataId string `json:"@odata.id"` ID string `json:"id"` CreatedDateTime string `json:"createdDateTime"` DisplayName string `json:"displayName"` Description string `json:"description"` IsFavoriteByDefault bool `json:"isFavoriteByDefault"` Email string `json:"email"` TenantID string `json:"tenantId"` WebUrl string `json:"webUrl"` MembershipType string `json:"membershipType"` }
type GraphResponse ¶
type MicrosoftTeamsBot ¶
func NewMicrosoftTeamsBot ¶
func NewMicrosoftTeamsBot(tenantID string) (*MicrosoftTeamsBot, error)
func (*MicrosoftTeamsBot) SendErrorAlert ¶
func (bot *MicrosoftTeamsBot) SendErrorAlert(channelId string, payload integrations.ErrorAlertPayload) error
func (*MicrosoftTeamsBot) SendErrorFeedbackAlert ¶
func (bot *MicrosoftTeamsBot) SendErrorFeedbackAlert(channelId string, payload integrations.ErrorFeedbackAlertPayload) error
func (*MicrosoftTeamsBot) SendLogAlert ¶
func (bot *MicrosoftTeamsBot) SendLogAlert(channelId string, payload integrations.LogAlertPayload) error
func (*MicrosoftTeamsBot) SendMessageWithAdaptiveCard ¶
func (bot *MicrosoftTeamsBot) SendMessageWithAdaptiveCard(channelId string, rawTemplate []byte, templateData interface{}) error
func (*MicrosoftTeamsBot) SendMetricMonitorAlert ¶
func (bot *MicrosoftTeamsBot) SendMetricMonitorAlert(channelId string, payload integrations.MetricMonitorAlertPayload) error
func (*MicrosoftTeamsBot) SendNewSessionAlert ¶
func (bot *MicrosoftTeamsBot) SendNewSessionAlert(channelId string, payload integrations.NewSessionAlertPayload) error
func (*MicrosoftTeamsBot) SendNewUserAlert ¶
func (bot *MicrosoftTeamsBot) SendNewUserAlert(channelId string, payload integrations.NewUserAlertPayload) error
func (*MicrosoftTeamsBot) SendRageClicksAlert ¶
func (bot *MicrosoftTeamsBot) SendRageClicksAlert(channelId string, payload integrations.RageClicksAlertPayload) error
func (*MicrosoftTeamsBot) SendTrackPropertiesAlert ¶
func (bot *MicrosoftTeamsBot) SendTrackPropertiesAlert(channelId string, payload integrations.TrackPropertiesAlertPayload) error
func (*MicrosoftTeamsBot) SendUserPropertiesAlert ¶
func (bot *MicrosoftTeamsBot) SendUserPropertiesAlert(channelId string, payload integrations.UserPropertiesAlertPayload) error
type NewSessionAlertPayload ¶
type TeamResponse ¶
type TeamResponse struct { OdataId string `json:"@odata.id"` ID string `json:"id"` DisplayName string `json:"displayName"` Description string `json:"description"` }
func GetTeamsFromWorkspace ¶
func GetTeamsFromWorkspace(workspace *model.Workspace) ([]TeamResponse, error)
type TeamsAppResponse ¶
Click to show internal directories.
Click to hide internal directories.