Mapping an Account to a Slack Channel #
This guide explains how to map an account in FunnelStory to a Slack channel, including fetching all required IDs, performing the mapping, and removing the mapping if needed.
Required Identifiers #
You will need the following IDs to proceed:
- Data Connection ID: Represents the Slack integration in FunnelStory.
- Account ID: The ID of the account you want to map.
- Slack Channel ID: The ID of the Slack channel to be mapped.
Step 1: Obtain the Data Connection ID #
- Call the Data Connections API
Use the following API call to get all data connections:
fetch("https://app.funnelstory.ai/api/data_connections", {
"method": "GET"
})
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
- Filter for Slack Connections
In the response, locate the connection where"type": "slack". Use itsidas your Data Connection ID.
Step 2: Get Available Slack Channels #
- Fetch Channel List
Substitute your Data Connection ID in the endpoint below:
fetch("https://app.funnelstory.ai/api/data_connections/<DATA_CONNECTION_ID>/slack/channels_data", {
"method": "GET"
})
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
- Identify Channel ID and Name
The response will contain objects withchannel_idandnamefields, e.g.:
{
"channel_id": "C039ZBT0XXX",
"name": "general",
...
}
Choose the channel_id for the target Slack channel.
Step 3: Obtain the Account ID #
- Find Account in UI
Open the Account View page in FunnelStory. - Extract Account ID from URL
The URL will look like:
https://app.funnelstory.ai/accounts?...&account_id=7a659250-deb3-4bb1-1509-2f05da77xxxx...
Here, account_id=7a659250-deb3-4bb1-1509-2f05da77xxxx.
Step 4: Map the Account to the Slack Channel #
With all three IDs in hand, make the following POST request to map the Account to the Slack Channel:
fetch("https://app.funnelstory.ai/api/accounts/<ACCOUNT_ID>/channel_mappings", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
channel_id: "<CHANNEL_ID>",
data_connection_id: "<DATA_CONNECTION_ID>"
}),
})
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
Note: For multiple channel mappings, repeat this step with the required channel IDs.
Step 5: Verifying the Mapping #
To see all channel mappings for an account, call:
fetch("https://app.funnelstory.ai/api/accounts/<ACCOUNT_ID>/channel_mappings", {
method: "GET"
})
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
Step 6: Remove a Mapping #
To unmap a Slack channel from an account, you need the channel mapping ID, which you can get from the GET response in Step 5. Then call:
fetch("https://app.funnelstory.ai/api/accounts/<ACCOUNT_ID>/channel_mappings/<CHANNEL_MAPPING_ID>", {
method: "DELETE"
})
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));