Closed hanscl closed 3 years ago
Hey @hanscl, thanks for bringing this up. Just letting you know I'm taking a look at this today and will get back to you shortly.
I just updated the python-anvil
package on PyPI with explicit support for webhook_url
(all lowercase, snake case), so please update to the latest version (1.1.0) to get that working. You can see the usage in the example here: https://github.com/anvilco/python-anvil/blob/master/examples/create_etch_existing_cast.py#L25
Also, indeed you're correct about the models not yet fully supporting extra fields. That was also added in this update, and the docs have it mentioned here: https://python-anvil.readthedocs.io/en/latest/api_usage/#using-fields-that-are-not-yet-supported . That should allow any arbitrary extra fields on all the models, so hopefully that fills in any holes on new features before they're 100% supported on this package.
Let me know if this fixes it for you!
@aalmazan Thanks so much for getting on this issue so quickly. I am indeed able to now specify the webhook when initializing the packet builder, i.e.:
packet = CreateEtchPacket(
name=esign_config["packet_name"],
signature_email_subject=esign_config["email_subject"],
webhook_url=webhookURL,
)
However I do not see the webhook being called when we complete the package. I confirmed that the URL is valid and we see the call coming in from Postman when testing, but in the logs I do not see any calls when completing the esign package (I did also confirm in the Anvil console that the package has been completed).
Lastly, I checked the CreateEtchPacket return dict
and there is no webhookURL
in the structure, not can I see any reference to a packet-specific webhook in the Anvil admin console.
{'data':
{'createEtchPacket':
{'id': *****, 'eid': 'n*****************4', 'name': 'Sample Document',
'detailsURL': 'https://app.useanvil.com/org/fountain-life/etch/n*****************4',
'documentGroup':
{'id': *****, 'eid': 'J*****************9', 'status': 'sent',
'files': [{'name': 'Sample Document', 'type': 'pdf', 'filename': 'Sample Document.pdf'}],
'signers': [
{'id': ******, 'eid': '9*****************p', 'aliasId': 'V*******************B', 'routingOrder': 1,
'name': 'John Doe', 'email': 'johnd@*******.com', 'status': 'sent', 'signActionType': 'embedded'}]}
}
}
}
I don't know if it should be, but thought I'd mention it. I have not worked with anvil webhooks outside of the Python API, so I could be doing something wrong here.
Thanks!
That seems a little weird if the webhook_url
arg is being accepted in CreateEtchPacket
, but isn't being output in JSON. Could it be that you have some compiled Python cache (__pycache__
directories) with old code? Try and clear that out if you haven't already.
Can you also try testing with one of the example scripts (i.e. https://github.com/anvilco/python-anvil/blob/master/examples/create_etch_existing_cast.py)? Also a quick reminder to use the development API key.
At the end of the script, you can use create_payload()
instead:
# Create your packet
# If overriding/adding new fields, use the modified payload from
# `packet.create_payload()`
- res = anvil.create_etch_packet(payload=packet)
+ payload = packet.create_payload()
+ print(payload)
This will show as something like:
(
name='Etch packet with existing template',
signature_email_subject='Please sign these forms',
signers=[
EtchSigner(name='Morgan', email='morgan@example.com',
fields=[SignerField(file_id='introPages', field_id='sig1')],
signer_type='email', id='signer-****', routing_order=1,
redirect_url=None,
accept_each_field=None, enable_emails=None, signature_mode=None)],
files=[EtchCastRef(id='introPages', cast_eid='***')],
is_draft=False,
is_test=True,
data=CreateEtchFilePayload(payloads={}),
signature_page_options={},
webhook_url='https://webhook.site/***/custom',
)
@aalmazan Thanks for the hint to create_payload
first. The returned payload shows the webhook and when I use that payload to create the etch packet the webhook fires on completion.
payload = packet.create_payload()
res_packet = anvil.create_etch_packet(payload=payload)
I really appreciate the quick turnaround on this fix and the assistance to get this working for us. I will close this issue.
No problem! Feel free to reach out here or to our support if you have any other questions or issues.
I have been trying to add an object-specific
webhookURL
to an etch esign packet using the Python library, but it seems that it is not supported. The mutation string returned from the packet builder does contain the full GraphQL mutation query as documented in the API and thus includeswebhookURL
, but the source code of the CreateEtchPacket class does not includewebhook_URL
(for the sake of this issue I am assuming the variable would have an underscore in its definition).Thus, it isn't possible to even pass
webhook_URL
in as named parameter when initializing the packet builder:I tried forcing this by creating a dict and passing it in as the
payload
parameter instead of individual named parameters:Not unexpectedly, this resulted in the following error:
I also checked the Anvil Etch API docs for python and there is no mention of webhook either, so unless I am missing something here then it appears that this is not supported. Obviously we could (and may have to) rewrite our code to use the GraphQL API instead.
Having said that, the use of the Python library is so much neater and one of the reasons that we can develop with Anvil at the speed that we do. The addition of
webhook_URL
to the Python API would be a great feature and much appreciated.