# Create Note using shotgun-api

**URL:** <https://community.shotgridsoftware.com/t/create-note-using-shotgun-api/14198>\
**Category:** Pipeline Integrations\
**Tags:** python-api\
**Created:** [December 7, 2021, 3:09pm UTC](https://community.shotgridsoftware.com/t/create-note-using-shotgun-api/14198 "2021-12-07T15:09:27Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Degraund](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@Degraund](https://community.shotgridsoftware.com/u/Degraund)\
**Post date:** [December 7, 2021, 3:09pm UTC](https://community.shotgridsoftware.com/t/create-note-using-shotgun-api/14198/1 "2021-12-07T15:09:27Z")

</div>

When you create a note using the shotgun-api, it doesn’t show up in either the Activity or the InBox.  
Code responsible for creating a note:  
d\_arg = {  
“project”: {“type”:“Project”, “id”:452},  
“note\_links”: [{“type”:“Shot”, “id”:2133}, {“id”:17148, “type”:“Version”}],  
“subject”: “Rendering Farm”,  
“content”: “…”,  
“user”: {“type”: “ApiUser”, “id”: 93},  
“addressings\_to”: [{“id”:90, “type”:“HumanUser”},{“id”:91, “type”:“HumanUser”}],  
“tasks”:[{“type”:“Task”,“id”:8473}],  
“sg\_note\_type”:“Internal”,  
}  
sg.create(“Note”, d\_arg)

When someone replies to a given Note, it appears in the Activity. But the Note is not displayed in the Inbox.

Is there a way to force the display of the note in the Activity and Inbox?  
Maybe there is another way to notify about the work of the script?

The custom field change also doesn’t show up in the Actions and Inbox folders, but I’m “Follower” of tasks.

---

<div class="post-metadata">

**Author:** ![Patrick](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/patrick/32/4767_2.png) [@Patrick](https://community.shotgridsoftware.com/u/Patrick)\
**Post date:** [December 7, 2021, 5:39pm UTC](https://community.shotgridsoftware.com/t/create-note-using-shotgun-api/14198/2 "2021-12-07T17:39:47Z")

</div>

Same issue here. I’ve raised a ticket and they are investigating. I’d raise a ticket and mention my name so they link the reports. [patrick@reformstudios.com](mailto:patrick@reformstudios.com).  
Thanks  
p.

---

<div class="post-metadata">

**Author:** ![Ricardo\_Musch](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/ricardo_musch/32/405_2.png) [@Ricardo\_Musch](https://community.shotgridsoftware.com/u/Ricardo_Musch)\
**Post date:** [December 7, 2021, 8:24pm UTC](https://community.shotgridsoftware.com/t/create-note-using-shotgun-api/14198/3 "2021-12-07T20:24:25Z")

</div>

Could it possibly be because you are explicitly setting the user as “api user”?

---

<div class="post-metadata">

**Author:** ![mmoshev](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/mmoshev/32/476_2.png) [@mmoshev](https://community.shotgridsoftware.com/u/mmoshev)\
**Post date:** [December 8, 2021, 8:06am UTC](https://community.shotgridsoftware.com/t/create-note-using-shotgun-api/14198/4 "2021-12-08T08:06:36Z")

</div>

Seems to be working fine here, note appears in inbox. We set fewer fields:

```auto
shotgun.create(
        "Note",
        {
            "sg_assigned_to": users[0],
            "addressings_to": users,
            "sg_status_list": "todo",
            "content": note_text,
            "subject": subject,
            "project": project_fields
        })

```

Could it have to do with the status?

---

<div class="post-metadata">

**Author:** ![Degraund](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@Degraund](https://community.shotgridsoftware.com/u/Degraund)\
**Post date:** [December 8, 2021, 9:18am UTC](https://community.shotgridsoftware.com/t/create-note-using-shotgun-api/14198/5 "2021-12-08T09:18:54Z")

</div>

Replaced this parameter and did not install it at all. does not affect the result

---

<div class="post-metadata">

**Author:** ![Degraund](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@Degraund](https://community.shotgridsoftware.com/u/Degraund)\
**Post date:** [December 8, 2021, 9:34am UTC](https://community.shotgridsoftware.com/t/create-note-using-shotgun-api/14198/6 "2021-12-08T09:34:46Z")

</div>

did not affect in any way

---

<div class="post-metadata">

**Author:** ![Patrick](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/patrick/32/4767_2.png) [@Patrick](https://community.shotgridsoftware.com/u/Patrick)\
**Post date:** [December 9, 2021, 12:20pm UTC](https://community.shotgridsoftware.com/t/create-note-using-shotgun-api/14198/7 "2021-12-09T12:20:35Z")

</div>

[mmoshev](https://community.shotgridsoftware.com/u/mmoshev) : What’s your shotgun instance authenticated as? Script or user? (sorry to double check 🙂 )  
eg the `shotgun` of `shotgun.create`

Also, it may appear in your inbox, but can you confirm that it also appears in the “activity” of the associated Task ?  
You appear to be creating a note associated with any entity (just project level). Try again with `note_links` field defined.

---

<div class="post-metadata">

**Author:** ![Degraund](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@Degraund](https://community.shotgridsoftware.com/u/Degraund)\
**Post date:** [December 13, 2021, 3:29pm UTC](https://community.shotgridsoftware.com/t/create-note-using-shotgun-api/14198/8 "2021-12-13T15:29:11Z")

</div>

Alert in Activity and InBox only worked if executed under HumanUser using auth\_token:  
sg = shotgun\_api3.Shotgun(  
“[https://terminal-fx.shotgunstudio.com/](https://terminal-fx.shotgunstudio.com/)”,  
login=“Ivan”,  
password=“Password123”,  
auth\_token=“dff4f58df5g4gdf8gfd45gdf6g64dfg4dfgsfewfdsf4dsf4fgh4fdh64fg46rewg4reg4f64”  
)

Failed to notify this user, Ivan. All notifications created by him and sent to him (addressings\_to = Ivan) are not displayed in the InBox. Because of this, I have to pay for an additional user to send messages to all users!

ヾ(`ヘ´)ﾉﾞ

---

<div class="post-metadata">

**Author:** ![purplepaulette](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@purplepaulette](https://community.shotgridsoftware.com/u/purplepaulette)\
**Post date:** [June 7, 2022, 4:23pm UTC](https://community.shotgridsoftware.com/t/create-note-using-shotgun-api/14198/9 "2022-06-07T16:23:15Z")

</div>

Hey, I know this discussion is from a while ago, I had the same problem and I was able to solve it. On the scripts page in shotgrid there is a field called Generate Events and I needed to have that checked on for my scripts.

Apparently it’s suppose to be on by default (or so it says when I hover over the header), but it has been defaulting to off for all of the new scripts I create.

Hope this helps someone!

---

<div class="post-metadata">

**Author:** ![Patrick](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/patrick/32/4767_2.png) [@Patrick](https://community.shotgridsoftware.com/u/Patrick)\
**Post date:** [July 21, 2022, 7:25am UTC](https://community.shotgridsoftware.com/t/create-note-using-shotgun-api/14198/10 "2022-07-21T07:25:48Z")

</div>

Thanks for sharing Paulette!

---

<div class="post-metadata">

**Author:** ![tweekazoid](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/tweekazoid/32/4534_2.png) [@tweekazoid](https://community.shotgridsoftware.com/u/tweekazoid)\
**Post date:** [July 22, 2022, 9:21am UTC](https://community.shotgridsoftware.com/t/create-note-using-shotgun-api/14198/11 "2022-07-22T09:21:34Z")

</div>

I cannot provide full code because I have written complete abstraction layer for shotgrid database access.

but this is essentially it:

```auto
# optional
attachment = 'c:/temp/cat_image.jpg' # either {type,id} entity or string path, or empty list

note_data = {
            'note_links': [{'type': entity_type, 'id':id }], # can be empty list, but addressings_to must be provided # 'Shot' and 'id' of some shot, or any other valid entity type
            'subject': subject, # str
            'sg_note_type': 'Internal',
            'content': content, # formatted str, cannot be html formated unfortunately
            'user': {'type': user['type'], 'id':user['id']}, # who sent it... apiKey token user from shotgrid_db access method will be used if user is not provided
            'addressings_to': recipient, # may be list of humanUser entities or empty list
            'project': {'type':'Project', 'id':project_id},
            }

shotgrid_db = some method to instantiate SG DB access

ret = shotgrid_db.create('Note', note_data)
if ret:
    if attachment :
        up_ret = shotgrid_db.upload( 'Note', ret['id'], attachment, field_name='image')

```
