:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(cdp): return the posted message from the slack step (#122979)
Tom Piccirello80a599f95e5a
diff --git a/nodejs/src/cdp/templates/_destinations/slack/slack.template.test.ts b/nodejs/src/cdp/templates/_destinations/slack/slack.template.test.tsindex 580ddc589ff1..3f3adf689c22 100644--- a/nodejs/src/cdp/templates/_destinations/slack/slack.template.test.ts+++ b/nodejs/src/cdp/templates/_destinations/slack/slack.template.test.ts@@ -53,10 +53,12 @@ describe('slack template', () => {const fetchResponse = await tester.invokeFetchResponse(response.invocation, {status: 200,- body: { ok: true },+ body: { ok: true, channel: 'C0123ABC', ts: '1700000000.000200', message: { text: 'hello' } },})expect(fetchResponse.finished).toBe(true)expect(fetchResponse.error).toBeUndefined()+ // A later workflow step reads the ts to reply in the thread of this message.+ expect(fetchResponse.execResult).toEqual({ channel: 'C0123ABC', ts: '1700000000.000200' })})it.each([diff --git a/nodejs/src/cdp/templates/_destinations/slack/slack.template.ts b/nodejs/src/cdp/templates/_destinations/slack/slack.template.tsindex a496e6237474..879b810c1f75 100644--- a/nodejs/src/cdp/templates/_destinations/slack/slack.template.ts+++ b/nodejs/src/cdp/templates/_destinations/slack/slack.template.ts@@ -48,6 +48,8 @@ let res := fetch('https://slack.com/api/chat.postMessage', {if (res.status != 200 or res.body.ok == false) {throw Error(f'Failed to post message to Slack: {res.status}: {res.body}');}++return {'channel': res.body.channel, 'ts': res.body.ts};`.trim(),inputs_schema: [{@@ -143,7 +145,7 @@ if (res.status != 200 or res.body.ok == false) {type: 'string',label: 'Reply in thread',description:- 'Timestamp of the message to reply under. Leave this empty to post a new message. In a workflow triggered by a Slack message, use {event.properties.thread_ts ?? event.properties.ts} to reply under the message that started the run.',+ 'Timestamp of the message to reply under. Leave this empty to post a new message. In a workflow triggered by a Slack message, use {event.properties.thread_ts ?? event.properties.ts} to reply under the message that started the run. To reply under a message that an earlier Slack step posted, add an output variable named slack_ts with result path ts to that step, then use {variables.slack_ts}.',secret: false,required: false,hidden: false,diff --git a/nodejs/tests/fixtures/hog-bytecode/0bc2966c6ec838e0f3b9f9b3cbc4a3f2dda316784fb52317362c4ca2498edb03.json b/nodejs/tests/fixtures/hog-bytecode/0bc2966c6ec838e0f3b9f9b3cbc4a3f2dda316784fb52317362c4ca2498edb03.jsonnew file mode 100644index 000000000000..f02ba7615d62--- /dev/null+++ b/nodejs/tests/fixtures/hog-bytecode/0bc2966c6ec838e0f3b9f9b3cbc4a3f2dda316784fb52317362c4ca2498edb03.json@@ -0,0 +1 @@+["_H",1,32,"channel",32,"channel",32,"inputs",1,2,32,"blocks",32,"blocks",32,"inputs",1,2,32,"text",32,"text",32,"inputs",1,2,42,3,32,"thread_ts",32,"inputs",1,2,2,"empty",1,5,40,11,36,0,32,"thread_ts",32,"thread_ts",32,"inputs",1,2,46,32,"scope",32,"slack_workspace",32,"inputs",1,3,47,3,35,32,"",32," ",32,"",2,"replaceAll",3,36,1,2,"empty",1,32,",",36,1,2,"splitByString",2,32,"chat:write.customize",2,"has",2,4,2,36,2,32,"icon_emoji",32,"inputs",1,2,2,"empty",1,5,3,2,40,11,36,0,32,"icon_emoji",32,"icon_emoji",32,"inputs",1,2,46,36,2,32,"username",32,"inputs",1,2,2,"empty",1,5,3,2,40,11,36,0,32,"username",32,"username",32,"inputs",1,2,46,32,"https://slack.com/api/chat.postMessage",32,"body",36,0,32,"method",32,"POST",32,"headers",32,"Authorization",32,"Bearer ",32,"access_token",32,"slack_workspace",32,"inputs",1,3,2,"concat",2,32,"Content-Type",32,"application/json",42,2,42,3,2,"fetch",2,33,200,36,3,32,"status",45,12,30,36,3,32,"body",45,32,"ok",45,11,4,2,40,21,32,"Failed to post message to Slack: ",36,3,32,"status",45,32,": ",36,3,32,"body",45,2,"concat",4,2,"Error",1,49,32,"channel",36,3,32,"body",45,32,"channel",45,32,"ts",36,3,32,"body",45,32,"ts",45,42,2,38,35,35,35,35]