Can not create event in timeline


#1

Im using api to create new event show in contact timeline.
i have success send request but nothing show in contact timeline.
please help:

My POST request:
url: https://api.hubapi.com/integrations/v1/181313/timeline/event-types?hapikey=xxxx-xx-xx-xx-xxxxx&userId=3566415
body:
{
"name":"New Event Type",
"applicationId":"181313",
"objectType":"CONTACT",
"headerTemplate":"Title for event ",
"detailTemplate":"This event happened on ",
"email": "phan.linda90@gmail.com"
}

success but nothing show in my contact timeline


#2

I tried curl too but nothing show:

curl -X PUion/json" -d '
{
"id": 380132,
"applicationId": 181313,
"name": "Example event type",
"headerTemplate": "Registered for [{{webinarName}}]",
"detailTemplate": "Registration occurred at {{#formatDate timestamp}}{{/formatDate}}",
"email": "khoi@gmail.com"
}' 'https://api.hubapi.com/integrations/v1/181313/timeline/event-types/380132?hapikey=xx-xx-xx-xx-xx&userId=3566415'


#4

Hi @TechGuyVN, In order to use this endpoint, you'll need to go through the Oauth flow: https://developers.hubspot.com/docs/methods/oauth2/oauth2-overview, as a Hapikey won't have the proper permissions to your application. From the timeline api docs:

Note that you can't use the developer hapikey to create events. This is because the developer hapikey is only for setting up event-types from your development portal. To create an event for a HubSpot portal, that portal will need to grant access to your application via OAuth. Using our OAuth flow you'll need to obtain an access token for a portal and use that to add events to that portal's contacts