-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify the code using struct #4
Simplify the code using struct #4
Conversation
Now payload is a Struct, it's not needed to json encode. Unfurling works with images.
@@ -29,50 +27,33 @@ type Attachment struct { | |||
Fields []*Field `json:"fields"` | |||
} | |||
|
|||
type Payload struct { | |||
Parse string `json:"parse,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please format this with go fmt
?
Except for that one comment - the code doesn't seem to be formatted using |
func Send(webhookUrl string, proxy string, payload map[string]interface{}) []error { | ||
data, _ := json.Marshal(payload) | ||
func Send(token string, proxy string, payload Payload) []error { | ||
webhookUrl := fmt.Sprintf("https://hooks.slack.com/services/%v", token) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adrianlzt Just happen to see this, sorry :( Can we please stick with full webhook url instead of just token? That way we can support Slack API Compatible services (like Rocket.Chat, etc.) as well.
Thank you so much for the contribution. |
Now payload is a Struct, it's not needed to json encode.
Unfurling works with images.
Only asks for the token, webhook url is in the code.