slack api to invite an app to a private channel - slack

i want to invite an app using the python slack client to a private channel .
Tried using :
web_client.conversations_invite(
channel=channel_name,
users= "AppID")
this is giving me the error
The server responded with: {'ok': False, 'error': 'cant_invite', 'errors': [{'ok': False, 'error': 'user_not_found', 'user': 'AXXXXXXXXX'}]}

The AppID is not the same as the UserID. The App/Bot also has a UserID.
To find the UserID:
In slack:
Click on the users name and choose
"Show Profile". Then open the "..." menu and you see the option
"Copy Member-ID"

Related

Youtube upload API : Videos automatically private

I'm using the Youtube API to upload videos.
The videos are uploaded public, but after the upload, they automatically changed to Private.
I've done the approval from the developer console, so the youtube.upload scope has been approved already. I'm only using the scope to upload and nothing else.
Any ideas ? I tried to contact the support, but no luck :(
Edit:
My application has been verified:
And I have the correct scope:
And the code:
let oauth = Youtube.authenticate({
type: "oauth",
client_id:
"client",
client_secret: "secret",
redirect_url: "redirect",
});
oauth.setCredentials(token);
Youtube.videos.insert(
{
resource: {
snippet: {
title: `blabla`,
description: `blabla`,
},
status: {
privacyStatus: "public",
madeForKids: true,
},
},
part: "snippet,status",
media: {
body: fs.createReadStream(`blabla.mp4`),
},
},
(err, data) => {
console.log("Done.");
}
);
Videos: insert
When your application is still in the testing phase and has not been verified by google yet all videos uploaded will be uploaded as private.
Once you have set your application to published and gone though the verification process you will then be abled to upload public videos.
YouTube API Services - Audit and Quota Extension Form
YouTube API Services Terms of Service
July 28, 2020
update
Audit is not verification, these are two different things. You need to apply for an audit. YouTube API Services - Audit and Quota Extension Form

MS Teams bot - create conversation in newly created Group returns 405 BadArgument

I'm trying to create new convesation for just created channel using Nodejs + botframework v4.9.2.
I've
created new Channel using POST https://graph.microsoft.com/beta/teams/${teamId}/channels
new tab using POST https://graph.microsoft.com/beta/teams/${req.teamId}/channels/${req.channelId}/tabs
I can see new channel and tab in Teams UI
trying to create new conversation via Conversations.createConversation from bot sdk, it's basically calling POST https://directline.botframework.com/v3/conversations with passing new channel id and getting 405 BadArgument This channel does not support this operation
I'm running bot locally and proxying via ngrok.
Also I can access GET /v3/conversations.
Updated code
Get Team Memebers GET ${graphUrl}/groups/${teamId}/members
Create new Channel
const createChannelRequest: IGraphCreateChannelBody = {
"#odata.type": "#Microsoft.Teams.Core.channel",
displayName: channelName,
description: `This channel is for incident id : ${incidentId}`,
members: membersIds.map(memberId => (
{
"#odata.type": "#microsoft.graph.aadUserConversationMember",
"user#odata.bind": `https://graph.microsoft.com/beta/users('${memberId}')`,
roles: ["owner"]
}
))
};
return await graphClient.createChannel(teamId, createChannelRequest);
createChannel is basically POST ${graphUrl}/teams/${teamId}/channels
Create new Tab POST ${graphUrl}/teams/${req.teamId}/channels/${req.channelId}/tabs where channelId is createChannelResponse.id
Create new conversation
const client = new BotConnector.ConnectorClient(credentials, {baseUri: serviceUrl});
const {bot} = TurnContext.getConversationReference(activity);
const createConversationResponse = await client.conversations.createConversation({
bot,
activity: incidentActivity,
members: teamMembers.value.map(member => ({
id: member.id,
name: member.displayName
})),
channelData: {
channel: {
id: newIncidentChannelId
},
tenant: {
id: tenantId
}
},
isGroup: true
});
where createConversation fails with 405
[Posting a complete answer, based on the comments above]
There's no need (and it won't work), in the context of Teams, to use createConversation, because the conversation is created the moment the Team/Channel/Group chat itself is created (createConversation exists for other Bot Framework scenarios, and is not applicable for Teams). As a result SendToConversation is the correct operation to use.
As to how to use SendToConversation, there are certain important variables you need to have already your side, and the most common time to get these is when your bot is added to the channel/chat/whatever in the first place. You can read more about that here, but more generally, this is considered something called "proactive" messaging, in Teams, and it's worth reading up on that topic more. Please see here and here as good starting points.

Show search option in Applozic conversatin tab

