Giter Club home page Giter Club logo

third-party-integration-dingtalk's Introduction

FC Integrated With Dingtalk Callback Demo

This demo introduces a simple solution to integrate Dingtalk with Function Compute, using Dingtalk http callback to invoke function, and then function can read the Dingtalk Event you subscript. When the events triggered, such as department change、new member join, Dingtalk will send the notification to the function HTTP URL, and then you can process the event accordingly.

Step1: Prepare the environment

  1. Install Funcraft on the local machine. For more information, see installation instructions.
  • Run fun --version to check whether the installation is successful.
  • You need to configure funcraft with your own aliyun access key id and access key secret. Follow the steps in Configure Funcraft .Run fun config to configure Funcraft. Then configure Account ID, Access Key ID, Access Key Secret, and Default region name as prompted.
$ fun config
Aliyun Account ID 1234xxx
Aliyun Access Key ID xxxx
Aliyun Access Key Secret xxxx
Default region name cn-xxxx
The timeout in seconds for each SDK client invoking 300
The maximum number of retries for each SDK client 5
Allow to anonynously report usage statistics to improve the tool over time? (Y/n)

  1. Enter Dingtalk open platform
  • Enter Application-Developing -> Corporation-Inner-Develop -> MiniApp, and create a MiniApp, then record the AppKey.
  • Enter the MiniApp you just created, and go to the Event-Subscription, fill or get the aes_keytoken

Step2: Deploy function

  1. Edit template.yml file to fill the environment variables your_app_key、your_aes_key、your_token
  2. For testing purpose, you can create a logsore for the function, all function logs will be collected to the logstore:
  • Create a Aliyun Logstore on the region according to fun config config。
  • Fill your_project_nameyour_logstore_name on template.yml file。
  1. Run following command on the demo root path:
fun build  # build the demo
fun deploy -y # deploy function

Step3: Apply a custom domain for function

Since the HTTP callback endpoint must be a public network access URL at Dingtalk, so you need to apply a custom domain , and bind the function to the domain path.

Eg: this demo's custom domain http://30612374-1221968287646227.test.functioncompute.com/fc-dingtalk-demo

Step4: Event registration at Dingtalk developer platform

Enter Dingtalk open platform

  1. Enter the MiniApp you just created, and go to the Event-Subscription, fill the Request URL box using the function custom domain.
  2. Click Save button and Dingtalk will send a check_url request to your function, save success means integration is OK.
  3. Open the switch button of the event you want to subscribe.

More information please see Event subscription

Step5: Testing

When a new member join to your corporation, function will receive a hrm_user_record_change event, you can see the function log on the logstore:

third-party-integration-dingtalk's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.