GithubHelp home page GithubHelp logo

intercom-php-rewrite's Introduction

Clients

$client = new IntercomClient(appId, apiKey);

Users

// Create/update a user
$client->users->create([
  'email' => '[email protected]'
]);

// Add companies to a user
$client->users->create([
  'email' => '[email protected]',
  "companies" => [
    [
      "id" => "3"
    ]
  ]
]);

// Find user by email
$client->users->getUsers(['email' => '[email protected]']);

Leads

// Create/update a lead
// See more options here: https://developers.intercom.io/reference#create-lead
$client->leads->create([]);

// List leads
// See more options here: https://developers.intercom.io/reference#list-leads
$client->leads->getLeads([]);

// Find a lead by ID
$client->leads->getLead("570680a8a1bcbca8a90000a9");

// Delete a lead by ID
$client->leads->deleteLead("570680a8a1bcbca8a90000a9");

// Convert a Lead to a User
$leads->convertLead([
  "contact" => [
    "user_id" => "8a88a590-e1c3-41e2-a502-e0649dbf721c"
  ],
  "user" => [
    "email" => "[email protected]"
  ]
]);

Events

// Create an event
$client->events->create([
  "event_name" => "testing",
  "created_at" => 1391691571,
  "email" => "[email protected]"
]);

// View events for a user
$client->events->getEvents(["email" => "[email protected]"]);

Companies

// Create a company
$client->companies->create([
  "name" => "foocorp", "id" => "3"
]);

// List Companies
$client->companies->getCompanies([]);

Admins

// List admins
$client->admins->getAdmins();

Messages

// Send a message from an admin to a user
// See more options here: https://developers.intercom.io/reference#conversations
$client->messages->create([
  "message_type" => "inapp",
  "subject" => "Hey",
  "body" => "Ponies, cute small horses or something more sinister?",
  "from" => [
    "type" => "admin",
    "id" => "1234"
  ],
  "to" => [
    "type" => "user",
    "email" => "[email protected]"
  ]
]);

Conversations

// List conversations for an admin
// See more options here: https://developers.intercom.io/reference#list-conversations
$client->conversations->getConversations([
  "type" => "admin",
  "admin_id" => "25610"
]);

// Get a single conversation
$client->conversations->getConversation("1234")

// Reply to a conversation
// See more options here: https://developers.intercom.io/reference#replying-to-a-conversation
$client->conversations->replyToConversation("5678", [
  "email" => "[email protected]",
  "body" => "Thanks :)",
  "type" => "user",
  "message_type" => "comment"
]);

Counts

// List counts
// See more options here: https://developers.intercom.io/reference#getting-counts
$client->counts->getCounts([])

Bulk

// Bulk create/update users
// See more options here: https://developers.intercom.io/reference#bulk-user-operations
$client->bulk->users([
  "items" => [ /* ... */ ]
]);

// Bulk create/update users
// See more options here: https://developers.intercom.io/reference#bulk-event-operations
$client->bulk->events([
  "items" => [ /* ... */ ]
]);

Notes

// Create a note
$client->notes->create([
  "admin_id" => "21",
  "body" => "Text for my note",
  "user" => [
    "id" => "5310d8e8598c9a0b24000005"
  ]
]);

// List notes for a user
$client->notes->getNotes([
  "user_id" => "25"
]);

// Get a single Note by id
$client->notes->getNote("42");

Pagination

When listing, the Intercom API may return a pagination object:

{
  "pages": {
    "next": "..."
  }
}

You can grab the next page of results using the client:

$client->nextPage(response['pages']);

intercom-php-rewrite's People

Contributors

bobjflong avatar wavyx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.