MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / SendWebhook

Method SendWebhook

webhooks.go:133–152  ·  view source on GitHub ↗

SendWebhook enqueues a webhook notification task using the LedgerForge instance's asynq client. Parameters: - newWebhook NewWebhook: The webhook notification data to enqueue. Returns: - error: An error if the task could not be enqueued.

(newWebhook NewWebhook)

Source from the content-addressed store, hash-verified

131// Returns:
132// - error: An error if the task could not be enqueued.
133func (b *LedgerForge) SendWebhook(newWebhook NewWebhook) error {
134 conf := b.Config()
135
136 if conf.Notification.Webhook.Url == "" {
137 return nil
138 }
139
140 payload, err := json.Marshal(newWebhook)
141 if err != nil {
142 return err
143 }
144 taskOptions := []asynq.Option{asynq.Queue(conf.Queue.WebhookQueue)}
145 task := asynq.NewTask(conf.Queue.WebhookQueue, payload, taskOptions...)
146 info, err := b.asynqClient.Enqueue(task)
147 if err != nil {
148 logrus.Error(err, info)
149 return err
150 }
151 return err
152}
153
154// ProcessWebhook processes a webhook notification task from the queue.
155//

Callers 9

postIdentityActionsMethod · 0.95
postLedgerActionsMethod · 0.95
checkBalanceMonitorsMethod · 0.95
postBalanceActionsMethod · 0.95
TestSendWebhookFunction · 0.95
NewLedgerForgeFunction · 0.95

Calls 3

ConfigMethod · 0.95
EnqueueMethod · 0.80
ErrorMethod · 0.45

Tested by 1

TestSendWebhookFunction · 0.76