Skip to content

Commit bb23913

Browse files
committed
Merge pull request #91 from intercom/BL/contactmessaging
More contact documentation
2 parents b0a9f9b + c1212f5 commit bb23913

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

README.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,29 @@ $intercom->createMessage(array(
398398
"id" => "536e564f316c83104c000020"
399399
)
400400
));
401+
402+
// Message from a contact
403+
$intercom->createMessage(array(
404+
"body" => "help",
405+
"from" => array(
406+
"type" => "contact",
407+
"id" => "543e679ae537f54445000dac"
408+
)
409+
));
410+
411+
// Message from an admin to a contact
412+
$intercom->createMessage(array(
413+
"message_type" => "inapp",
414+
"body" => "how can I help",
415+
"from" => array(
416+
"type" => "admin",
417+
"id" => "25610"
418+
),
419+
"to" => array(
420+
"type" => "contact",
421+
"id" => "543e679ae537f54445000dac"
422+
)
423+
));
401424
?>
402425
```
403426

@@ -453,15 +476,21 @@ The metadata key values in the example are treated as follows-
453476
```php
454477
<?
455478
//Create a new contact
456-
$response = $this->client->createContact(['email' => '[email protected]']);
479+
$response = $intercom->createContact(['email' => '[email protected]']);
457480

458481
//Update a contact
459-
$updated = $this->client->updateContact([
482+
$updated = $intercom->updateContact([
460483
'id' => $response['id'],
461484
'custom_attributes' => ['foo' => 'bar']
462485
]);
463486

464487
//Get all contacts by email
465-
$search = $this->client->getContacts(['email' => '[email protected]']);
488+
$search = $intercom->getContacts(['email' => '[email protected]']);
489+
490+
//Convert a contact into a user
491+
$response = $intercom->convertContact([
492+
"contact" => array("user_id" => 1),
493+
"user" => array("user_id" => 2)
494+
])
466495
>
467496
```

0 commit comments

Comments
 (0)