Thank you for sharing @anon36729299. It looks like you are using our new Python client library v5.X.X to make this request.
- ¿Cómo es el bebé en la semana 32 de embarazo? ¿Qué síntomas hay?
- Trends in gastroenteritis-associated mortality in the United States, 1985–2005: variations by ICD-9 and ICD-10 codes
- Common Diseases Carried by Skunks That May Prove Threatening to Humans and Pets | Palmetto Wild Life Extractors
- Red Robin Steak Fries in the Air Fryer
- Multiple Sclerosis and Neuroimmunology Center
Here is a more detailed code sample for folks who want to do this (python-asana v5.0.3):
Bạn đang xem: Any way to create User @mentions using API?
Xem thêm : The Garbage Man: Why I Collect Racist Objects
import asana from asana.rest import ApiException from pprint import pprint configuration = asana.Configuration() configuration.access_token = ‘<YOUR_ACCESS_TOKEN>’ api_client = asana.ApiClient(configuration) # create an instance of the API class stories_api_instance = asana.StoriesApi(api_client) body = { “data”: { “html_text”: “<body><a data-asana-gid=”<USER_GID>” data-asana-accessible=”true” data-asana-type=”user” data-asana-dynamic=”true”>@<NAME_OF_USER></a>nGood morning</body>”, } } task_gid = “<TASK_GID>” opts = { ‘opt_fields’: “html_text” } try: # Create a story on a task api_response = stories_api_instance.create_story_for_task(body, task_gid, opts) pprint(api_response) except ApiException as e: print(“Exception when calling StoriesApi->create_story_for_task: %sn” % e)
Replace in the above:
- <YOUR_ACCESS_TOKEN>
- <USER_GID>
- <NAME_OF_USER>
- <TASK_GID>
with your own information
Xem thêm : Phosphate Binders
IMPORTANT: @mentions in our rich text does not automatically add the @mentioned user to the resource. So the above code will show the user as @Mentioned in the comment of a task but they will not be added as a collaborator to that task. This means that new events on that task will not notify that @mentioned user. If you want that user to be notified of events on that task in their Asana inbox please make a follow up call to our Add followers to a task endpoint to add that user as a collaborator on the task.
EX: Using python-asana v5.0.3
# create an instance of the API class tasks_api_instance = asana.TasksApi(api_client) body = { “data”: { “followers”: [“<USER_GID>”], } } task_gid = “<TASK_GID>” opts = {} try: # Add followers to a task api_response = tasks_api_instance.add_followers_for_task(body, task_gid, opts) pprint(api_response) except ApiException as e: print(“Exception when calling TasksApi->add_followers_for_task: %sn” % e)
Nguồn: https://buycookiesonline.eu
Danh mục: Info