Skip to content

fix: update webhook endpoints to api.nfse.io/v2#18

Open
ianchamba wants to merge 1 commit intonfe:masterfrom
ianchamba:fix/update-webhook-endpoints
Open

fix: update webhook endpoints to api.nfse.io/v2#18
ianchamba wants to merge 1 commit intonfe:masterfrom
ianchamba:fix/update-webhook-endpoints

Conversation

@ianchamba
Copy link

@ianchamba ianchamba commented Mar 3, 2026

Summary

  • Webhook API migrated from api.nfe.io/v1/hooks to api.nfse.io/v2/webhooks
  • The old endpoint (/v1/hooks/{id}) returns 404 - webhooks now live at api.nfse.io/v2/webhooks/{id}
  • No company scope needed for webhook endpoints

Changes

lib/NFe/APIResource.php

  • Fixed objectBaseURI() mapping: 'hooks' -> 'webhooks'

lib/NFe/Webhook.php

  • Added endpointAPI() override to use https://api.nfse.io/v2/webhooks as base URL
  • Other resources (companies, service invoices) continue using api.nfe.io/v1 as before
  • Webhook methods kept simple (no company scope parameter)

Test plan

  • Verify NFe_Webhook::fetch($webhookId) hits api.nfse.io/v2/webhooks/{id}
  • Verify NFe_Webhook::create($data) POSTs to api.nfse.io/v2/webhooks
  • Verify other resources (companies, service invoices) still use api.nfe.io/v1

🤖 Generated with Claude Code

@ianchamba ianchamba force-pushed the fix/update-webhook-endpoints branch from 9fc8862 to 6806d8b Compare March 3, 2026 20:16
@ianchamba ianchamba changed the title fix: update webhook endpoints to company-scoped /webhooks fix: update webhook endpoints to api.nfse.io/v2 Mar 3, 2026
@ianchamba ianchamba force-pushed the fix/update-webhook-endpoints branch 2 times, most recently from d5aa952 to d3914d7 Compare March 3, 2026 20:26
- Rename 'hooks' to 'webhooks' in APIResource objectBaseURI mapping
- Override endpointAPI() in NFe_Webhook to use https://api.nfse.io/v2/webhooks
  instead of the deprecated api.nfe.io/v1/hooks endpoint
- Override CRUD methods to handle v2 response structure where webhook data
  is wrapped in "webHook" (camelCase singular) instead of "webhooks"
- Update WebhookTest.php to use v2 response properties (uri instead of url)
- Webhook methods remain simple (no company scope needed)

API v2 response example:
  {"webHook": {"id": "...", "uri": "...", "secret": "...", "status": "Active"}}

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant