Outgoing API: error from Awork

Hello!
I’m trying to send a webhook to our chat system, which has been working fine from my system scripts for years…

I created the channel + sent a test:

[marc@whale ~]$ curl -i -X POST -H 'Content-Type: application/json' -d '{"text": "Bonjour, ceci est un texte\nCeci est un autre texte."}' https://f3nix-sarl.kchat.infomaniak.com/hooks/9c8d8cea-2bd1-4edc-94de-5edb0a3e5ad9
HTTP/2 201  
date: Thu, 18 Jul 2024 15:49:16 GMT
content-type: application/json
content-length: 754
x-infomaniak-custom-url-no-rewrite: 1
cache-control: no-cache, private
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
x-version-id: 1.84.3
x-request-id: B9360524913C2D9DBC1B01BB6699397C7D39E652E31
strict-transport-security: max-age=63072000

And I get the expected result:

Now I created de Webhook in Awork :

And I get errors in the aworks’s log :

What did I miss? Is there a more detailed log available?

Thanks in advance for your suggestions and help!

Marc

Hi @masc , what I see in the logs is „Unprocessable Entity“.
The response body is:

{"id":"the_text_field_is_required_when_attachments_is_not_present.","message":"The text field is required when attachments is not present. (and 1 more error)","errors":{"text":["The text field is required when attachments is not present."],"attachments":["The attachments field is required when text is not present."]},"request_id":"144FF5E706052D9DBC1B01BB669940D27D624552E31"}

I hope this helps.

Hi @Sebastian,
thank you for your reply.

I don’t know how to change the contents of the payload because I’m trying the webhook proposed by awork directly, without the possibility of modifying it (see the screenshots in post #1)?

In your opinion, should I open a ticket with awork?

In case of a webhook, the content is defined by us. If the tool you are trying to send this to does not understand the content, i.e. expects a different JSON model, you would have to put something in between that modifies the data to the format the application is expecting. This could either be a tool like Zapier or a self-hosted application.

Ok.
Is it possible to send me the expected json? Or give me the corresponding doc page?
Just to make sure we’re talking about the same thing…

Sure, the webhook documentation is here: Webhooks | awork.com

I recommend using a tool like https://webhookinbox.com/ to see what data you would receive in your case.

The actual API models of the entities can be found here: https://openapi.awork.com/

1 „Gefällt mir“