Edits history of script submission #23433 for ' Get Channel (hubspot)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Get Channel
     * Retrieve one conversation channel. Requires conversations.read.
     */
    export async function main(auth: RT.Hubspot, channel_id: string) {
      const url = new URL(
        `https://api.hubapi.com/conversations/v3/conversations/channels/${channel_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