Webhook.generate_test_header()
A valid TYS-Signature value, for your own tests.
@staticmethoddef generate_test_header(payload: Union[bytes, str], secret: str, timestamp: Optional[int] = None) -> strParameters
Section titled “Parameters”payloadUnion[bytes, str]RequiredThe body you will send.
secretstrRequiredThe signing secret.
timestampOptional[int]Optional= NoneUnix seconds (default now).
Returns
Section titled “Returns”str: A valid TYS-Signature value.
Example
Section titled “Example”payload = json.dumps({"id": "evt_test", "object": "event", "type": "webhook.test", "data": {}})header = tryyoursize.Webhook.generate_test_header(payload, "whsec_test")const payload = JSON.stringify({ id: "evt_test", object: "event", type: "webhook.test", data: {} });const header = tys.webhooks.generateTestHeader({ payload, secret: "whsec_test" });await fetch("http://localhost:3000/webhooks/tryyoursize", { method: "POST", headers: { "TYS-Signature": header, "Content-Type": "application/json" }, body: payload,});Was this page helpful?
Thank you. We read every answer.