Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Developer Documentation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
brienne
Developer Documentation
Commits
ef31b332
Commit
ef31b332
authored
7 years ago
by
Sean Madsen
Browse files
Options
Downloads
Patches
Plain Diff
hook_civicrm_inboundSMS minor formatting tweaks
parent
3e4f4c19
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/hooks/hook_civicrm_inboundSMS.md
+7
-14
7 additions, 14 deletions
docs/hooks/hook_civicrm_inboundSMS.md
with
7 additions
and
14 deletions
docs/hooks/hook_civicrm_inboundSMS.md
+
7
−
14
View file @
ef31b332
# hook_civicrm_inboundSMS
# hook_civicrm_inboundSMS
##
Description
##
Summary
This hook is called when an inbound SMS has been received, processed by the
This hook is called when an inbound SMS has been received, processed by the
provider extension, but not matched or processed by CiviSMS.
provider extension, but not matched or processed by CiviSMS.
## Availability
4.
7.21+
## Definition
## Definition
```
```
php
hook_civicrm_inboundSMS
(
&
$message
)
hook_civicrm_inboundSMS
(
&
$message
)
```
```
## Parameters
## Parameters
*
CRM_SMS_Message Object
`$message`
- The SMS Message
*
`CRM_SMS_Message`
Object
`$message`
- The SMS Message
## Added
4.
7
## Notes
Using this hook you can
## Examples
## Examples
Alter the incoming SMS From number to match how phone numbers are stored in the database
Alter the incoming SMS From number to match how phone numbers are stored in the database
```
php
```
php
<?php
function
myextension_civicrm_inboundSMS
(
&
$message
)
{
function
myextension_civicrm_inboundSMS
(
&
$message
)
{
// Alter the sender phone number to match the format used in database
// Alter the sender phone number to match the format used in database
$message
->
from
=
str_replace
(
'+614'
,
'04'
,
$message
->
from
);
$message
->
from
=
str_replace
(
'+614'
,
'04'
,
$message
->
from
);
...
@@ -38,7 +34,6 @@ function myextension_civicrm_inboundSMS(&$message) {
...
@@ -38,7 +34,6 @@ function myextension_civicrm_inboundSMS(&$message) {
Automatically add contacts to a group if the message contains 'SUBSCRIBE'
Automatically add contacts to a group if the message contains 'SUBSCRIBE'
```
php
```
php
<?php
function
myextension_civicrm_inboundSMS
(
&
$message
)
{
function
myextension_civicrm_inboundSMS
(
&
$message
)
{
// Add contact to group if message contains keyword
// Add contact to group if message contains keyword
if
(
stripos
(
$message
->
body
,
'SUBSCRIBE'
)
!==
false
)
{
if
(
stripos
(
$message
->
body
,
'SUBSCRIBE'
)
!==
false
)
{
...
@@ -56,7 +51,6 @@ function myextension_civicrm_inboundSMS(&$message) {
...
@@ -56,7 +51,6 @@ function myextension_civicrm_inboundSMS(&$message) {
Send an automatic response to incoming messages
Send an automatic response to incoming messages
```
php
```
php
<?php
function
myextension_civicrm_inboundSMS
(
&
$message
)
{
function
myextension_civicrm_inboundSMS
(
&
$message
)
{
// Send an automatic response
// Send an automatic response
$provider
=
CRM_SMS_Provider
::
singleton
(
array
(
'provider_id'
=>
1
));
$provider
=
CRM_SMS_Provider
::
singleton
(
array
(
'provider_id'
=>
1
));
...
@@ -67,7 +61,6 @@ function myextension_civicrm_inboundSMS(&$message) {
...
@@ -67,7 +61,6 @@ function myextension_civicrm_inboundSMS(&$message) {
Implement custom logic to match the message to the sender
Implement custom logic to match the message to the sender
```
php
```
php
<?php
function
myextension_civicrm_inboundSMS
(
&
$message
)
{
function
myextension_civicrm_inboundSMS
(
&
$message
)
{
// Implement custom matching logic
// Implement custom matching logic
// If there are multiple contacts with the phone number, preference the one that has been sent an SMS most recently
// If there are multiple contacts with the phone number, preference the one that has been sent an SMS most recently
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment