Webhooks Setup

Slack V2 Webhook

23min

Through Pathfix Automation, you can enable user webhook listening for all your user that have connected their Slack accounts (V2) via Pathfix OAuth.

The following documentation will guide you on how you can setup your Slack account and setup Slack Webhook listening for all your connected users.



Setup in Pathfix OAuth

Before proceeding, make sure you have setup your Slack V2 integration in Pathfix OAuth and have added the Connect button for your users to be able to connect their Slack accounts.

  • Configure your Slack V2 integration in Pathfix OAuth
  • Add the script tag in your application to allow your users to authenticate their Slack accounts (Detailed documentation for Pathfix OAuth setup can be found here)



Document image




Setup in Pathfix Automation (Part 1)

  • Create a blank automation by clicking on Design and selecting New Design
  • Give your first task a name to save the automation (autosave)



Document image




  • Click on the Test and Publish tab and click on Test to run a test on the automation



Document image




  • On successful completion, click on Publish to Live



Document image




  • Click on Endpoints and copy the endpoint url for use in the Webhook setup
  • Live Endpoint is for Live environments and Dev endpoint is for testing/development



Document image




  • Click on Webhooks from the top navigation and click on Create New
  • Select Slack V2 from the list of provider webhooks
  • Paste the endpoint URL copied from the automation into the Callback URL section



Document image






Document image






  • Generate your Webhook URI by clicking on the Webhook URI section. Copy the generated URI for use in Slack later
  • Do not click on Save yet, we will need to complete the Setup in Slack, get the Token for use in the webhook setup before saving



Document image




Setup in Slack (Part 1)

In order to complete your Slack Webhook setup, you will need to add the Callback URL generated by the Pathfix Automation webhook and generate a token from your Slack developer account.



Generate Slack Token:

  • Go to your Slack developer app and select the app you want to setup the webhook against
  • Under Basic Information, scroll down to the Verification Token and copy it for use in the Pathfix Automation Webhook setup



Document image






Setup in Pathfix Automation (Part 2)

  • Paste the Verification Token received from Slack into the Verify Tokens section of the Pathfix Automation Webhook setup



Document image




  • Switch to the Pathfix OAuth tab and copy the Webhook URI for use in Slack
  • Click on Save to save the setting



Document image




  • On the Webhooks page, click on Activate against Slack to activate your webhook



Document image




  • The webhook activation will take a few seconds and will happen in the background (click on Refresh on the top navigation to refresh the page)
  • Once activated, the webhook status will turn Green



Document image




Setup in Slack (Part 2)

  • In your Slack app, click on Event Subscriptions



Document image




  • Enable the subscription event listening



Document image




  • Paste the copied Pathfix Automation Webhook URI unto the Request URL section
  • Slack will automatically try to verify the webhook URI



Document image




  • Scroll down the page and select the type of events you would like to be notified for
  • You can choose from bot events, events on behalf of users or App unfurl domains
  • Once you have made your selection, click on Save Changes



Document image




Your webhook has been setup.



Testing Your Webhook Setup

We recommend running a test on your webhook setup to make sure the setup is right. To do this:

  • Go to your Pathfix OAuth account and click on Test Connection for Slack V2
  • Click on Connect/Re-Connect and connect a Slack account



Document image




  • On successful connection, the Automation will start listening for changes in the connected Slack account for the connected user (depending on what event you have chosen to listen to)
  • You will see the webhook user count increase (if it doesnt increase at first, click on Refresh on the top navigation)



Document image




  • Go to your Slack app and create a test entry (depending on what event you selected to listen for)
  • Go to your Pathfix Automation account, click on Monitor and select the Automation from the list
  • You should see the test event created would have triggered a webhook response



Document image


Your Test is successful.



Configure Your Automation

Now that your webhook has been setup successfully, you will need to copy the payload sent by Slack and captured by Pathfix Automation to create your Automation.

Here are the few initial steps to get you going:

  • Copy the Request received from our test event



Document image




  • Go to the Automation created and paste the Request into the Call data (JSON) section of the first task



Document image




  • From here, you can call an API, run a condition or process the data as you please through the Automation



Document image




Important

  • Any changes made to the automation will need to be done in the Dev environment
  • Once changes are made, you will first have to Test the Automation and on successful completion then Publish to Live
  • Please note, without publishing to Live, the changes will not go into effect



Few points to note on the JSON:

  1. The pathfix_user_id is the same user Id that is sent via the Pathfix OAuth system. This generally is the Current Users Unique Id
  2. the data section of the JSON is the exact data that is sent by the provider





Need help? Reach out to our support via [email protected] or live chat through your Pathfix dashboard