@@ -162,36 +162,44 @@ async def trigger_article_generation(
162162 domain : str ,
163163 topic : Optional [str ] = None ,
164164 target_keyword : Optional [str ] = None ,
165- context : Optional [str ] = None
165+ context : Optional [str ] = None ,
166+ slack_channel_id : Optional [str ] = None ,
167+ slack_thread_ts : Optional [str ] = None
166168 ) -> dict :
167169 """
168170 Trigger article generation via mlai-backend.
169-
171+
170172 Args:
171173 slack_user_id: Slack ID of requesting user
172174 domain: Target domain
173175 topic: Article topic (Optional - if omitted, triggers auto-research)
174176 target_keyword: Main keyword
175177 context: Optional conversation context
176-
178+ slack_channel_id: Slack channel for in-thread replies
179+ slack_thread_ts: Slack thread timestamp for in-thread replies
180+
177181 Returns:
178182 Dict containing job_id and status
179183 """
180184 if not self .base_url :
181185 raise ValueError ("MLAI_BACKEND_URL not configured" )
182-
186+
183187 payload = {
184188 "slack_user_id" : slack_user_id ,
185189 "domain" : domain ,
186190 "context" : context
187191 }
188-
192+
189193 # Only add topic/keyword if provided (omitting them triggers auto-research)
190194 if topic :
191195 payload ["topic" ] = topic
192196 if target_keyword :
193197 payload ["target_keyword" ] = target_keyword
194-
198+ if slack_channel_id :
199+ payload ["slack_channel_id" ] = slack_channel_id
200+ if slack_thread_ts :
201+ payload ["slack_thread_ts" ] = slack_thread_ts
202+
195203 async with httpx .AsyncClient () as client :
196204 response = await client .post (
197205 f"{ self .base_url } /api/v1/content/generate" ,
0 commit comments