View Source CozyLark.EventSubscription (cozy_lark v0.1.0)
Provides utilities of event subscription:
- resolving the challenge request when configuring the request URL.
- transforming V2.0 events into
CozyLark.EventSubscription.Event
.
Read more at Subscribe to events.
Overview
subscription-process
subscription process
- setup
verification_token
- setup
encrypt_key
- configure the request URL
- add events
- apply for scopes
- 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 thefactors
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: "..."
}}
)