How to upload file into a directmessage via slash command? - slack

I managed to use my bot to respond a message publicly in a directmessage channel via slash command.
But what I couldn't get it to work is using files.upload in a slashcommand in a directmessage.
my channel id: DQW7XA9FC, the prefix D denotes a directmessage
error that I get:
{
code: 'slack_webapi_platform_error',
data: {
ok: false,
error: 'channel_not_found',
response_metadata: {
scopes: [
'channels:history',
'chat:write',
'groups:history',
'im:history',
'incoming-webhook',
'mpim:history',
'reactions:write',
'workflow.steps:execute',
'files:write',
'app_mentions:read',
'commands'
],
acceptedScopes: [ 'files:write' ]
}
}
}
Any helps would greatly appreciated.

The documentation on the API page states :
By default all newly-uploaded files are private and only visible to
the owner. They become public once they are shared into a public
channel (which can happen at upload time via the channels argument).
Can this be the reason for the error ?

Related

Reference Error {{variable}} is not defined at global in Rest Client in Visual Studio Code

I try to use Rest Client VS Code Extension from Huachao Mao. I created a new profile in my workspace settings
vs-code-workspace.code-workspace
{
"settings": {
"git.ignoreLimitWarning": true,
"rest-client.enableTelemetry": false,
"rest-client.environmentVariables": {
"xyz": {
"host": "http://localhost:8080/",
}
}
}
}
and I'm trying to send the following request
request.http
GET {{restBasePath}}/api/employee
but I'm getting
ReferenceError: host is not defined at global.<anonymous> (c:\Users\dev\request.http:3:20)
at N$ (c:\Users\user\.vscode\extensions\anweber.vscode-httpyac-5.8.3\dist\extension.js:191:43412)
at zCe (c:\Users\user\.vscode\extensions\anweber.vscode-httpyac-5.8.3\dist\extension.js:191:43961)
at c:\Users\user\.vscode\extensions\anweber.vscode-httpyac-5.8.3\dist\extension.js:191:47073
at Jh (c:\Users\user\.vscode\extensions\anweber.vscode-httpyac-5.8.3\dist\extension.js:190:30551)
at Object.V3t [as action] (c:\Users\user\.vscode\extensions\anweber.vscode-httpyac-5.8.3\dist\extension.js:191:47038)
at I2e.<anonymous> (c:\Users\user\.vscode\extensions\anweber.vscode-httpyac-5.8.3\dist\extension.js:1:5703)
at Generator.next (<anonymous>)
at s (c:\Users\user\.vscode\extensions\anweber.vscode-httpyac-5.8.3\dist\extensi...
after I switched environment to xyz and tried to send the request. How to get rid of the error?
You mixed vscode-rest-client with vscode-httpyac. httpyac is an alternative to vscode-rest-client developed by me (see httpyac.github.io). To configure my extension use setting httpyac.environmentVariables. To use vscode-rest-client use codelens Send Request. I would be happy for you to try httpyac, but I would recommend using only one of the two extensions and disabling the other.

CDK/CloudFormation Batch Setup NotStabilized Error

I'm trying to set up a simple Batch Compute Environment using a LaunchTemplate, so that I can specify a larger-than-default volume size:
const templateName = 'my-template'
const jobLaunchTemplate = new ec2.LaunchTemplate(stack, 'Template', {
launchTemplateName: templateName,
blockDevices: [ ..vol config .. ]
})
const computeEnv = new batch.CfnComputeEnvironment(stack, 'CompEnvironment', {
type: 'managed',
computeResources: {
instanceRole: jobRole.roleName,
instanceTypes: [
InstanceType.of(InstanceClass.C4, InstanceSize.LARGE).toString()
],
maxvCpus: 64,
minvCpus: 0,
desiredvCpus: 0,
subnets: vpc.publicSubnets.map(sn => sn.subnetId),
securityGroupIds: [vpc.vpcDefaultSecurityGroup],
type: 'EC2',
launchTemplate: {
launchTemplateName: templateName,
}
},
})
They both initialize fine when not linked, however as soon as the launchTemplate block is added to the compute environment, I get the following error:
Error: Resource handler returned message: "Resource of type 'AWS::Batch::ComputeEnvironment' with identifier 'compute-env-arn' did not stabilize." (RequestToken: token, HandlerErrorCode: NotStabilized)
Any suggestions are greatly appreciated, thanks in advance!
For anyone running into this - check the resource that is being created in the AWS Console - i.e go to aws.amazon.com and refresh the page over and over until you see it created by CF. This gave me a different error message regarding the instance profile not existing (A bit more helpful than the terminal error...)
A simple CfnInstanceProfile did the trick:
new iam.CfnInstanceProfile(stack, "batchInstanceProfile", {
instanceProfileName: jobRole.roleName,
roles: [jobRole.roleName],
});
I faced similar error.
But in my case cdk had created subnetGroups list in cdk.context.json and was trying to use the same in the CfnComputeEnvironment definition.
The problem was; I was using the default vpc and had manually modified few subnets. and cdk.context.json was not updated.
Solved by deleting the cdk.context.json
This file was recreated with correct values in next synth.
Tip for others facing similar problem:
Don't just rely on the error message; watch closely the Cloud-formation Script that's generated from CDK for the resource.

How do I implement a "Settings" section for a custom Teams Message Extension?

I built a small teams message extension which just uses some user input, builds a link from it, and returns a card with a button pointing to that link.
I need to add a Settings section, but I couldn't find proper instructions or a sample for this.
I tried to use this sample as example (which is JS, and I'm using TypeScript), but I could not get it to work.
Relevant portion in my class:
export class MessageExtensionBot extends TeamsActivityHandler {
...
protected handleTeamsMessagingExtensionConfigurationQuerySettingUrl(context: TurnContext, query: MessagingExtensionQuery): Promise<MessagingExtensionResponse> {
return Promise.resolve({
composeExtension: {
type: "config",
suggestedActions: {
actions: [
{
title: "Title",
type: ActionTypes.OpenUrl,
value: "https://" + `${process.env.PUBLIC_HOSTNAME}` + "/settings.html"
}
]
}
}
});
}
protected handleTeamsMessagingExtensionConfigurationSetting(context, settings): Promise<void> {
return Promise.resolve(undefined);
}
process.env.PUBLIC_HOSTNAME points to the temporary ngrok link, smth like xxx-yyy-zzz.ngrok.io.
When I access xxx-yyy-zzz.ngrok.io/settings.html, I get the correct content of that html file
I also added "canUpdateConfiguration": true, in my manifest file, and the Settings link is available.
THE PROBLEM: when I click the Settings link in my custom teams message extension, all I get is a pop-up with the error message Sorry, the setting of this compose extension is not available. Please try again later. and an OK button.
What is wrong/missing in my code ?
Thank you.
We also faced this issue. It is resolved after adding validDomains in the manifest. Please try updating the validDomains in manifest, hope this resolves the issue.

PCEP-SR draft version 6, SR Explicit Route Object/Record Route Object subobjects

I am setting up Segment routing via Pathman-SR with ODL Nitrogen Controller and vMX Juniper routers. To allow this, I have to change IANA subojbects code points, but I am unable to do it...
Followed this documenntations, but still no result:
https://docs.opendaylight.org/en/stable-carbon/user-guide/pcep-user-guide.html#segment-routing
https://test-odl-docs.readthedocs.io/en/latest/user-guide/pcep-user-guide.html
I tried to update configuration via REST API, but when I send PUT request:
/restconf/config/pcep-segment-routing-app-config:pcep-segment-routing-app-config
with the body:
<pcep-segment-routing-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:pcep:segment-routing-app-config">
<iana-sr-subobjects-type>true</iana-sr-subobjects-type>
</pcep-segment-routing-config>
I get the following error:
{
"errors": {
"error": [
{
"error-type": "protocol",
"error-tag": "invalid-value",
"error-message": "URI has bad format. Possible reasons:\n 1. \"pcep-segment-routing-app-config:pcep-segment-routing-app-config\" was not found in parent data node.\n 2. \"pcep-segment-routing-app-config:pcep-segment-routing-app-config\" is behind mount point. Then it should be in format \"/yang-ext:mount/pcep-segment-routing-app-config:pcep-segment-routing-app-config\"."
}
]
}
}
I think there is a typo in the URL in the doc, you have to use /restconf/config/pcep-segment-routing-app-config:pcep-segment-routing-config
You can check this guide for reference:
https://docs.opendaylight.org/projects/bgpcep/en/stable-neon/pcep/pcep-user-guide-active-stateful-pce.html#iana-code-points

Kony service giving 1012 opstatus Request failed error and not giving response

I have a kony sample app where I am trying to do a build and the app has one web service in it for fetching categories of some product. I have the following code also that I wrote:
function GetCategories() {
var inputparam = {
"appID": "bbuy",
"serviceID": "GetCategories",
"catId": "cat00000",
"channel": "rc",
"httpheaders": {}
};
kony.net.invokeServiceAsync("http://192.168.42.134/middleware/MWservlet",inputparam, serv_GetCategoriesCallback);
}
I am getting no response for this. Getting 1012 opstatus and the message is saying "Request failed" error.
kony.net.invokeServiceAsync("http://192.168.42.134/middleware/MWservlet",inputparam, serv_GetCategoriesCallback);
In the above line, you have not given the port number in the MWservlet URL.(e.g. 8080) Give that and check.
Also, make sure all input params are being fed to the service and that they correspond to the exact naming convention followed in the service editor.
Visit :
Find the below link. i hope it gives you a solution
http://developer.kony.com/twiki/pub/Portal/Docs/API_Reference/Content/Network_APIs.htm#net.invo2
Check the mandatory and optional fields of Inputparam

Resources