For some reason the SenderID seems to revert to NOTICE - see here when I set the SenderID in the code.
When I leave the SenderID variable out, it sends as the default set - this is good, but we will be occasionally changing the name for different uses.
I am using the Official PHP SDK, with the code below:
$aws_cred = array(
'credentials' => array(
'key' => 'GOT THE KEY',
'secret' => 'GOT THE SECRET',
),
'region' => 'eu-west-1', // < your aws from SNS Topic region
'version' => 'latest'
);
$sns = new \Aws\Sns\SnsClient($aws_cred);
$args = array(
"SenderID" => "MySendID",
"SMSType" => "Promotional",
"Message" => "Amazon y u do dis??",
"PhoneNumber" => "+number"
);
$result = $sns->publish($args);
I am sending to the UK (so SID works there), and also it is within the 11 character limit.
Does anyone have any idea why this is happening?
Cheers
I have found the answer.
The search system didn't materialise this originally, but finally, I have found it.
QUOTE FROM: https://stackoverflow.com/a/43748448/7586984
I found the solution. Set the args this way. It works!
$args = array(
'MessageAttributes' => [
'AWS.SNS.SMS.SenderID' => [
'DataType' => 'String',
'StringValue' => 'YourSenderName'
]
],
"SMSType" => "Transactional",
"PhoneNumber" => "+87654321",
"Message" => "Hello World!"
);
(Optional) For Sender ID, type a custom ID that contains up to 11
alphanumeric characters, including at least one letter and no spaces.
The sender ID is displayed as the message sender on the receiving
device. For example, you can use your business brand to make the
message source easier to recognize.
Support for sender IDs varies by country. For example, messages
delivered to U.S. phone numbers will not display the sender ID. For
the countries that support sender IDs, see Supported Regions and
Countries.
If you do not specify a sender ID, the message will display a long
code as the sender ID in supported countries. For countries that
require an alphabetic sender ID, the message displays NOTICE as the
sender ID.
http://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-phone.html
to sumerise you cant use spaces(you have one) and it wont always work, it depends on country and carrier, it wont work in more places than it will
Related
I am trying to set the sender ID in my API call, but it is being ignored.
Where do I put it/what is the correct attribute name?
I am in the USA, Below are the two places I tried to set the sender id (I tried both SenderID and DefaultSenderID)
$result = $SnSclient->SetSMSAttributes([
'attributes' => [
'DefaultSMSType' => 'Transactional',
'AWS.SNS.SMS.SenderID' =>'CompanyBrand'
],
]);
var_dump($result);//this currently gives an error (method call, not the var_dump)
$result = $SnSclient->publish([
'Message' => $message,
'PhoneNumber' => $phone,
'SenderID' => 'CompanyBrand'
]);
I realise that you use PHP, but I'm a Python person. Just for comparison, this code worked for me:
import boto3
sns_client = boto3.client('sns')
response = sns_client.set_sms_attributes(
attributes={
'DefaultSenderID': 'Foo'
}
)
print(response)
sns_client.publish(Message='Hello',PhoneNumber='+xxx')
I noticed that it didn't like having a Space in the DefaultSenderID.
SenderID is not a valid parameter in the publish() command. Nor does it seem to recognize it as a MessageAttribute within the publish() command.
In Onesignal api, I have added isIos => true,ios_badgeType => Increase,ios_badgeCount => 1,content_available => true in the field array.
But the badge count always remains as 1, it's not increasing with multiple messages.
This is my payload details : $fields = array( 'app_id' => "xxxxxx", 'included_segments' => array('All'), 'data' => array( "notification_type" => "update" ), 'contents' => $content, 'subtitle' => $subtitle, 'headings' => $heading, 'isIos' => true, 'ios_badgeType' => "Increase", 'ios_badgeCount' => 1, 'content_available' => true );
You must add Notification Extension in order to get badge auto update. Please follow the link to setup.
Also, need to create app group and assign both bundle id to that particular group. Please see the section -
In order for your application to be able to let push notifications
increment/decrement the badge count, you need to set up an App Group
for your application.
See here
Please follow https://documentation.onesignal.com/docs/ios-sdk-app-groups-setup in detail.
The name of your app group should be
group.{your_bundle_id}.onesignal
So for example, if your application's bundle identifier is
com.test.app, your app group name should be
group.com.test.app.onesignal.
Assign the group to both
target.
Open your Info.plist file and add a new OneSignal_app_groups_key as a String type.
Enter the group name you checked in the last step as it's value.
Make sure to do the same for the Info.plist under the OneSignalNotificationServiceExtension folder.
Using MailChimp API V3.0 to create a campaign.
I want to create a campaign that sends to users with a specific interest. It looks like this is possible in the docs, but I've tried every permutation I can think of. I can create the campaign fine as long as I leave out the segment_ops member. Does anyone have an example of PHP code that will do it?
It seems that interests are handled strangely since you don't include the interest-category when setting a users interests via the API. I'm not sure how this affects campaign creation.
I've gotten this to work, API definition can be found here https://us1.api.mailchimp.com/schema/3.0/Segments/Merge/InterestSegment.json
Interests have to be grouped under interest categories (called 'Groups' in some parts of the UI).
Here is the JSON for the segment_opts member of the recipients array:
"segment_opts": {
"match": "any",
"conditions": [{
"condition_type": "Interests",
"field": "interests-31f7aec0ec",
"op": "interestcontains",
"value": ["a9014571b8", "5e824ac953"]
}]
}
Here is the PHP array version with comments. The 'match' member refers to the the rules in the array of 'conditions'. The segment can match any, all, or none of the conditions. This example has only one condition, but others can be added as additional arrays in the 'conditions' array:
$segment_opts = array(
'match' => 'any', // or 'all' or 'none'
'conditions' => array (
array(
'condition_type' => 'Interests', // note capital I
'field' => 'interests-31f7aec0ec', // ID of interest category
// This ID is tricky: it is
// the string "interests-" +
// the ID of interest category
// that you get from MailChimp
// API (31f7aec0ec)
'op' => 'interestcontains', // or interestcontainsall, interestcontainsnone
'value' => array (
'a9014571b8', // ID of interest in that category
'5e824ac953' // ID of another interest in that category
)
)
)
);
You may also send to a Saved segment. The gotcha on this is that the segment_id has to be int. I was saving this value in a db as varchar, and it would not work unless cast to int.
(i am using use \DrewM\MailChimp\MailChimp;)
$segment_id = (int) $methodThatGetsMySegmentID;
$campaign = $MailChimp->post("campaigns", [
'type' => 'regular',
'recipients' => array(
'list_id' => 'abc123yourListID',
'segment_opts' => array(
'saved_segment_id' => $segment_id,
),
),
'settings' => array(
'subject_line' => 'A New Article was Posted',
'from_name' => 'From Name',
'reply_to' => 'info#example.com',
'title' => 'New Article Notification'
)
]);
I try to set a reminder (30 minutes before due date) on a task created by the API based on doc examples: https://developers.podio.com/doc/tasks/create-task-with-reference-22420
https://developers.podio.com/doc/tasks/create-task-22419
Here's the code:
PodioTask::create_for(
'item',
$order->item_id,
array(
'text' => "Préparer la livraison de la commande",
'description' => "Testing tasks",
'responsible' => 00000,
'due_date' => date('Y-m-d'),
'due_time' => '09:00:00',
'reminder' => array('remind_delta' => 30)
)
);
Beside of the fact that the reminder is not set, the task is created with the provided information above. There is no error related to the API.
Is there something missing?
I realize this is old, but I finally figured it out. See below:
PodioTask::create_for(
'item',
$item_id,
$attributes = array (
'text' => $item_id,
'private' => true,
'due_date' => $appt_date,
'due_time' => $appt_time,
'responsible' => 1234567, // User ID
'reminder' => (object)[
'remind_delta' => 0
]
)
);
For my purposes the user will always be the same, so I set that as static.
BE AWARE You MUST authenticate with the API using the users credentials that the reminder is being set for. It WILL NOT set a reminder for another user (partially why I'm using a static user).
EDIT Since I don't have enough reputation points, I want to call out Pavlo - Podio
One can verify if a reminder is set by looking at it in Podio. It's pretty simple, either there's a reminder set or there's not.
The OP, and myself, aren't using Ruby, so whether Ruby works or not is irrelevant to the problems we're facing.
While I realize you were trying to help. The fact that you're a "Test Automation Engineer at Podio" raises the expectation that you COULD provide useful information. So pull out the PHP and see what we're experiencing.
I'm having issues attempting to track a package by Tracking Number Unique Identifier. I'm working with the sample PHP code from Fedex Developer Resource Center.
How can I track it using the TrackingNumberUniqueIdentifier?
$path_to_wsdl = __DIR__ . "/WSDL/FEDEX/TrackService_v6.wsdl";
ini_set("soap.wsdl_cache_enabled", "0");
$client = new \Soapclient($path_to_wsdl, array('trace' => 1));
$request = array(
'WebAuthenticationDetail' => array(
'UserCredential' => array(
'Key' => #KEY#,
'Password' => #PASSWORD#
)
),
'ClientDetail' => array(
'AccountNumber' => #SHIPACCOUNT#,
'MeterNumber' => #METER#
),
'Version' => array(
'ServiceId' => 'trck',
'Major' => '6',
'Intermediate' => '0',
'Minor' => '0'
),
'PackageIdentifier' => array(
'Type' => 'TRACKING_NUMBER_OR_DOORTAG',
'Value' => '123456789012',
),
'IncludeDetailedScans' => 1
'TrackingNumberUniqueIdentifier' => '510987654321~123456789012~FX'
);
When you desire to track a package using the FedEx API, you simply provided the tracking number or the door tag number; however, FedEx reuses the tracking numbers, so you may find that one of your tracking numbers has more than one set of events (or more than two shipments associated with it). When that happens, you must use the FedEx tracking number unique identifier (which has the tracking number as prefix) to get the desired set of events.
In case of your request, you are using a non-valid tracking number (123456789012) for the FedEx test environment and an unrelated tracking number unique identifier (510987654321~123456789012~FX). Notice that the suffix of the unique identifier is not the tracking number.
Sadly, FedEx does not provide test tracking number, so I recommend you to switch the endpoint to the production URL, and test the tracking service using real tracking numbers because the production tracking numbers don't work in the test environment.
Remember, don't use the tracking number unique identifier unless your tracking number has two shipments associated with it.
Regards,