You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Taragolis (via GitHub)" <gi...@apache.org> on 2023/08/22 02:37:15 UTC

[GitHub] [airflow] Taragolis commented on issue #33391: SlackAPIPostOperator enhancement

Taragolis commented on issue #33391:
URL: https://github.com/apache/airflow/issues/33391#issuecomment-1687327447

   Unfortunetly store XComs might be expensive, so better do not create additional XComs without reason in common operators. However you always could create your own operator based on `SlackAPIOperator`, `SlackHook` or `SlackWebhookHook`
   
   ```python
   from airflow.providers.slack.operators.slack import SlackAPIOperator
   
   
   class CustomSlackAPIOperator(SlackAPIOperator):
   
       def construct_api_call_params(self) -> Any:
           return {
               "foo": "bar",
               "spam": "egg",
           }
   
       def execute(self, **kwargs):
           if not self.api_params:
               self.construct_api_call_params()
           result = self.hook.call(self.method, json=self.api_params)
           # some user-code below
   ```


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org