投稿時間:2022-12-29 14:19:34 RSSフィード2022-12-29 14:00 分まとめ(26件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT 気になる、記になる… povo2.0、新規ユーザー向けに「データ使い放題(24時間)」のトッピングを無料贈呈するキャンペーンを開催中(12月31日まで) https://taisy0.com/2022/12/29/166559.html oshikat 2022-12-29 04:06:40
python Pythonタグが付けられた新着投稿 - Qiita 機械学習: パーセプトロン の Python コードを1行1行理解してデータ分類してみた https://qiita.com/haruki-lo-shelon/items/88fd5359de5cc34dcf8b adaline 2022-12-29 13:47:44
python Pythonタグが付けられた新着投稿 - Qiita Pythonの実行環境をソースコードからビルドする https://qiita.com/fyuogpfy/items/aa1b563cce20cc37206a 管理ツール 2022-12-29 13:26:27
js JavaScriptタグが付けられた新着投稿 - Qiita 【備忘】エンジニア歴2年、最近気を付けられるようになってきたこと コーディング編 https://qiita.com/WAKO_program/items/ad23b9f1f277921e39a9 経過 2022-12-29 13:45:43
AWS AWSタグが付けられた新着投稿 - Qiita 【AWS CDK】高権限ロールの利用通知をカスタム Construct 化してみた https://qiita.com/y_matsuo_/items/3c12e4d745dbfe56d4ea awscdk 2022-12-29 13:08:24
GCP gcpタグが付けられた新着投稿 - Qiita AlloyDB とはどんな仕組みなのかを簡単に追ってみた。 https://qiita.com/yoshii0110/items/9a5f0690599e19b7322b alloy 2022-12-29 13:50:53
技術ブログ Developers.IO Listed Providerに対するSPLAライセンス改定に関する私見 https://dev.classmethod.jp/articles/personal-opinion-for-microsoft-spla-license-revision-2022/ listedprovider 2022-12-29 04:48:09
海外TECH DEV Community How to fix the most common mistakes in Git - learn it by breaking it https://dev.to/mohsenkamrani/how-to-fix-the-most-common-mistakes-in-git-learn-it-by-breaking-it-286m How to fix the most common mistakes in Git learn it by breaking itWe all know how awesome Git is in tracking changes simplifying collaboration between multiple developers and streamlining DevOps operations and it does all of that in the simplest ways However not everything in Git is so simple or at least doesn t look so simple until you know how to use Git to deal with them In this tutorial we take a very different approach assuming you know the basics of Git we try to see how to fix very common mistakes we might make working on a project version controlled by Git I describe each scenario and then I ll show you how to fix the issue Before we move on remember you can implement your websites web apps APIs landing pages and much more in no time with DoTenX for free Make sure to check it out and even nominate your work to be showcased DoTenX is open source and you can find the repository here github com dotenx dotenx Let s get started Pushing changes to the wrong branchYou ve made some changes perhaps even deleted a few files and likely added new files commit the changes and push All of a sudden you realise you had checked out your colleague s branch to check something out Oops Let s fix it Let s say we had these files on John s branch And you added a line to b txt and removed a txt First use the git log command to find the commit we want to undo git logf HEAD gt john branch origin john branch bad commitacde add hoyaed origin main main initial commitWe want to undo the commit with sha f so we use git revert git revert fIn your terminal you ll be prompted with the details of the commit and you can just quit it with wq and push the commit generated by revert with git push So far you made John happy but there is a problem which is you lost all your precious work or maybe not Take a deep breath and switch to your branch and use the git cherry pick command to apply the changes from the commit you reverted to your current branch git cherry pick fThings might get a bit complicated here but it s just our friendly conflict Depending on if you had previous changes in your own branch or not you might get one or more conflicts In my case it shows the file b txt is deleted while we just added a line to that file Let s see the changes using git status git statusOn branch my branchYou are currently cherry picking commit f fix conflicts and run git cherry pick continue use git cherry pick skip to skip this patch use git cherry pick abort to cancel the cherry pick operation Changes to be committed deleted a txtUnmerged paths use git add rm lt file gt as appropriate to mark resolution deleted by us b txtFor resolving the merge conflict in such cases I ve found two simple rules If a file is edited and you see conflict marks in the file simply pick the changes you wantIf it s showing a file is deleted and it s causing the conflict just listen to the message in git status use git add rm lt file gt as appropriate to mark resolution I just run git add b txt and the conflicts are resolved git add b txt git cherry pick continuebad commit Conflicts b txt It looks like you may be committing a cherry pick If this is not correct please run git update ref d CHERRY PICK HEAD and try again Please enter the commit message for your changes Lines starting with will be ignored and an empty message aborts the commit On branch my branch You are currently cherry picking commit f Accept the message or change it it s just a Vim doc opened in your terminal and quit editing with wq Don t forget to run git push after this Forgetting to commit staged changes before switching branchesYou make some changes and stage them and accidentally forcefully switch to another branch Yes it happens when you rely too much on commands history First use git fsck to find the change git fsck lost foundChecking object directories done dangling blob adeadaeeabdeSwitch back to your branch and use git show lt id gt to see the content you ve lost git switch my branch git show adeadaeeabdehoyThis is a cool change by mesomethingNow you have your changes and you can put them back where they belong to Undoing a faulty merge conflictYou have merged one branch into another one one or more lines have changed in the same files in both branches and you ve faced merge conflicts So far so good and you resolve the issues by keeping the changes however you want commit the merge and push it The code is deployed and you realise that you weren t meant to merge the changes maybe your branch was buggy or caused some issues Let s simulate the situation first git log in branch branch git logeccfe HEAD gt branch add byeaed origin main main branch initial commitgit log in branch branch git loged HEAD gt branch add yoaed origin main main initial commitNow we merge them and git checkout branch git merge branchAuto merging a txtCONFLICT content Merge conflict in a txtAutomatic merge failed fix conflicts and then commit the result We accept some changes and we pretend it s not what we wanted Let s fix it now First let s find the commit history using git log git log onelinebf HEAD gt branch Merge branch branch into branched add yoeccfe branch add byeaed origin main main initial commitNow we might be facing two different situations There aren t any changes merged into the target branch after the mergeThere are other changes merged into the target branch after the mergeIf you re lucky enough to be in situation simply use git reset not revert to rewrite the history and move the Head to the commit you want git reset Hard edAfter this you have undone the changes with a clean history git log onelineed HEAD gt branch add yoaed origin main main initial commitThis is particularly helpful if you continue the work on your branch to make sure it s in good shape to merge it again although Git will see it as the first time you re merging them If you re not so lucky and there are some changes after your change you need revert your changes git rever m lt merge commit sha gt git revert m ee I merged the branches again that s why the merge commit sha changed After committing the change the history will look like this git log onelineddd HEAD gt branch Revert Merge branch branch into branch ee Merge branch branch into branched add yoeccfe branch add byeaed origin main main initial commitNow everything is back to normal the only problem is that if you want to carry on the work on your branch and fix it and later merge it again you have to revert this revert commit Accidentally deleting a branchYes people do that Actually if you re reading this you might have already deleted your branch so it happens Let s simulate the situation by deleting branch I created before First run git reflog command to find the commit that contains the lost work git reflogaed HEAD gt main origin main HEAD checkout moving from branch to mainddd HEAD commit Revert Merge branch branch into branch ee HEAD commit merge Merge branch branch into branched HEAD reset moving to edbf HEAD reset moving to bfbf HEAD commit merge Merge branch branch into branched HEAD checkout moving from branch to branched HEAD commit add yoaed HEAD gt main origin main HEAD checkout moving from branch to branch Now use git cherry pick with whatever commit that contains your lost work git cherry pick dddFinish the cherry pick as described earlier and you ll recover the lost changes Reverting to an old version of your code that you didn t mean toFor any reason you revert your code but it s not the commit you wanted to bring back Now there are two situations You haven t pushed the revert commitYou have pushed the revert commitFirst let s simulate the situation I ve created a branch with this history git log onelineefccf HEAD gt bad revert Revert Add yo dbdf Add yoa Add hoyaed origin main main branch initial commitNow if you re in the first situation simply run git reset git reset hard Head The history is clean if the revert never happened git log dbdf HEAD gt bad revert Add yoa Add hoyaed origin main main branch initial commitRemember that Head means the immediate parent and is short for Head Now if you have pushed the commit after reverting you can just revert the revert with git revert lt revert commit sha gt or use git cherry pick lt commit before bad revert gt for a cleaner history IMO git revert cae HEAD gt bad revert Revert Revert Add yo ca Revert Add yo dbdf Add yoa Add hoyaed origin main main branch initial commit I reset the change and now try it with cherry pick git cherry pick cbcbfc HEAD gt bad revert Add yocbc Revert Add yo dbdf Add yoa Add hoyaed origin main main branch initial commit Accidentally committing sensitive information e g passwords personal data Oops Did you know that this is one of the most common effective ways hackers use to attack organisations Alright you did what you were not supposed to do let s postpone writing a resignation letter and fix the issue By the way it s really a good idea to use something like git secrets to avoid committing sensitive information in the first place It s not that hard to set up and use but let me know in the comments if you want me to write a tutorial about it Let s simulate the situation first git checkout b b echo secrets gt env production echo randomchange gt gt a txt git add git commit m some good and bad changes git checkout main git merge b git checkout b b echo secrets gt gt env production echo randomchange gt gt a txt git add git commit m again some good and bad changes git checkout main git merge bThis is what the history on the main branch looks like git log onelinefe HEAD gt main b again some good and bad changesbc b some good and bad changesaed origin main branch initial commitNow let s fix it using the git filter branch command to remove the sensitive information from the repository s history git filter branch force index filter git rm cached ignore unmatch env production prune empty tag name filter cat allWARNING git filter branch has a glut of gotchas generating mangled history rewrites Hit Ctrl C before proceeding to abort then use an alternative filtering tool such as git filter repo instead See the filter branch manual page for more details to squelch this warning set FILTER BRANCH SQUELCH WARNING Proceeding with filter branch Rewrite bcfdbaccefdafe seconds passed remaining predicted rm env production Rewrite fefbcfcbefead seconds passed remaining predicted rm env production Ref refs heads b was rewrittenRef refs heads b was rewrittenWARNING Ref refs heads bad revert is unchangedWARNING Ref refs heads branch is unchangedWARNING Ref refs heads john branch is unchangedRef refs heads main was rewrittenWARNING Ref refs heads my branch is unchangedWARNING Ref refs remotes origin john branch is unchangedWARNING Ref refs remotes origin main is unchangedWARNING Ref refs remotes origin my branch is unchangedRef refs stash was rewrittenThis command applies a filter to all commits in the repository and removes the specified file from the history We use force flag to overwrite the existing history and the prune empty flag to remove empty commits that are created as a result of the filter Let s see how it changed the history git log onelinece HEAD gt main b again some good and bad changescec b some good and bad changesaed origin main branch initial commitAs you can see not only the secret file was deleted while keeping everything else in all the branches the history is not modified too Don t forget to push the changes with git push Git is the best friend of a developer and while it protects us from many problems making mistakes is inevitable Working as the maintainer of an open source project DoTenX I have to deal with different challenges related to Git every now and then but at the end of the day unless you really mess up Git always has a solution for you Finally I invite you again to check DoTenX and its repository use it as a modern alternative for Wordpress based on serverless architecture with isolated front end and back end Remember supporting open source is free and starts with adding a ️to the projects you want to grow 2022-12-29 04:33:12
海外TECH DEV Community How to link a Cognito account with a Google account(source code full stack) https://dev.to/aws-builders/how-to-link-a-cognito-account-with-a-google-accountsource-code-full-stack-1o9p How to link a Cognito account with a Google account source code full stack Photo by Flo Karr flo karr IntroductionRecently I worked on a project that required users to be able to sign in with their Google account and users to be able to link their Google account with their Cognito account I found that there is not much information on the internet about how to do this So I decided to write this article to share my experience I will show you how to link a Cognito account with a Google account in the front end and back end Links an existing user account in a user pool DestinationUser to an identity from an external IdP SourceUser based on a specified attribute name and value from the external IdP This allows you to create a link from the existing user account to an external federated user identity that has not yet been used to sign in You can then use the federated user identity to sign in as the existing user account For example if there is an existing user with a username and password this API links that user to a federated user identity When the user signs in with a federated user identity they sign in as the existing user account By default AWS Cognito does not support linking social account google facebook to AWS Cognito user This project is to provide a solution to link social account to AWS Cognito user The solution is to use pre signup trigger to check if the user already exists in the user pool If the user already exists then link the social account to the user If the user does not exist then create a new user in the user pool All the code is available on GitHub You can clone the repo and follow the steps below to run the project Run yarn install in the cdk and webapp folders Rename env sh template to env sh Update the env sh file with your own values GOOGLE CLIENT ID The google client ID GOOGLE CLIENT SECRET The google client secret Run deploy sh to deploy the backend Update the webapp src aws exports js file with the Cognito user pool information Run yarn dev in the webapp folder to start the frontend application How to link a Cognito account with a IDP accountThe key to link a Cognito account with a IDP account is to use the pre signup trigger In the pre signup trigger we can check if the user already exists in the user pool If the user already exists then link the IDP account to the user If the user does not exist then create a new user in the user pool To order to link a Cognito account with a IDP account we need to use the adminLinkProviderForUser API The adminLinkProviderForUser API is used to link an existing user account in a user pool DestinationUser to an identity from an external IdP SourceUser based on a specified attribute name and value from the external IdP This allows you to create a link from the existing user account to an external federated user identity that has not yet been used to sign in You can then use the federated user identity to sign in as the existing user account Below is the code for the pre signup trigger The pre signup trigger is used to check if the user already exists in the user pool If the user already exists then link the IDP account to the user If the user does not exist then create a new user in the user pool export const preSignup PreSignUpTriggerHandler async event PreSignUpTriggerEvent gt console log preSignup event event const triggerSource userPoolId userName request event Note triggerSource can be either PreSignUp SignUp or PreSignUp ExternalProvider depending on how the user signed up incase signup is done with email and password then triggerSource is PreSignUp SignUp incase signup is done with Google then triggerSource is PreSignUp ExternalProvider if triggerSource PreSignUp ExternalProvider if user signed up with Google then we need to link the Google account to the user pool const userAttributes email given name family name request if the user is found then we link the Google account to the user pool const user await findUserByEmail email userPoolId userName example Facebook or Google we need to extract the provider name and provider value from the userName let providerName providerUserId userName split Uppercase the first letter because the event sometimes has it as google or facebook In the call to adminLinkProviderForUser the provider name has to be Google or Facebook first letter capitalized providerName providerName charAt toUpperCase providerName slice if the user is found then we link the Google account to the user pool if user await linkSocialAccount userPoolId userPoolId cognitoUsername user Username providerName providerName providerUserId providerUserId return the event to continue the signup process return event else if the user is not found then we need to create the user in the user pool create a native cognito account const newUser await createUser userPoolId userPoolId email givenName given name familyName family name if newUser throw new Error Failed to create user change the password to change status from FORCE CHANGE PASSWORD to CONFIRMED await setUserPassword userPoolId userPoolId email merge the social and the native accounts await linkSocialAccount userPoolId userPoolId cognitoUsername newUser Username providerName providerName providerUserId providerUserId set the email verified to true so that the user doesn t have to verify the email set the autoConfirmUser to true so that the user doesn t have to confirm the signup event response autoVerifyEmail true event response autoConfirmUser true if the user signed up with email and password then we don t need to do anything return event const linkProviderForUserCommand new AdminLinkProviderForUserCommand UserPoolId userPoolId DestinationUser ProviderName Cognito Cognito is the default provider ProviderAttributeValue cognitoUsername this is the username of the user SourceUser ProviderName providerName Google or Facebook first letter capitalized ProviderAttributeName Cognito Subject Cognito Subject is the default attribute name ProviderAttributeValue providerUserId this is the value of the provider await cognitoIdentityProviderClient send linkProviderForUserCommand By default every user sign up with social identity providers Google Facebook will have a Cognito Subject attribute The Cognito Subject attribute is the unique identifier of the user in the social identity provider We can use the Cognito Subject attribute to link the social account to the Cognito user The Cognito Subject attribute is the same as the sub claim in the ID token Troubleshooting Already found an entry for username exception when linking a userThis is known issue and discussing in this The solution is catch this error in your front end perhaps show a message like Accounts have been successfully linked and then prompt users to re login with Hosted UI This is hacky solution but no other solution at the moment I hope AWS will fix this issue in the future Every user sign in with social identity providers Google Facebook then the email becomes unverifiedThis is very annoying After a user signs in with social identity providers Google Facebook the email address becomes unverified It makes the user have to verify the email address again every time they sign in username and password This is default behavior of AWS Cognito When a user signs up with social identity providers Google Facebook the email address is not verified And it will update every time the user signs in with social identity providers Google Facebook The solution is to use the post signup trigger to verify the email address export const postAuthentication async event PostAuthenticationTriggerEvent gt console log postAuthentication event event set email verified to true so that the user doesn t have to verify the email if event request userAttributes email verified true await updateUserAttributes event userPoolId event userName email verified true return event ConclusionMerge accounts with Cognito User Pools and Identity Providers still too complicated Some developers are not happy with this feature I hope AWS will improve this feature in the future And I hope this article will help you to link a Cognito account with a IDP account You can find the source code of this article in this If you have any questions please leave a comment below I will try to answer your questions Thank you for reading this article 2022-12-29 04:15:00
海外TECH DEV Community OpenLens Deprecated Logs & Shell https://dev.to/abhinavd26/openlens-deprecated-logs-shell-k91 OpenLens Deprecated Logs amp ShellOpenLens is the open source project behind one of the most adopted Kubernetes IDE Lens In simple terms it is nothing less than Lens without its proprietary components OpenLens falls under the MIT license and has been actively maintained by the community and the Lens team The installation of OpenLens is a bit complex as you have to build it from the source but many open source contributors maintain builds depending upon the operating system OpenLens also releases the same release that Lens IDE does and is a mirror image in terms of appearance With the latest release i e v the OpenLens governance team has deprecated some of its best features causing chaos in the open source community In this blog we will talk about the deprecated feature and an alternative solution What is missing on the OpenLens v With the latest release of OpenLens v you won t be able to access logs and the terminal of your Kubernetes workloads nodes attached to the cluster from the IDE by default These extensions are permanently removed from the OpenLens and moved to Lens Desktop Here are some references for the same Now let s dive a bit into the history Lens is by far the most important release from the Lens team that comes with many new additional features but only with the paid subscriptions With the Lens release they talked about their vision and introduced new subscription models primarily in two tiers Lens Personal with limited support and Lens Pro They have also updated their terms and conditions which can be read from their official blog Lens Personal is free to use but comes with limited features and is limited for educational purposes or for startups with less than million in annual revenue or funding The recent OpenLens v release doesn t provide the capability to access logs and shell extensions This has impacted the community and the heavy users who relied on these extensions are looking for ways to resolve this redacted feature They are limited to two options The first is either to use a personal license or to move to the pro version by paying a subscription fee if their organization exceeds the mn revenue or funding criteria The second option is to look for alternatives Users looking for an alternative open source project that can provide them the capability to access real time logs and a shell extension should consider Devtron Introducing Devtron An Open source alternative to OpenLensDevtron is an open source alternative to OpenLens with all your standard features and a lot more The Devtron project is completely open source and offers a much wider range of capabilities over and beyond shell and log extensions It helps you to deploy and manage all your Kubernetes workloads It is built in a modular fashion that comprises of two primary components Kubernetes Dashboard by DevtronDevtron Dashboard with CI CDKubernetes dashboard by Devtron helps you manage the lifecycle of Helm applications and Kubernetes objects associated with the chart circumventing all the complexities and challenges of dealing with Kubernetes directly Read about the challenges that Devtron s Dashboard solves to explore ways you can simplify operations at your organization Why Kubernetes Dashboard by Devtron over other alternativesAdopting Devtron only for bash and log extensions will be throttling the power that Devtron can unleash for your application teams Let s understand how Devtron can become your go to tool for managing your clusters and workloads in Kubernetes Cluster Managementuse your custom images of your favorite tools like ks netshoot busybox helm kubectl from the cluster terminal in the browser Multi cluster enabled Preconfigured RBAC so you don t have to use kubeconfig Dedicated panel to view resource usage detailsWorkload Management grep logs across multiple pods with ease exec into the pods deploy any helm chart or Ks application easy rollback with configurations compare configurations diff manage helm app across multiple clusters easily upgrade helm charts faster debugging of helm charts with resource grouping events manifests logs and a lot more While you are evaluating your options Devtron may be able to tick all of your requirements at one go devtron labs devtron Tool integration platform for Kubernetes 2022-12-29 04:12:37
海外TECH DEV Community Slack Next-gen Platform - "reaction_added" Event Trigger https://dev.to/seratch/slack-next-gen-platform-reactionadded-event-trigger-54i Slack Next gen Platform quot reaction added quot Event TriggerIn this tutorial you ll learn how to use event triggers which do not require channel IDs in your Slack s next generation platform apps An event trigger can be invoked when a specific event occurs in the connected Slack workspace Since each type of event trigger has its data schema for inputs your workflow can receive necessary information from a trigger Also there are two types of event triggers The first one is the one that can capture events across a workspace The example events are channel created A channel was created dnd updated Do not Disturb settings changed for a member emoji changed A custom emoji has been added or changed user joined team A new member has joined and so on Another is the one that can be invoked when events occur in any of the specified channels The example events are message posted A message was sent to a channel reaction added A member has added an emoji reaction to an item user joined channel A user joined a public or private channel user left channel A user left a public or private channel and so on In this tutorial you ll learn the latter type of event reaction added PrerequisitesIf you re new to the platform please read my The Simplest Hello World tutorial first In a nutshell you ll need a paid Slack workspace and permission to use the beta feature in the workspace And then you can connect your Slack CLI with the workspace If all the above are already done you re ready to build your first app Let s get started Create a Blank ProjectWhen you start a new project you can run slack create command In this tutorial you will build an app from scratch So select Blank project from the list slack create Select a template to build from Hello World A simple workflow that sends a greeting Scaffolded project A solid foundational project that uses a Slack datastore gt Blank project A well blank project To see all available samples visit github com slack samples Once the project is generated let s check if slack run command works without any issues This command installs a dev version of your new app into your connected Slack workspace Now your app s bot user is in the workspace and your app has its bot token for API calls cd distracted bison slack run Choose a workspace seratch TEMJU App is not installed to this workspaceUpdating dev app install for workspace Acme Corp ️Outgoing domains No allowed outgoing domains are configured If your function makes network requests you will need to allow the outgoing domains Learn more about upcoming changes to outgoing domains seratch of Acme CorpConnected awaiting eventsIf you see Connected awaiting events log message the app is successfully connected to Slack You can hit Ctrl C to terminate the local app process Define Workflow and TriggerLet s start with defining a simple demo workflow and its link trigger As always save the source code as workflow and trigger ts Workflow Definition import DefineWorkflow Schema from deno slack sdk mod ts export const workflow DefineWorkflow callback id example workflow title Example Workflow input parameters properties All the possible inputs from the reaction added event trigger channel id type Schema slack types channel id user id type Schema slack types user id message ts type Schema types string reaction type Schema types string required channel id user id message ts reaction TODO Add function steps here Trigger Definition import Trigger from deno slack api types ts const trigger Trigger lt typeof workflow definition gt type event Event Trigger name Trigger the example workflow workflow workflows workflow definition callback id event reaction added event trigger event type slack events reaction added channel ids CFBUFC TODO Update this list The condition to filter events filter version Start the workflow only when the reaction is eyes root statement data reaction eyes inputs channel id value data channel id user id value data user id message ts value data message ts reaction value data reaction export default trigger Note that the trigger s event event type must be slack events reaction added There are five possible input values from the trigger To learn the latest list of the inputs refer to the details of the data property on the official documentation page Also the channel ids CDPBYUQUC TODO Update this list part needs to be updated Please note that you must choose a public note that as of this writing only public channels are supported channel to add this workflow and copy its channel ID in the Slack client UI When you click the channel name a popup modal opens After scrolling down to the bottom you ll find the channel there And then add the workflow to manifest ts import Manifest from deno slack sdk mod ts import workflow as DemoWorkflow from workflow and trigger ts export default Manifest name distracted bison description Demo workflow icon assets default new app icon png workflows DemoWorkflow outgoingDomains botScopes commands chat write reactions read required for the reaction added event trigger channels history will use in custom functions later channels join will use in custom functions later Note that not only adding the workflow but also adding the reactions read scope to botScopes is necessary for this event trigger When you use a different even trigger in your app check the required scopes for the trigger here Create an Event TriggerNext you ll use two terminal windows One for slack run command and another for slack triggers create command To register the workflow run slack run command on the first terminal window And then run slack triggers create trigger def workflow and trigger ts on another one You will see the following outputs slack triggers create trigger def example ts Choose an app seratch dev TE distracted bison dev AFNE Trigger created Trigger ID FtEJ Trigger Type event Trigger Name Trigger the example workflow Add to A Message in the ChannelLet s see how the workflow works When you add eyes emoji reaction to any of the messages in the channel you will see the following outputs in the slack run terminal windows slack run Choose a workspace seratch TEMJU distracted bison AFACHPQRUpdating dev app install for workspace Acme Corp ️Outgoing domains No allowed outgoing domains are configured If your function makes network requests you will need to allow the outgoing domains Learn more about upcoming changes to outgoing domains seratch of Acme CorpConnected awaiting events info FnFCVDJ Trace TrGTW Function execution started for workflow function Example Workflow info WfFPXK Trace TrFPFHX Execution started for workflow Example Workflow info FnFCVDJ Trace TrGTW Function execution completed for function Example Workflow info WfFPXK Trace TrFPFHX Execution completed for workflow Example Workflow Try a different emoji reaction such as wave In this case the workflow won t be invoked Access The Channel ContentIf you re familiar with the existing Events API you may be confused with some differences between this next generation platform s event triggers and Events API Events API consistently requires your app s membership in a channel So when your app receives an event it means that your app always has access to the channel content Contrarily with the next gen platform s event triggers your app s workflow can be invoked even when your app s bot user is not invited to the channel where the event happened Let s add a simple function that demonstrates how to enable it to access the channel content to the workflow Add a new file named function ts with the following source code import DefineFunction Schema SlackFunction from deno slack sdk mod ts import FunctionSourceFile from mod ts export const def DefineFunction callback id reply to reaction title Reply to a reaction in a channel source file FunctionSourceFile import meta url input parameters properties channel id type Schema slack types channel id user id type Schema slack types user id reaction type Schema types string message ts type Schema types string required channel id user id reaction message ts output parameters properties ts type Schema types string required ts export default SlackFunction def async inputs client gt requires channels join scope in manifest ts const joinResponse await client conversations join channel inputs channel id if joinResponse error const error Failed to join the channel due to joinResponse error return error requires channels history scope in manifest ts const historyResponse await client conversations history channel inputs channel id latest inputs message ts inclusive true limit if historyResponse error const error Failed to fetch the channel content due to joinResponse error return error const messageText historyResponse messages text Failed to fetch the message text replaceAll n n gt const replyText Hey lt inputs user id gt thanks for adding inputs reaction to the following message n gt messageText requires chat write scope in manifest ts const replyResponse await client chat postMessage channel inputs channel id text replyText if replyResponse error const error Failed to post a message due to replyResponse error return error return outputs ts replyResponse ts To post a message in a public channel chat postMessage API with chat write public scope does not require any additional API calls However if your app needs to know the message text and other details the function calls two Slack APIs conversations join and conversations history to fetch the channel content And then add the function step to the workflow in workflow and trigger ts import def as reply from function ts workflow addStep reply channel id workflow inputs channel id user id workflow inputs user id reaction workflow inputs reaction message ts workflow inputs message ts Try the workflow again You will see the app s bot user automatically joins the channel and then it posts a message including the whole text data of another message in the channel Don t Want to Hard code the channel ids You may wonder if avoiding hard coding the channel ID list in the trigger source code is possible It s completely understandable as hard coding makes the trigger less reusable and hard to manage you must re create the trigger when you add more channels to the list Unfortunately it s not possible to eliminate the channel ID list when you generate a trigger using a source code file However there is an alternative way to create a trigger runtime You can perform some trigger generation modification API calls in your custom function Refer to the official documentation page for more details Also I will publish an article on the topic later in this tutorial series Wrapping UpYou ve learned the following points with this hands on tutorial Define and enable a channel based event triggerThe complete project is available at I hope you enjoy this tutorial As always if you have any comments or feedback please feel free to let me know on Twitter seratch or elsewhere I can check out Happy hacking with Slack s next generation platform 2022-12-29 04:03:38
海外TECH Engadget Twitter went down for thousands of users https://www.engadget.com/twitter-went-down-for-thousands-of-users-045046684.html?src=rss Twitter went down for thousands of usersThousands of Twitter users reported having issues accessing the website tonight on Downdetector Based on people s reports the outage started just before PM Eastern time and reached its peak at around PM We haven t had any issues from our end but reports continued well into the night and is still ongoing for some users Downdetector reports also indicate that most people have had issues accessing the website itself ーonly a fraction had problems loading the social network through its apps nbsp According to The Guardian users who couldn t access the website were met with a message that read something went wrong but don t fret ーit s not your fault Twitter has yet to issue an official statement for the outage The Twitter Support account hasn t tweeted about it and when some users posted about Twitter being broken Elon Musk responded that he wasn t having any trouble loading the social network Works for meーElon Musk elonmusk December On Christmas Eve Musk revealed that he had disconnected one of Twitter s more sensitive server racks but that the social network still works Musk famously purchased Twitter for billion in October months after initiating the acquisition and trying to back out of the deal The company had laid off around half of the workforce and thousands of contractors since then and one former employee told The Washington Post in November that they knew of six critical systems that no longer have any engineers Isik Mater the director of research at internet monitoring service NetBlocks told The New York Times that the problems with Twitter exhibit in multiple countries and are widespread Mater also said that the platform API is affected which serves the mobile app as well as many aspects of the desktop site 2022-12-29 04:50:46
海外科学 NYT > Science US to Require Negative Covid Tests for Travelers From China https://www.nytimes.com/2022/12/28/us/politics/covid-requirements-china-us-travel.html US to Require Negative Covid Tests for Travelers From ChinaAmid concerns about a coronavirus surge in Beijing the Biden administration announced the change in policy for those entering the United States from China including Hong Kong and Macau 2022-12-29 04:36:52
海外ニュース Japan Times latest articles Planes and trains in Japan flooded with New Year’s holiday travelers https://www.japantimes.co.jp/news/2022/12/29/national/new-year-holiday-travelers/ Planes and trains in Japan flooded with New Year s holiday travelersReservations for transportation services are still on a recovery track despite daily coronavirus cases increasing across the country amid the ongoing eighth wave of infections 2022-12-29 13:01:07
海外ニュース Japan Times latest articles Rafael Nadal eager to get back to winning ways after being hindered by injuries in 2022 https://www.japantimes.co.jp/sports/2022/12/29/tennis/nadal-return-winning/ Rafael Nadal eager to get back to winning ways after being hindered by injuries in My main goal now is to regain positive feelings on the court and to be competitive and I hope to do that Nadal said during 2022-12-29 13:26:20
海外ニュース Japan Times latest articles Shogo Taniguchi signs with Qatar’s Al Rayyan https://www.japantimes.co.jp/sports/2022/12/29/soccer/taniguchi-signs-qater/ Shogo Taniguchi signs with Qatar s Al RayyanQatari first division club Al Rayyan officially announced the signing of Japan defender Shogo Taniguchi on Wednesday The year old center back started two matches for Samurai Blue as 2022-12-29 13:06:19
海外ニュース Japan Times latest articles Answers in 2022 encouraged activism, recommended books and provided advice https://www.japantimes.co.jp/life/2022/12/29/people/answers-20-questions-2022-encouraged-activism-literature-provided-lot-advice/ Answers in encouraged activism recommended books and provided adviceThe Questions section discusses people s experiences of Japan in their own words As we emerge from the pandemic an underlying theme in was 2022-12-29 13:35:09
ニュース BBC News - Home Cambodia casino fire: Ten dead in blaze on Thai border https://www.bbc.co.uk/news/world-asia-64113401?at_medium=RSS&at_campaign=KARANGA poipet 2022-12-29 04:27:16
ニュース BBC News - Home The UK year in pictures https://www.bbc.co.uk/news/in-pictures-63917651?at_medium=RSS&at_campaign=KARANGA agency 2022-12-29 04:23:26
ニュース BBC News - Home At this Texas school, every student is a teen mother https://www.bbc.co.uk/news/world-us-canada-64034588?at_medium=RSS&at_campaign=KARANGA school 2022-12-29 04:01:08
ニュース BBC News - Home Goblin mode, permacrisis, gaslighting: What's your word of the year? https://www.bbc.co.uk/news/uk-63910433?at_medium=RSS&at_campaign=KARANGA choices 2022-12-29 04:24:22
ニュース BBC News - Home Esports: How can they keep growing in 2023? https://www.bbc.co.uk/news/entertainment-arts-64002012?at_medium=RSS&at_campaign=KARANGA experts 2022-12-29 04:24:43
ニュース BBC News - Home Half a spoon - the most sentimental items in our kitchens https://www.bbc.co.uk/news/world-63975193?at_medium=RSS&at_campaign=KARANGA kitchen 2022-12-29 04:23:55
ビジネス ダイヤモンド・オンライン - 新着記事 【社説】中国が必要とする欧米製コロナ薬 - WSJ発 https://diamond.jp/articles/-/315519 社説 2022-12-29 13:21:00
北海道 北海道新聞 「ほっともっと」で違法労働 18歳未満が深夜勤務 熊本 https://www.hokkaido-np.co.jp/article/781994/ 全国展開 2022-12-29 13:34:26
ビジネス 東洋経済オンライン 退部者続出!崩壊寸前から「箱根で優勝」できた訳 青学の原監督が悔やむ「3年目の戦略ミス」 | リーダーシップ・教養・資格・スキル | 東洋経済オンライン https://toyokeizai.net/articles/-/637181?utm_source=rss&utm_medium=http&utm_campaign=link_back 東洋経済オンライン 2022-12-29 13:30:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)