I am using applozic sidebar plugin with following code.
window.applozic.init({appId: applozicApplicationKey,
userId: currentUser.userId,
userName: displayName,
imageLink : userImage,
email : currentUser.emailId,
contactNumber: '',
desktopNotification: true,
notificationIconLink: 'assets/images/vw-purple-logo-sm.png'
});
And opening chat box with code
$applozic.fn.applozic('loadTab', '');
I want to show search option in conversation tab rather than contact list.
How to achieve this?

how to change the name of the bot header

I need to change the name of [chat] header bot to Askme.
may i know how to change it in Microsoft bot.
Image is attched
Alternatively, if you want to set it at the time of initialization and are using the Botchat.App() setup rather than the iframed version of webchat, you can set this in the parameter object sent to webchat:
BotChat.App({
botConnection: botConnection,
user: { id: '1234', name: 'user'},
bot: { id: 'bot' },
chatTitle: "I'm a custom chat title"
}, document.getElementById("bot"));
The key parameter in this case being chatTitle; other options that can be sent to webchat can be found in the source code right here.
If you are not using the iframe'd webchat, you can just modify the header's .innerHTML like this:
var header = document.getElementsByClassName("wc-header");
header[0].innerHTML = "<span>Askme</span>"

Parse Server Mail gun adapter installation

First off, I am running Parse Server on AWS Elastic Beanstalk.
I see this documentation in the readme file
##### Email verification and password reset
Verifying user email addresses and enabling password reset via email requries an email adapter. As part of the `parse-server` package we provide an adapter for sending email through Mailgun. To use it, sign up for Mailgun, and add this to your initialization code:
```js
var server = ParseServer({
...otherOptions,
// Enable email verification
verifyUserEmails: true,
// set preventLoginWithUnverifiedEmail to false to allow user to login without verifying their email
// set preventLoginWithUnverifiedEmail to true to prevent user from login if their email is not verified
preventLoginWithUnverifiedEmail: false, // defaults to false
// The public URL of your app.
// This will appear in the link that is used to verify email addresses and reset passwords.
// Set the mount path as it is in serverURL
publicServerURL: 'https://example.com/parse',
// Your apps name. This will appear in the subject and body of the emails that are sent.
appName: 'Parse App',
// The email adapter
emailAdapter: {
module: 'parse-server-simple-mailgun-adapter',
options: {
// The address that your emails come from
fromAddress: 'parse#example.com',
// Your domain from mailgun.com
domain: 'example.com',
// Your API key from mailgun.com
apiKey: 'key-mykey',
}
}
});
This doesn't say enough for me though. I am not using an existing express website and I need to know where in the repository to add the mailgun code.
I already have mailgun and have used it in php and I am using this explicitly to reset user passwords.
so again, What file in my parse server folder do I need to add the mailgun adapter?
This is my file structure. If I am being unclear, let me know...
This is where I am at now as far as adding it in. Is this right? My mailgun creds are not in there yet, but I know to do that.
class ParseServer {
constructor({
appId = requiredParameter('You must provide an appId!'),
masterKey = requiredParameter('You must provide a masterKey!'),
appName,
filesAdapter,
push,
loggerAdapter,
logsFolder,
databaseURI,
databaseOptions,
databaseAdapter,
cloud,
collectionPrefix = '',
clientKey,
javascriptKey,
dotNetKey,
restAPIKey,
webhookKey,
fileKey = undefined,
facebookAppIds = [],
enableAnonymousUsers = true,
allowClientClassCreation = true,
oauth = {},
serverURL = requiredParameter('You must provide a serverURL!'),
maxUploadSize = '20mb',
verifyUserEmails = true,
preventLoginWithUnverifiedEmail = false,
cacheAdapter,
emailAdapter: {
module: 'parse-server-simple-mailgun-adapter',
options: {
// The address that your emails come from
fromAddress: 'parse#example.com',
// Your domain from mailgun.com
domain: 'example.com',
// Your API key from mailgun.com
apiKey: 'key-mykey',
}
},
publicServerURL,
customPages = {
invalidLink: undefined,
verifyEmailSuccess: undefined,
choosePassword: undefined,
passwordResetSuccess: undefined
},
parse-server include the mailgun-js module by default so you can use it without any dependency. What you need to do in order to use it is the following:
Create mailgun account and get an ApiKey from there
Include the mail gun simple adapter exactly like how it is included in the code that you provided and just change the values to the relevant values
please notice that the adapter that you add above is only for email verification and password reset. If you want the ability to send an email (e.g. marketing emails, engagement etc.) you can create a cloud code function there you will need to require the mailgun-js module and use the mailgun-js module to send the email exactly like how it is described in here
Then from your client code you will need to trigger this cloud code function and the email will be sent.

Resources