Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to respond to webhooks. #838

Merged
merged 10 commits into from
Nov 20, 2023

Conversation

Half-Shot
Copy link
Contributor

Fixes #837

This adds two new features to the generic webhook connection type:

  • The ability to set a response value for webhooks.
  • The ability for connections to choose whether to block on the webhook function before responding.

@Half-Shot Half-Shot requested a review from a team as a code owner November 8, 2023 15:03
@Twi1ightSparkle
Copy link
Contributor

Twi1ightSparkle commented Nov 8, 2023

Hookshot is posting the message twice to Matrix when Wait for webhook function to complete before responding is checked. But looks to be sending the correct data back.

Testing what webhook settings duplicates messages

Screenshot 2023-11-09 at 3 36 06 PM

const responseBody = `
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<notificationsResponse xmlns="http://soap.sforce.com/2005/09/outbound">
<Ack>true</Ack>
</notificationsResponse>
</soapenv:Body>
</soapenv:Envelope>
`.trim();

result = {
    empty: false,
    msgtype: 'm.text',
    plain: message,
    version: 'v2',
    webhookResponse: {
        body: responseBody,
        contentType: 'application/xml',
        statusCode: 418,
    }
};

Screenshot 2023-11-08 at 5 41 52 PM


Also, Wait for webhook function to complete before responding unchecks itself when you close and re-open the webhook in the configurator.


Waiting for my contact to do an actual test with Salesforce.

@Twi1ightSparkle
Copy link
Contributor

Actually, once you have enabled Wait for webhook function to complete before responding., you can't turn it off again. It appears to just not read waitForComplete": true from the "uk.half-shot.matrix-hookshot.generic.hook", state event when opening the webhook

@Twi1ightSparkle
Copy link
Contributor

Has now been tested with Salesforce, and Sf is happy 🎉

CHANGELOG.md Outdated Show resolved Hide resolved
docs/setup/webhooks.md Outdated Show resolved Hide resolved
src/Connections/GenericHook.ts Outdated Show resolved Hide resolved
@AndrewFerr AndrewFerr added this pull request to the merge queue Nov 20, 2023
Merged via the queue into main with commit f8b71ea Nov 20, 2023
14 checks passed
@AndrewFerr AndrewFerr deleted the hs/add-ability-to-respond-to-webhooks branch November 20, 2023 12:45
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.

Hookshot does not correctly respond to Salesforce webhooks
3 participants