Dear community,
We’ve just got started integrating Hubspot CRM into our platform including our LMS.
We would like our LMS to be able to attach to a Contact, timeline events for high level Learning activity.
Is it possible to create custom Timeline event templates with a Private App?
We don’t need or want to create a public App that is available in the Marketplace as all we would like to do is to use the same Private App we use to sync Contact, Deals, Products and so on between the LMS and Hubspot, also use to create Timeline templates and create timeline events according to our needs.
public function createTimelineTemplates(): void { try { $template = new TimelineEventTemplateCreateRequest(); $template->setHeaderTemplate('Course progress updated on {{#formatDate timestamp}}{{/formatDate}}'); $template->setDetailTemplate('{{extraData.product_title}} completion is at {{extraData.completion_percent}} and badge status is {{extraData.badge_status}}'); $template->setName('Course Progress Timeline Event'); $template->setObjectType('contacts'); $this->hubspot->crm()->timeline()->templatesApi()->create(12345678, $template); } catch (\HubSpot\Client\Crm\Timeline\ApiException $e) { logger()->error(json_encode($e->getResponseBody())); logger()->error('Hubspot timeline template creation failed -' . $e->getMessage()); }}
Returns:
{“status”:“error”,“message”:“Any of the listed authentication credentials are missing”,“correlationId”:“XXXX”,“engagement”:{“service-to-service”:“service-to-service not engaged. Metadata for service-to-service request not found.”,“oauth-token”:“oauth-token not engaged. OAuth access token not found in request header.”,“hapikey”:“hapikey not engaged. hapikey is not present in query params.”,“app-cookie”:“app-cookie not engaged. App cookie is not present on the request.”,“internal-cookie”:“internal-cookie not engaged. Cookie not found in the request.”}}"
Hey @JuampaAcademyEX I can’t comment on the specific code you’re using, but you can create exactly what you’re looking for via the CRM timeline events api, you simply need to post the data to this, while authenticated for that portal and in the format outlined in the documentionation here.
The error you’re seeing is because the post you’ve tried to make is not correctly authenticated to make changes to the portal you’re trying to update. You’ll need to review how you’re authenticating this integration and ensure it has correct access and permissions for the portal you’re adding information to.
I am working on the same implementation as @JuampaAcademyEX and am a little confused if this is actually possible with a private application.
Looking on the developer docs for timeline events, I see a section for ‘Create event templates through the API’ and ‘Create event templates in Hubspot’. But in their respective sections, it says to use a developerApiKey to create one through the API (which you need a developer account for which appears to only be able to work with public apps?) or, if you are trying to create an event template in Hubspot, it says to you can “manage event templates in your HubSpot developer account” (same issue as before). Finally, in the Private Apps documentation, there is a note: "Please note: private apps do not support custom timeline events.".
Has anyone actually been able to implement this yet and confirm it is possible?
@LUnderwood I am trying to create the exact same thing as you, could you please tell me how you did it to create new timeline template on others hubspot accounts? It seems the OAuth token only works when creating the timeline event in other’s hubspot account