Log SMS via API and assign it to the user

Hii,

I’m using API to log SMSs in Hubspot.

I can’t assign an SMS log to the user via API, but I’m adding SMS manually it’s assigned.

[When I’m logging Calls via API, I can assign them to the user, so I am expecting the same behavior with SMS].

As a result, I can’t take reports, for example, “How many SMS was sent per user.”
Is there any solution to that? Or is this something Hubspot will do in the near future?

Hey, @Ketevan :waving_hand: Thanks for flagging this. You are correct, this is not documented in the Communications API endpoints.

I ran a quick test and successfully included hubspot_owner_id. Is this the property you are using to assign Engagements? If so, I’ll list my steps here:

  • Endpoint POST/crm/v3/objects/Communications

  • Request

    curl --request POST \
     --url https://api.hubapi.com/crm/v3/objects/Communications \
     --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
     --header 'content-type: application/json' \
     --data '{
     "properties": {
     "hs_timestamp": "2022-11-12T15:48:22Z",
     "hs_communication_channel_type": "SMS",
     "hs_communication_logged_from": "CRM",
     "hs_communication_body": "Spoke with decision maker about Cats",
     "hubspot_owner_id": "198670650"
     },
     "associations": [
     {
     "to": {
     "id": "901"
     },
     "types": [
     {
     "associationCategory": "HUBSPOT_DEFINED",
     "associationTypeId": 81
     }
     ]
     }
     ]
    }'​
    
  • Response

    HTTP 201
    
    {
     "id": "34215389764",
     "properties": {
     "hs_all_accessible_team_ids": "12073943",
     "hs_all_owner_ids": "198670650",
     "hs_all_team_ids": "12073943",
     "hs_body_preview": "Spoke with decision maker about Cats",
     "hs_body_preview_html": "<html>\n <head></head>\n <body>\n Spoke with decision maker about Cats\n </body>\n</html>",
     "hs_body_preview_is_truncated": "false",
     "hs_communication_body": "Spoke with decision maker about Cats",
     "hs_communication_channel_type": "SMS",
     "hs_communication_logged_from": "CRM",
     "hs_createdate": "2023-04-28T22:30:07.093Z",
     "hs_lastmodifieddate": "2023-04-28T22:30:07.093Z",
     "hs_object_id": "34215389764",
     "hs_timestamp": "2022-11-12T15:48:22Z",
     "hs_user_ids_of_all_owners": "10233975",
     "hubspot_owner_assigneddate": "2023-04-28T22:30:07.093Z",
     "hubspot_owner_id": "198670650",
     "hubspot_team_id": "12073943"
     },
     "createdAt": "2023-04-28T22:30:07.093Z",
     "updatedAt": "2023-04-28T22:30:07.093Z",
     "archived": false
    }​
    
  • I verified it by making a request to GET/crm/v3/objects/Communications/{communicationId}

    curl --request GET \
     --url 'https://api.hubapi.com/crm/v3/objects/Communications/34215389764?properties=hubspot_owner_id&archived=false' \
     --header 'authorization: Bearer YOUR_ACCESS_TOKEN'​
    
    HTTP 200
    
    {
     "id": "34215389764",
     "properties": {
     "hs_createdate": "2023-04-28T22:30:07.093Z",
     "hs_lastmodifieddate": "2023-04-28T22:30:07.093Z",
     "hs_object_id": "34215389764",
     "hubspot_owner_id": "198670650"
     },
     "createdAt": "2023-04-28T22:30:07.093Z",
     "updatedAt": "2023-04-28T22:30:07.093Z",
     "archived": false
    }​
    

Have fun building! — Jaycee

Is there a way to set SMS direction(Inbound/Outbound) as it was done for Calls?

Hi. @VShandak
I couldn’t find that option.

@Jaycee_Lewis could you please confirm?
Thanks