kolfild26 opened a new issue, #33391:
URL: https://github.com/apache/airflow/issues/33391

   ### Description
   
   I would like to suggest changes in `SlackAPIPostOperator`. 
   SlackAPIPostOperator is supposed to send message to Slack. Now, there is no 
responce left after the execution finished.
   Would be good to save its `ts` and `channel` to XCOM once it's finished 
successfully.
   It looks to be quite easy because 
[here](https://github.com/apache/airflow/blob/main/airflow/providers/slack/operators/slack.py#L84)
 we actually have 
[chat.postMessage](https://api.slack.com/methods/chat.postMessage) responce 
from Slack which includes all needed info. Then we could push it to XCOM.
   ```
   responce = self.hook.call(self.method, json=self.api_params)
   ti = kwargs['context']['task_instance']
   ti.xcom_push(key="ts", value=responce['ts'])
   ti.xcom_push(key="channel", value=responce['channel'])
   ```
   It will look like:
   
![изображение](https://github.com/apache/airflow/assets/12990695/5405b607-2b3d-40c7-87db-b5f18efda979)
   or
   
![изображение](https://github.com/apache/airflow/assets/12990695/45c3c2c9-5a42-4a4f-98d3-451188086c03)
   
   
   ### Use case/motivation
   
   Motivation is to have access to the timestamps of the sent messages in order 
to track them futher - change/delete. In Slack the only way to do it is to know 
its timestamp (& channel of course).
   The case is quite specific and may not be usefull for others, so before open 
a PR, would like to know if this suggestion have chances to be accepted.
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to