View Source CozyLark.EventSubscription (cozy_lark v0.2.0)

Provides utilities of event subscription:

Read more at Subscribe to events.

Overview

subscription-process

subscription process

  1. setup verification_token
  2. setup encrypt_key
  3. configure the request URL
  4. add events
  5. apply for scopes
  6. receive and process events

Utilities provided by this module can be used at step 3 and 6.

supported-events

supported events

The full list of events can be found at Getting Started - Event list.

Only the V2.0 events are supported.

Usage

alias CozyLark.EventSubscription EventSubscription.process_event(payload, config, opts)

about-config

about config

It's a map with following keys:

  • verification_token
  • encrypt_key

about-opts

about opts

It's a keyword list with following keys:

  • security_verification_method - specify the method to verify that the event is sent by Lark Open Platform and not a forgery. Available values are:
    • verification_token
    • {:signature, factors} where the factors is a map with following keys:
      • raw_body
      • timestamp
      • nonce
      • signature

examples

examples

Verify event by :verification_token method, and process event:

process_event(

 payload,
 %{verification_token: "...", encrypt_key: "..."},
 security_verification_method: :verification_token

)

Verify event by :signature method, and process event:

process_event(

 payload,
 %{verification_token: "...", encrypt_key: "..."},
 security_verification_method: {:signature, %{
   raw_body: "...",
   timestamp: "...",
   nonce: "...",
   signature: "..."
 }}

)

More details

Link to this section Summary

Link to this section Functions

Link to this function

receive_event(config, payload, opts)

View Source