Edits history of script submission #22749 for ' Get Mailing (outreach)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Get Mailing
     * Retrieves a single mailing by its ID, including engagement attributes (opens, clicks, replies).
     */
    export async function main(auth: RT.Outreach, mailing_id: number) {
      const response = await fetch(
        `https://api.outreach.io/api/v2/mailings/${mailing_id}`,
        {
          headers: {
            Authorization: `Bearer ${auth.token}`,
            Accept: "application/vnd.api+json",
          },
        }
      )
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      return await response.json()
    }
    

    Submitted by hugo989 5 hours ago