Edits history of script submission #23437 for ' Get Inbox (hubspot)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Get Inbox
     * Retrieve one conversations inbox. Requires conversations.read.
     */
    export async function main(auth: RT.Hubspot, inbox_id: string) {
      const url = new URL(
        `https://api.hubapi.com/conversations/v3/conversations/inboxes/${inbox_id}`
      )
    
      const response = await fetch(url, {
        headers: {
          Authorization: `Bearer ${auth.token}`,
          Accept: "application/json",
        },
      })
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      return await response.json()
    }
    

    Submitted by hugo989 5 hours ago