Last active
September 23, 2022 11:48
-
-
Save Lyokolux/defa22aa20210b814b487fe1a9702586 to your computer and use it in GitHub Desktop.
Masterarbeit - PoC for Mattermost in a nuxt environment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { mattermostClient, channel_id } from '~/server/lib/mattermost' | |
const message = { | |
channel_id, | |
message: 'Send from Nitro!', | |
} | |
// SUCCESSFUL: | |
// curl -i -X POST -H 'Authorization: Bearer $MATTERMOST_API_TOKEN' https://<DOMAIN>/api/v4/posts -d '{"message": "Test Nachricht", "channel_id":"$MATTERMOST_API_CHANNEL_ID"}' | |
export default async () => { | |
const response = await mattermostClient.createPost(message) | |
return { | |
response, | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Client4 } from "@mattermost/client" | |
import { endpoint, token } from "./_credentials" | |
const mattermostClient = new Client4() | |
mattermostClient.setUrl(endpoint) | |
mattermostClient.setToken(token) | |
export { | |
mattermostClient | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment