HubSpot Ideas

joeolsen

Upgraded Zapier zap(s) functionality to include timeline event creation

Hi HS team. I think the vast majority of the world is starting to use things like Zapier to run enterprise workflows and automation and I think everyone agrees that's great for everyone. Unfortunately, there is a key thing missing from the HubSpot CRM zap(s) functionality that I think you should add immediately. We create a lot of zaps for our product and I know they are quick and easy to do.

 

There should be a zap to add an event to a timeline on a contact record. There is already an API event type created and I would be fine using that template to simply post an html message or even plain text if it was too complicated. Zapier has a webhook put capability which would work to call the HS API, but it requires OAuth 2.0 and zapier obviously doesn't handle that.

15件のコメント
RoundaboutEd
メンバー

I second this. I have just spent three hours trying to find a way to do this (including through Zapier). I already use Zapier to auto-create and update contacts from other services, but we NEED to be able to automate adding an activity or note to a contact's timeline in order for us to use HubSpot. I really don't want to go anywhere else, because I'm impressed with the functionality and flexibility of HubSpot, but if I can't figure out how to do this one element, HubSpot is useless to us and we are back to square one with nothing to use at all.

 

I really hope that this happens in short order because I'm going to have to scrap this whole thing and start over if it doesn't.

jxlio
投稿者

@joeolsen & @RoundaboutEd

I had this problem in the past and figured out how to accomplish this with Zapier.

How To Create a Hubspot Engagement with Zapier:

1. Create your zap with whatever trigger you want, as long as it has the contact’s email address as a variable to use in the next step
2. Use the Hubspot CRM “Find Contact” action to get all the data needed about your contact.
3. Use the Zapier Webhooks “Custom Request” option to create the engagement
4. Set “Method” to “POST”
5. Set “URL” to https://api.hubapi.com/engagements/v1/engagements?hapikey=YOURAPIKEYHERE
6. Set “Data Pass-Through” to “no”
7. Set “Data” with JSON and Zapier variables using the examples/options on the developers page here: https://developers.hubspot.com/docs/methods/engagements/create_engagement (In the example, I create a Note, but this method is great for creating Tasks that include info/data from other platforms)
8. NOTE: Leave out the timestamp in the JSON request body, it will set the timestamp to the time it is created automatically. (If for some reason you want to set the timestamp, make sure it’s in milliseconds or it will make the note appear it was created in the 70’s.)
9. Required fields in the JSON body: ownerId, contactId, body. You can also associate Deals, a Company, and other Hubspot owners.
10. Leave “Unflatten” alone.
11. Leave “Basic Auth” alone.
12. Set “Headers” to Content-Type | application/json
13. Test it out. If something isn’t working

See these screenshots for an example:Screenshot 2017-12-08 14.56.55.png

 

Screenshot 2017-12-08 15.12.05.png

 

Screenshot 2017-12-08 15.12.22.png

 

 

 


It took me a few hours one day to figure this out so hopefully it saves you all some time!.

 

Cheers!

brkn
参加者

Voting this up..

beckyschaen
参加者

@jxlioTHANK YOU! This is a huge help.

 

Any chance you know how to add a return in a note? For example, I want the webhook to send it in multiple lines:

 

Description:
Note about products:
Company name:

jxlio
投稿者

@beckyschaen   You have perfect timing, I just figured that out a few days ago.

 

Just use html to manipulate the text:

 

{
    "engagement": {
        "active": true,
        "type": "NOTE"
    },
    "associations": {
        "contactIds": []
    },
    "metadata": {
        "body": "<h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><strong>Bold</strong><br /><em>Italic</em><p>Paragraph Text Goes Here</p><p>Paragraph Two Text Goes Here</p>"
    }
}

Would look like this:

 

Screenshot 2018-07-24 18.38.23.png

 

 

 

 

agulentz
メンバー

Hi All,

good catch @jxlio ! I've impelemented this in the same way some time ago. Now I'm facing encoding problems. While putting HTML, the code shouldn't contain any characters like "/" or "&". In my case it can happen given that the trigger from this ZAP takes values from a dynamic form (from process.st) and there any character can be put in. Do you have any idea how this can be solved if there is a character that would have to be endcoded for the JSON ?

jxlio
投稿者

@agulentz  I would use Zapier's Formater action to make sure that all characters like that are escaped (https://stackoverflow.com/questions/19176024/how-to-escape-special-characters-in-building-a-json-str...)

KrestenOE
メンバー

 @jxlio (thanks for the guide, was perfect!) & @agulentz

 

I tried my way with Zapier's Formatter, but didn't end up with a viable solution. Upon reaching out to Zapier's support, they ultimately suggested using the 'Code by Zapier' app to sanetize the input with Javascript or Python, sounds reasonable to me - but a little out of my comfort zone. I'll share the code snippet here when I've gotten one of our devs to help me out.

twoolley
参加者

Hi,

 

If someone could help me here I would really appreciate it.  Properties Hubspot Owner ID doesn't seem to be available anymore.  What would I use instead?

Peta_APB
投稿者 | Gold Partner

Hi

I'm currently using the custom request is Zapier Webhooks to log "calls" which is working well, but wondering if anyone can help me with how to also add Type and Outcome to the custom request?   

chrome_2019-05-29_10-49-09.png

 

Looking forward to your replies.

 

Kind regards

Peta

jxlio
投稿者

@Peta_APBHave you tried including those fields in the metadata section of the JSON raw data?

 

Also, the "status" field mentioned on this page: https://developers.hubspot.com/docs/methods/engagements/create_engagement, is that not the "outcome" field?

Peta_APB
投稿者 | Gold Partner

Hi @jxlio thanks for your reply 🙂 I appreciate your time.

 

I did but I know I was missing some info, in particular the name of the additional fields was something I was having trouble finding in https://developers.hubspot.com/docs/methods/engagements/create_engagement

 

And I'm very far from expert...however I also decided to reach out to HS as well and they provided the additional info (thank you Ria from HS).  Here is the response I received which was most helpful to me in case anyone else is looking to do the same thing....

 

 

For "Call Type" - we have to add the "activity type" piece of code under the "engagement" codes. An example of how this would look like in your instance is:

 

"engagement": {
"active" : true,
"ownerId" : ZapierStep,
"type" : "CALL",
"activityType" : "name of call type"
}

 

 

The value has to be one of your call types that are listed here: https://app.hubspot.com/sales-products-settings/3086823/activitytypes.

 

For "Call Outcome" - we have to add the "disposition" piece of code under the "metadata" codes. An example of how this would look like in your instance is:

 

"metadata": {
"status" : "COMPLETED",
"type" : "SMS",
"body" : "<br><strong>[SMS SENT]</strong></br>",
"disposition" : "string of number"
}

 

The value has to be a string of numbers that represent each "outcome" - I've listed them out for you below:

  • No Answer - 73a0d17f-1163-4015-bdd5-ec830791da20
  • Busy - 9d9162e7-6cf3-4944-bf63-4dff82258764
  • Wrong Number - 17b47fee-58de-441e-a44c-c6300d46f273
  • Left live message - a4c4c377-d246-4b32-a13b-75a56a4cd0ff
  • Left voicemail - b2cf5968-551e-4856-9783-52b3da59a7d0
  • Connected - f240bbac-87c9-4f6e-bf70-924b57d47db7

 

So that's definitely the info I needed to add in and it's working well for me now 🙂

 

Thanks again.

 

Cheers

Peta

Peta_APB
投稿者 | Gold Partner

Hi @jxlio 

 

Thanks for replying 😊 I really appreciate your time.

 

I did try include “status” but it’s still missing a field type which I haven’t been able to find in the https://developers.hubspot.com/docs/methods/engagements/create_engagement

 

In which case I reached out to HS and they’ve provided the additional info which was incredibly helpful to me (thanks to Ria from HS). It's the activityType I needed and the disposition in the metadata that I couldn't find. 

 

So if anyone else is looking to do the same the response from HS is below:

 

For "Call Type" - we have to add the "activity type" piece of code under the "engagement" codes. An example of how this would look like in your instance is:

 

"engagement": {

   "active" : true,  

   "ownerId" : ZapierStep,

   "type" : "CALL",

   "activityType" : "name of call type"

}

 

The value has to be one of your call types that are listed here: https://app.hubspot.com/sales-products-settings/3086823/activitytypes.

 

For "Call Outcome" - we have to add the "disposition" piece of code under the "metadata" codes. An example of how this would look like in your instance is:

 

"metadata": {

   "status" : "COMPLETED",  

   "type" : "SMS",

   "body" : "message/body text here",

   "disposition" : "string of number"

}

 

The value has to be a string of numbers that represent each "outcome" - I've listed them out for you below:

  • No Answer - 73a0d17f-1163-4015-bdd5-ec830791da20
  • Busy - 9d9162e7-6cf3-4944-bf63-4dff82258764
  • Wrong Number - 17b47fee-58de-441e-a44c-c6300d46f273
  • Left live message - a4c4c377-d246-4b32-a13b-75a56a4cd0ff
  • Left voicemail - b2cf5968-551e-4856-9783-52b3da59a7d0
  • Connected - f240bbac-87c9-4f6e-bf70-924b57d47db7

 

Thanks again for your help.  

 

Kind regards

Peta

 

noahb
メンバー

@jxlio Using this method, is there a way to associate a contact with a company in Zapier?

 

Many thanks!

jxlio
投稿者

@noahbYou would need to add the Associated Company ID to the "Associations" field in the JSON body:

 

{
    "engagement": {
        "active": true,
        "ownerId": 1,
        "type": "NOTE",
        "timestamp": 1409172644778
    },
    "associations": {
        "contactIds": [2],
        "companyIds": [ASSOCIATED_COMPANY_ID_HERE ],
        "dealIds": [ ],
        "ownerIds": [ ]
    },
    "attachments": [
        {
            "id": 4241968539
        }
    ],
    "metadata": {
        "body": "note body"
    }
}