@envoy/envoy-integrations-sdk / EnvoyPluginJob
A "job" is an event, like entry_sign_in.
When your plugin handles the event, you can use this job concept
to update the status (e.g. complete, failed, ignored)
as well as attach extra data to the event's subject
(e.g. showing a generated card number in the dashboard for a visitor on entry_sign_in).
• new EnvoyPluginJob(pluginAPI, jobId)
| Name | Type |
|---|---|
pluginAPI |
EnvoyPluginAPI |
jobId |
string |
• Readonly api: EnvoyPluginAPI
• Readonly id: string
▸ attach(...attachments): Promise<void>
Add attachments to this job.
| Name | Type |
|---|---|
...attachments |
EnvoyPluginJobAttachment[] |
Promise<void>
▸ complete(message, ...attachments): Promise<void>
Reports that the job is complete.
Instead of calling this directly, you can return a 200 response from the job's event handler, using {@link EnvoyRequest.send}.
| Name | Type |
|---|---|
message |
string |
...attachments |
EnvoyPluginJobAttachment[] |
Promise<void>
▸ fail(message, reason): Promise<void>
Reports that the job is ignored.
Instead of calling this directly, you can return a 400 response from the job's event handler, using {@link EnvoyRequest.sendFailed}.
| Name | Type |
|---|---|
message |
string |
reason |
string |
Promise<void>
▸ ignore(message, reason): Promise<void>
Reports that the job is ignored.
Instead of calling this directly, you can return a 400 response from the job's event handler, using {@link EnvoyRequest.sendIgnored}.
| Name | Type |
|---|---|
message |
string |
reason |
string |
Promise<void>
▸ update(message, ...attachments): Promise<void>
Updates the job with a new message and attachments.
Can be used to periodically update long-running jobs.
| Name | Type |
|---|---|
message |
string |
...attachments |
EnvoyPluginJobAttachment[] |
Promise<void>